1
0
Fork 0

Current config

This commit is contained in:
Michel 2022-03-30 18:23:36 +02:00
parent 9e24713ac5
commit 493b7fe44b
3 changed files with 794 additions and 0 deletions

7
gvimrc Normal file
View File

@ -0,0 +1,7 @@
set columns=176
" Use maximum height of the screen
set lines=999
" Use ":set guifont=*" to choose from pop-up
set guifont=Hack\ 10

44
syntax/dbc.vim Normal file
View File

@ -0,0 +1,44 @@
" Vim syntax file
" Language: DBC File
" "*.dbc"
" Maintainer: Richard Howe
" Latest Revision: 10 October 2016
if exists("b:current_syntax")
finish
endif
syn keyword dbcSymbols CM_ BA_DEF_ BA_ VAL_ CAT_DEF_ CAT_ FILTER BA_DEF_DEF_
syn keyword dbcSymbols EV_DATA_ ENVVAR_DATA_ SGTYPE_ SGTYPE_VAL_ BA_DEF_SGTYPE_
syn keyword dbcSymbols BA_SGTYPE_ SIG_TYPE_REF_ VAL_TABLE_ SIG_GROUP_ SIG_VALTYPE_
syn keyword dbcSymbols SIGTYPE_VALTYPE_ BO_TX_BU_ BA_DEF_REL_ BA_REL_ BA_DEF_DEF_REL_
syn keyword dbcSymbols BU_SG_REL_ BU_EV_REL_ BU_BO_REL_ NS_DESC_
syn keyword dbcSection VERSION NS_ BS_ BO_ SG_ BU_ Vector__XXX
syn region dbcString start=/\v"/ skip=/\v\\./ end=/\v"/ contains=@Spell
syn match dbcNumber '\d\+'
syn match dbcNumber '[-+]\d\+'
" Floating point number with decimal no E or e (+,-)
syn match dbcNumber '\d\+\.\d*'
syn match dbcNumber '[-+]\d\+\.\d*'
" Floating point like number with E and no decimal point (+,-)
syn match dbcNumber '[-+]\=\d[[:digit:]]*[eE][\-+]\=\d\+'
syn match dbcNumber '\d[[:digit:]]*[eE][\-+]\=\d\+'
" Floating point like number with E and decimal point (+,-)
syn match dbcNumber '[-+]\=\d[[:digit:]]*\.\d*[eE][\-+]\=\d\+'
syn match dbcNumber '\d[[:digit:]]*\.\d*[eE][\-+]\=\d\+'
syn match dbcIdentifier '[a-zA-Z_][0-9a-zA-Z_]*'
let b:current_syntax = "dbc"
highlight link dbcSymbols Type
highlight link dbcSection Keyword
highlight link dbcString String
highlight link dbcNumber Number
highlight link dbcIdentifier Identifier

743
vimrc Normal file
View File

