From a647d34ce197a451b2dac7ad2fa62533a790fa6e Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Wed, 7 Nov 2018 10:33:39 +0100 Subject: Vim Modules en vrac --- vimrc | 60 +++++++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 47 insertions(+), 13 deletions(-) (limited to 'vimrc') diff --git a/vimrc b/vimrc index 9f3b67e..964e2c4 100644 --- a/vimrc +++ b/vimrc @@ -1,6 +1,15 @@ execute pathogen#infect() +call plug#begin('~/.vim/plugged') +Plug 'junegunn/vim-easy-align' +call plug#end() + +" Start interactive EasyAlign in visual mode (e.g. vipga) +xmap ga (EasyAlign) +" Start interactive EasyAlign for a motion/text object (e.g. gaip) +nmap ga (EasyAlign + filetype plugin indent on " To ignore plugin indent changes, instead use: "filetype plugin on @@ -20,6 +29,7 @@ set ruler "Show line numbers set number set laststatus=2 +set rnu "use relative line numbers to cursor function! MyTabLine() let s = '' @@ -50,8 +60,18 @@ function! MyTabLabel(n) return bufname(buflist[winnr - 1]) endfunction +" Show current C function name +fun! ShowFuncName() + let lnum = line(".") + let col = col(".") + echohl ModeMsg + echo getline(search("^[^ \t#/]\\{2}.*[^:]\s*$", 'bWn')) + echohl None + call search("\\%" . lnum . "l" . "\\%" . col . "c") +endfun + "set statusline=%y─┤\ %*%1*%<%f%*\ %2*%M%3*%r%*├%=┤%4*%c%V%*├─┤%4*%l/%L%*├──┤%4*%P%*├─ -set statusline=┤%y\ %*%1*%<%f%*\ %2*%M%3*%r%*├%=┤%P%*├ +set statusline=┤%y\ %*%1*%<%f%*\ %2*%M%3*%r%*├%=┤%1*%v,%c%*├─┤%P%*├ set tabline=%!MyTabLine() @@ -128,7 +148,8 @@ noremap gj j noremap gk k "Macros -nmap :set invet +"nmap mc:%s/[\t ]\+$//'c +nmap :make " folding set foldmethod=indent set foldignore= @@ -151,7 +172,7 @@ augroup END " Quick search for merges nmap /^\(<\{7\}\\|>\{7\}\\|=\{7\}\) -nmap :windo set invnumber +nmap :windo set invrelativenumber "nmap :setlocal foldcolumn-=1:execute 'setlocal foldlevel='.(&foldcolumn - 2) "nmap :setlocal foldcolumn+=1:execute 'setlocal foldlevel='.(&foldcolumn - 2) @@ -165,7 +186,8 @@ nmap :windo set foldcolumn+=1 nmap ; za " open/close recursive under cursor "nmap zA -nmap :windo set invfoldenable +"nmap :windo set invfoldenable +nmap :set invet "buffer moving nmap h :tabN @@ -199,7 +221,7 @@ function! CscopeSearch(csearch) let @/=a:csearch set hls - let l:prompt = "Rechercher '".a:csearch."' avec cscope [cdefgist] : " + let l:prompt = "Rechercher '".a:csearch."' avec cscope [acdefgist] : " echo l:prompt let l:ctype=nr2char(getchar()) @@ -216,12 +238,14 @@ function! LoadTags() elseif filereadable( expand("$PWD/ctags.out") ) set tags=$pwd/ctags.out elseif has("cscope") + set cst if filereadable( expand("$PWD/cscope.out") ) - set cst + cscope add $PWD/cscope.out endif - - " Automagically done... - "cscope add $PWD/cscope.out + let l:git = system("dirname $(git rev-parse --git-dir) | tr -d '\n'") + if filereadable ( l:git . '/cscope.out' ) && l:git != expand("$PWD") + exe 'cscope add ' . l:git . ' ' . l:git + endif " cscope macros nmap C :!cscope -bqu:cs reset @@ -247,7 +271,7 @@ call LoadTags() augroup WhiteSpaces " F*cking whitespaces - autocmd BufRead * highlight ExtraWhitespace ctermbg=red ctermfg=black guibg=red + autocmd BufRead * highlight ExtraWhitespace ctermbg=160 ctermfg=black guibg=red autocmd BufRead * match ExtraWhitespace /\s\+$\| \+\ze\t\| \+/ augroup END @@ -258,7 +282,6 @@ nmap :set invlist set title set autoindent set diffopt=iwhite,filler,vertical -set guifont="Liberation Mono 10" " mouse " v -> enabled in visual mode @@ -274,6 +297,7 @@ set shiftwidth=4 set expandtab let g:detectindent_preferred_expandtab = 1 let g:detectindent_preferred_indent = 4 +let g:detectindent_preferred_when_mixed = 1 augroup DetectIndentation autocmd BufRead * DetectIndent augroup END @@ -287,9 +311,10 @@ set timeoutlen=250 " Code comment/uncomment noremap // m"I// g`"3l noremap /* m"I/* A */jg`"3l - xmap // /* +" xmap // /* +xnoremap // `>o#endif` xnoremap /* `>a */` - noremap \* m"e?/\* *:s:/\* *::/ *\*\/:s: *\*/::\|:nohljg`"3h + noremap \* m"e?/\* xxx/ \*\/xxx:nohljg`"3h noremap \\ m"0:s:// *::\|:nohlg`"3h @@ -312,6 +337,13 @@ noremap / incsearch#go(incsearch_config()) noremap ? incsearch#go(incsearch_config({'command': '?'})) noremap g/ incsearch#go(incsearch_config({'is_stay': 1})) +" FuzzyFinder +map ff :FufFile +map fd :FufDir +map fb :FufBuffer + +map ft :FufTagWithCursorWord! + let g:EasyMotion_do_mapping = 0 " Disable default mappings let mapleader=" " @@ -340,6 +372,7 @@ noremap u :noh runtime! ftplugin/man.vim noremap K :Man =expand("") +let g:ft_man_open_mode = 'vert' " Function @@ -488,3 +521,4 @@ augroup Todo au! autocmd FileType vimwiki set syn=todo augroup END + -- cgit v1.2.3