@ -0,0 +1,743 @@
" TODO
" - Make :Mark optional
" - https://github.com/christoomey/vim-sort-motion
" - https://github.com/kana/vim-textobj-user/wiki
" - https://github.com/kana/vim-textobj-indent
" - https://vimawesome.com/plugin/vim-operator-surround
" - https://vimawesome.com/?q=fugitive
" + Gstatus mapping
" - https://github.com/octol/vim-cpp-enhanced-highlight
""" README {{{1
"""""""""""""""""""""""
"" Post-Git {{{2
" After cloning the root repository
" git submodule init
" git submodule update --init --recursive pack/*/start
" git submodule update --init --recursive pack/*/opt
" After upgrading the repository
" git submodule sync
" git submodule update
" git submodule update --init --recursive pack/*/start
"
" To see empty modules (ZSH globbing)
" ls -1d pack/*/*/*(^F)
" git submodule update --init --recursive pack/*/opt
"
" To update submodules to latest origin commits
" git submodule foreach 'git fetch; echo -e "\n\n"'
" git submodule foreach 'LANG=C git status | ack "(up to date|behind)"; echo -e "\n\n"'
" git submodule foreach 'git merge FETCH_HEAD; echo -e "\n\n"'
" 2020-10: git checkout master / git merge origin/master
" To create all doc indexes
" :helptags ALL
"" Debug {{{2
" To see all loaded VIM scripts
" :scriptnames
" To only see some of the loaded VIM scripts
" :filter /opt/ scriptnames
" To edit a script from its number
" :script 3
""" Helper functions {{{1
"""""""""""""""""""""""
function ToggleFlag(option,flag)
exec ('let lopt = &' . a:option)
if lopt =~ (".*" . a:flag . ".*")
exec ('set ' . a:option . '-=' . a:flag)
else
exec ('set ' . a:option . '+=' . a:flag)
endif
endfunction
" https://vim.fandom.com/wiki/Faster_loading_of_large_files
function! LargeFile()
" no syntax highlighting etc
set eventignore+=FileType
" save memory when other file is viewed
setlocal bufhidden=unload
" is read-only (write with :w new_filename)
setlocal buftype=nowrite
" no undo possible
setlocal undolevels=-1
" display message
autocmd VimEnter * echo "The file is larger than " . (g:LargeFile / 1024 / 1024) . " MB, so some options are changed (see .vimrc for details)."
endfunction
""" Directories {{{1
"""""""""""""""""""""""
if getcwd() == $HOME
" Move away from home folder to speed-up call to CtrlP...
cd $HOME/tmp
endif
" ** From the Arch Linux global vimrc **
" Move temporary files to a secure location to protect against CVE-2017-1000382
if exists('$XDG_CACHE_HOME')
let &g:directory=$XDG_CACHE_HOME
else
let &g:directory=$HOME . '/.cache'
endif
let &g:undodir=&g:directory . '/vim/undo//'
let &g:backupdir=&g:directory . '/vim/backup//'
let &g:directory.='/vim/swap//'
" Create directories if they doesn't exist
if ! isdirectory(expand(&g:directory))
silent! call mkdir(expand(&g:directory), 'p', 0700)
endif
if ! isdirectory(expand(&g:backupdir))
silent! call mkdir(expand(&g:backupdir), 'p', 0700)
endif
if ! isdirectory(expand(&g:undodir))
silent! call mkdir(expand(&g:undodir), 'p', 0700)
endif
""" VIM Options {{{1
"""""""""""""""""""""""
" Note: Options are sorted as in the :options window
" Default settings from Bram {{{2
source $VIMRUNTIME/defaults.vim
" Put these in an autocmd group, so that we can delete them easily.
augroup vimrcEx
au!
" For all text files set 'textwidth' to 78 characters.
autocmd FileType text setlocal textwidth=78
augroup END
" https://vim.fandom.com/wiki/Faster_loading_of_large_files
" file is large from 10mb
let g:LargeFile = 1024 * 1024 * 10
augroup LargeFile
au!
autocmd BufReadPre * let f=getfsize(expand("<afile>")) | if f > g:LargeFile || f == -2 | call LargeFile() | endif
augroup END
" 2 - moving around, searching and patterns {{{2
set whichwrap=b,s,<,>,[,]
set nowrapscan
set ignorecase
set smartcase
" 4 - displaying text {{{2
set nowrap
set list
set listchars=tab:→\ ,trail,nbsp
set relativenumber
set numberwidth=2
" 5 - syntax, highlighting and spelling {{{2
"if has("gui_running")
"endif
set background=light
set hlsearch
colorscheme morning
highlight Cursor guifg=#000000 guibg=#FF0058
highlight StatusLine guifg=#dd1234 guibg=#ffffff
set spell
set spelllang=en_gb
" 6 - multiple windows {{{2
set hidden
set splitright
set splitbelow
" 9 - using the mouse {{{2
set mousehide
" 10 - GUI {{{2
if has("gui_running")
" Menu
set guioptions-=m
map <silent> <F10> :call ToggleFlag("guioptions","m")<CR>
" Toolbar
set guioptions-=T
" No scrollbars
set guioptions-=rL
set guiheadroom=0
endif
" 13 - selecting text {{{2
" set clipboard+=unnamedplus
" Doesn't work as expected with Yoink & Subversive
" 14 - editing text {{{2
" Flags that tell how automatic formatting works (see help fo-table)
" o: Automatically insert the current comment leader after hitting 'o' or 'O' in Normal mode
set formatoptions-=o
set nrformats+=alpha
" 15 - tabs and indenting {{{2
set shiftwidth=2
set expandtab
" 16 - folding {{{2
set foldmethod=marker
set foldlevel=1
" 19 - reading and writing files {{{2
set backup
set undofile
" 21 command line editing {{{2
set wildignore+=*.o
" 23 quickfix {{{2
" See https://phelipetls.github.io/posts/extending-vim-with-ripgrep/
if executable("rg")
" Quickfix Unimpaired: [q ]q
" :gr[ep]
" :grepa[dd]
" Location Unimpaired: [l ]l
" :lgr[ep][!]
set grepprg=rg\ --vimgrep
set grepformat=%f:%l:%c:%m
endif
" 26 - various {{{2
set gdefault " use the 'g' flag for ":substitute"
""" Key Mapping {{{1
"""""""""""""""""""""""
" See :map-special-keys, :map-special-chars & <Char>
" To see all mappings into a buffer:
" redir @a | silent nmap <leader> | redir END | vnew | put a | let @a="" | sort r /\S\+$/
"" For French AZERTY keyboard {{{2
""
let mapleader="²"
nmap ( [
nmap ) ]
omap ( [
omap ) ]
xmap ( [
xmap ) ]
map è `
map èè ``
"" Generic {{{2
""
" Movements
map <space> <c-F>
inoremap <c-h> <left>
inoremap <c-j> <down>
inoremap <c-k> <up>
inoremap <c-l> <right>
noremap j gj
noremap k gk
nmap Q gq$
nmap Y y$
map g<c-t> :tabclose<cr>
noremap <c-w>w <c-w>W
nnoremap <F1> :vert help <c-R><c-W>
vnoremap <F1> y:vert help <c-R>"
nnoremap <leader><F1> :tab help <c-R><c-W>
vnoremap <leader><F1> y:tab help <c-R>"
nnoremap <S-F1> :NERDTree ~/.vim<cr>
nnoremap <C-S-F1> :tabedit ~/.vim/vimrc<cr>
"" Operator-pending {{{2
" (see Subversive module)
" ie = inner entire buffer
onoremap ie :exec "normal! ggVG"<cr>
" iv = current viewable text in the buffer
onoremap iv :exec "normal! HVL"<cr>
" vim-swap package: select "swappable" items
omap i, <Plug>(swap-textobject-i)
xmap i, <Plug>(swap-textobject-i)
omap a, <Plug>(swap-textobject-a)
xmap a, <Plug>(swap-textobject-a)
"" Abbreviations {{{2
""
"cabbr <expr> %% expand('%:p:h')
" Use %:h<tab> and learn more!
""" File types {{{1
"""""""""""""""""""""""
let g:markdown_folding=1
""" Base Packages {{{1
"""""""""""""""""""""""
" This section contains packages that extend VIM without changing its basic
" behaviour so that an advanced user shouldn't be (too) disappointed.
"" CtrlP {{{2
""
"" Full path fuzzy file, buffer, mru, tag, ... finder
let g:ctrlp_cmd = 'CtrlPBuffer'
let g:ctrlp_prompt_mappings = { 'ToggleMRURelative()': ['<F2>'] }
let g:ctrlp_switch_buffer = 'et'
let g:ctrlp_max_depth = 5
" \v === Very Magic
let g:ctrlp_custom_ignore = {
\ 'dir': '\v\/(build|\.git$)',
\ 'file': '\v\.o$'
\ }
" From Mixed mode, C-F moves to Files & Ctrl-B moves to Buffers
let g:ctrlp_types = ['fil', 'mru', 'buf']
" MRU options
let g:ctrlp_tilde_homedir = 1
let g:ctrlp_mruf_relative = 0
"" NERDTree {{{2
""
"" File system explorer
nnoremap <silent> <C-N> :NERDTreeFocus<cr>
nnoremap <silent> <leader>n :NERDTreeFind<cr>
nnoremap <silent> <leader><C-N> :NERDTreeMirror<cr>
let NERDTreeChDirMode=2
let NERDTreeNaturalSort=0
let NERDTreeQuitOnOpen=1
let NERDTreeSortOrder=['\/$', '*', '\.swp$', '\~$']
"" Secure Modelines {{{2
""
"" Secure alternative to Vim modelines
set nomodeline
let g:secure_modelines_verbose=1
let g:secure_modelines_allowed_items = [
\ "list", "nolist",
\ "foldlevel", "fdl",
\
\ "textwidth", "tw",
\ "softtabstop", "sts",
\ "tabstop", "ts",
\ "shiftwidth", "sw",
\ "expandtab", "et", "noexpandtab", "noet",
\ "filetype", "ft",
\ "foldmethod", "fdm",
\ "readonly", "ro", "noreadonly", "noro",
\ "rightleft", "rl", "norightleft", "norl",
\ "cindent", "cin", "nocindent", "nocin",
\ "smartindent", "si", "nosmartindent", "nosi",
\ "autoindent", "ai", "noautoindent", "noai",
\ "spell", "nospell",
\ "spelllang", "spl"
\ ]
"" Sensible {{{2
""
"" Universal set of defaults
"" Repeat {{{2
""
"" Enable repeating supported plugin maps with "."
""" Extra Packages {{{1
"""""""""""""""""""""""
" This section contains packages that:
" - change VIM behaviour (and could mislead an advanced user);
" - a user could live without.
"" Asterisk {{{2
""
"" Improved star motions
map * <Plug>(asterisk-z*)
map g* <Plug>(asterisk-gz*)
map # <Plug>(asterisk-z#)
map g# <Plug>(asterisk-gz#)
" z = don't move
"" Cutlass {{{2
""
"" TODO: Check origin repository
"" Optional: Redirect all change and delete operations to the black hole register
" Forked from https://github.com/svermeulen/vim-cutlass.git
" - Removed the "d" mappings from vim-cutlass/autoload/cutlass.vim
" since I cannot get used to using an "m" mapping to "cut",
" - Changed "x" to behave like "d", without yanking
"
" Use [Y to "forget" the last cut.
packadd! cutlass
"" Easymotion {{{2
""
"" Simpler way to use some motions
" Use french key "é" as prefix
map é <Plug>(easymotion-prefix)
map éé <Plug>(easymotion-W)
let g:EasyMotion_keys = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
" Use Upper J/K to move to line #0 (lower j/k keep cursor in column)
let g:EasyMotion_startofline = 0
nmap <Plug>(easymotion-prefix)z <Plug>(easymotion-overwin-line)
map <Plug>(easymotion-prefix). <Plug>(easymotion-repeat)
map <Plug>(easymotion-prefix)" <Plug>(easymotion-next)
map <Plug>(easymotion-prefix)& <Plug>(easymotion-prev)
"" Mark {{{2
""
packadd! ingo-library
nmap <leader>* <Plug>MarkSearchAnyNext
nmap <leader># <Plug>MarkSearchAnyPrev
nmap <Leader>M <Plug>MarkToggle
nmap <Leader>N <Plug>MarkConfirmAllClear
if &t_Co == 256 || has("gui_running")
let g:mwDefaultHighlightingPalette = 'extended'
endif
" The plugin will create the following mappings if they are not already
" assigned to key sequences (and vim will complain when redefining).
"
" <Plug>MarkSet ²m
" <Plug>MarkRegex ²r
" <Plug>MarkClear ²n
" <Plug>MarkSearchCurrentNext ²*
" <Plug>MarkSearchCurrentPrev ²#
" <Plug>MarkSearchAnyNext ²/
" <Plug>MarkSearchAnyPrev ²?
" <Plug>MarkSearchNext *
" <Plug>MarkSearchPrev #
nmap <Plug>IgnoreMark1 <Plug>MarkClear
nmap <Plug>IgnoreMark2 <Plug>MarkSearchCurrentNext
nmap <Plug>IgnoreMark3 <Plug>MarkSearchCurrentPrev
nmap <Plug>IgnoreMark4 <Plug>MarkSearchNext
nmap <Plug>IgnoreMark5 <Plug>MarkSearchPrev
"" Mundo {{{2
""
"" Allow for removing, changing, and adding surroundings.
nnoremap <F5> :MundoToggle<CR>
"" Subversive {{{2
""
"" Optional: Two new operator motions to perform quick substitutions.
packadd! subversive
" subversive-substitute-motion
" Note: Works with yoink plug-in to swap through yanks
" Note: This is shadowing the change character key 's'
" so you will have to use the longer form 'cl'.
"
nmap s <plug>(SubversiveSubstitute)
nmap ss <plug>(SubversiveSubstituteLine)
nmap S <plug>(SubversiveSubstituteToEndOfLine)
" Visual mode substitution
xmap s <plug>(SubversiveSubstitute)
" RTFM: subversive-substitute-over-range-motion
" For range motion, see vim help: text-objects
" See also above in "Key Mapping" — "Operator-pending", in vimrc,
" for new substitution ranges.
" Current text is saved into register W
" Use <c-r>"w to insert the register content or
" use <c-r><c-w> to insert the word under the cursor.
" See vim help: cmdline-history, c_CTRL-R & c_CTRL-R_CTRL-W
let g:subversiveCurrentTextRegister='w'
nmap <leader>s <plug>(SubversiveSubstituteRange)
xmap <leader>s <plug>(SubversiveSubstituteRange)
nmap <leader>ss <plug>(SubversiveSubstituteWordRange)
" subversive-confirming
nmap <leader>c <plug>(SubversiveSubstituteRangeConfirm)
xmap <leader>c <plug>(SubversiveSubstituteRangeConfirm)
nmap <leader>cc <plug>(SubversiveSubstituteWordRangeConfirm)
" subversive-abolish-integration
nmap <leader>S <plug>(SubversiveSubvertRange)
xmap <leader>S <plug>(SubversiveSubvertRange)
nmap <leader>SS <plug>(SubversiveSubvertWordRange)
"" Surround {{{2
""
"" Allow for removing, changing, and adding surroundings.
"" Tabular {{{2
""
"" Optional: Aligning text
" packadd! tabular
"" Unimpaired {{{2
""
"" Provides several pairs of bracket maps
" unimpaired-next next & previous
" unimpaired-lines space & exchange
" unimpaired-toggling Options [ ] y
" unimpaired-encoding encoding & decoding
"" Yoink {{{2
""
"" Optional: History of yanks that you can choose between when pasting.
packadd! yoink
let g:yoinkAutoFormatPaste=0
let g:yoinkIncludeDeleteOperations=1
let g:yoinkMoveCursorToEndOfPaste=1
let g:yoinkSyncSystemClipboardOnFocus=0
" Yank mappings
"nmap y <plug>(YoinkYankPreserveCursorPosition)
"xmap y <plug>(YoinkYankPreserveCursorPosition)
" Note: Using upper-case Y because lower-case are already used by Unimpaired
nmap [Y <plug>(YoinkRotateBack)
nmap ]Y <plug>(YoinkRotateForward)
"" Paste mappings
nmap p <plug>(YoinkPaste_p)
nmap P <plug>(YoinkPaste_P)
nmap <c-j> <plug>(YoinkPostPasteSwapForward)
nmap <c-k> <plug>(YoinkPostPasteSwapBack)
nmap <M-=> <plug>(YoinkPostPasteToggleFormat)
""" Dev Packages {{{1
"""""""""""""""""""""""
" This section contains packages that are mostly useful when developing
" software -- for basic editing of text files they are overkill.
" Doxygen C++ comments
" See https://vim.fandom.com/wiki/Continuing_doxygen_comments
"
" Fold method & initial level
autocmd FileType cpp setlocal comments^=:/// foldmethod=syntax foldlevel=0
"" Abolish {{{2
""
"" Find, substitute, and abbreviate several variations of a word at once.
" abolish-coercion
" camelCase MixedCase _snake_case UPPERCASE -dash-case dot.case space Title
"" Commentary {{{2
""
"" C++ {{{2
""
"let g:cpp_function_highlight = 0
"let g:cpp_attributes_highlight = 1
"let g:cpp_member_highlight = 1
"let g:cpp_simple_highlight = 1
"" FSwitch {{{2
""
"" Switch between companion files of source code
let g:fsnonewfiles=1
nnoremap <silent> <leader>oo :FSHere<cr>
nnoremap <silent> <leader>ol :FSRight<cr>
nnoremap <silent> <leader>oL :FSSplitRight<cr>
nnoremap <silent> <leader>oh :FSLeft<cr>
nnoremap <silent> <leader>oH :FSSplitLeft<cr>
nnoremap <silent> <leader>ok :FSAbove<cr>
nnoremap <silent> <leader>oK :FSSplitAbove<cr>
nnoremap <silent> <leader>oj :FSBelow<cr>
nnoremap <silent> <leader>oJ :FSSplitBelow<cr>
augroup fswitch_vimrc
au!
au BufRead */src/*/src/*.cpp let b:fswitchlocs='reg:!\(src/.*/\)src!\1include!'
" ProtoBuf
au BufRead *.proto let b:fswitchdst = 'options' | let b:fswitchlocs = '.'
" RTmaps
" au BufRead *.u/src/*.cpp let b:fswitchlocs='reg:/src/local_interfaces/'
" au BufRead *.u/local_interfaces/*.h* let b:fswitchlocs='reg:/local_interfaces/src/'
augroup END
"" Fugitive {{{2
""
"" Optional: Set of commands defined as a gateway to Git
packadd! fugitive
"" GitGutter {{{2
""
"" git diff in the 'gutter' (sign column).
"" HexDec {{{2
""
"" Optional: Converts numbers under cursor
" packadd! hexdex
"" Indent Guides {{{2
""
"" Optional: Visually displaying indent levels
" packadd! indent-guides
" let g:indent_guides_enable_on_vim_startup=1
" let g:indent_guides_guide_size=1
" let g:indent_guides_start_level=2
"" MediaWiki {{{2
""
"" Optional: Syntax highlighter for MediaWiki-based projects
"packadd mediawiki.vim
"" Rooter {{{2
""
"" Changes the working directory to the project root
"" Scriptease {{{2
""
"" Optional: Plugin for making/debugging Vim plugins
"packadd! scriptease
"" Sleuth {{{2
""
"" Automatically adjusts 'shiftwidth' and 'expandtab' heuristically
"" Swap {{{2
""
"" Swap delimited items
"" Visual Increment {{{2
""
"" Increase and decrease number or letter sequences via visual mode
" See also
" - https://github.com/nishigori/increment-activator.git
" Increment the list that you have defined.
" - https://github.com/vim-scripts/VisIncr
" Charles Campbell's visual increment plugin
"" Vue.js {{{2
""
"" Optional: Syntax Highlight for Vue.js components
"packadd! vue
"" YouCompleteMe {{{2
""
nnoremap <leader>yd :YcmDiags<cr>
nnoremap <leader>yf :YcmCompleter<space>FixIt<cr>
nnoremap <leader>yg :YcmCompleter<space>GoToImprecise<cr>
nnoremap <leader>yG :YcmCompleter<space>GoToReferences<cr>
nnoremap <leader>yR :YcmCompleter<space>RefactorRename
nnoremap <leader>yy :YcmCompleter<space>GetDocImprecise<cr>
nnoremap <C-W>yg :split<bar>YcmCompleter<space>GoToImprecise<cr>
let g:ycm_always_populate_location_list = 1
let g:ycm_auto_hover = ''
let g:ycm_autoclose_preview_window_after_insertion = 0
let g:ycm_complete_in_strings = 0
let g:ycm_error_symbol = '!>'
let g:ycm_warning_symbol = ':>'
" }}}1
" Tim Pope's sensible.vim is loaded after vimrc.
"
" vim:ts=50:fdm=marker:foldlevel=1:nolist