Mercurial > dotfiles
changeset 410:5bbd5963591c
Some Vim config tweaks.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Wed, 20 Dec 2017 09:11:19 -0800 |
parents | c32b9b172314 |
children | 6a0c9e43e34e |
files | vim/vimrc |
diffstat | 1 files changed, 55 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/vim/vimrc Wed Sep 13 10:58:17 2017 -0700 +++ b/vim/vimrc Wed Dec 20 09:11:19 2017 -0800 @@ -188,7 +188,7 @@ set listchars=eol:$,tab:>-,trail:-,extends:>,precedes:<,nbsp:%,conceal:. " Nice auto-complete menu. -set complete=.,w,b,u,t +set complete=.,w,b set completeopt=longest,menuone,preview " Column indicators. @@ -281,6 +281,12 @@ " }}} +" FZF {{{ + + + +" }}} + " Gutentags {{{ let g:gutentags_cache_dir = s:vim_home.'/tags' @@ -467,8 +473,15 @@ augroup VimRCFileType_c au! - autocmd FileType c,c++,cpp,cs setlocal foldmethod=syntax - autocmd FileType c,c++,cpp,cs setlocal colorcolumn=120 + autocmd FileType c,c++,cpp setlocal foldmethod=syntax + autocmd FileType c,c++,cpp setlocal colorcolumn=120 +augroup END + +augroup VimRCFileType_csharp + au! + autocmd BufNewFile,BufRead *.xaml setlocal filetype=xml + autocmd FileType cs setlocal foldmethod=syntax + autocmd FileType cs setlocal colorcolumn=120 augroup END augroup VimRCFileType_css @@ -549,14 +562,6 @@ " Clear search matches nnoremap <leader><space> :noh<cr>:call clearmatches()<cr> -" Ctrl-P mappings. -nnoremap <silent> <C-p> :CtrlP<cr> -nnoremap <silent> <C-o> :CtrlPBuffer<cr> -nnoremap <silent> <C-u> :CtrlPTag<cr> -nnoremap <silent> <C-y> :CtrlPBufTag<cr> -nnoremap <silent> <Tab> :CtrlPMRUFiles<cr> -nnoremap <silent> <F8> :CtrlPBookmarkDir<cr> - " Switch between FR and US keyboard layouts. nnoremap <C-l>f :setlocal keymap=french<cr> nnoremap <C-l>u :setlocal keymap=<cr> @@ -644,6 +649,43 @@ autocmd FileType cs nnoremap <Leader>dc :OmniSharpDocumentation<cr> augroup END +" ProjectRoot mappings +let s:no_auto_projectroot_buftypes = [ + \'help', 'nofile', 'quickfix'] + +function! s:AutoProjectRootCD() abort + try + if index(s:no_auto_projectroot_buftypes, &buftype) == -1 + ProjectRootCD + endif + catch + " Silently ignore invalid buffers + endtry +endfunction + +augroup VimRC_ProjectRoot + autocmd! + autocmd BufEnter * call <SID>AutoProjectRootCD() +augroup END + +nnoremap <leader>cd :ProjectRootCD<cr> + +" Ctrl-P mappings. +if index(g:pathogen_disabled, 'ctrlp') < 0 + nnoremap <silent> <C-p> :CtrlP<cr> + nnoremap <silent> <C-o> :CtrlPBuffer<cr> + nnoremap <silent> <C-u> :CtrlPTag<cr> + nnoremap <silent> <C-y> :CtrlPBufTag<cr> + nnoremap <silent> <Tab> :CtrlPMRUFiles<cr> + nnoremap <silent> <F8> :CtrlPBookmarkDir<cr> +endif + +" FZF mappings. +if index(g:pathogen_disabled, 'fzf') < 0 + nnoremap <silent> <C-p> :Files + nnoremap <silent> <C-o> :Buffers +endif + " }}} " Folding {{{ @@ -655,7 +697,7 @@ set foldnestmax=2 " Folds are defined by markers in the text. -set foldmethod=marker +set foldmethod=marker"{{{"}}} " Toggle folds with <space>. nnoremap <space> za @@ -699,7 +741,7 @@ endfunction function! s:FindInNERDTree() abort - NERDTreeFind + ProjectRootExe NERDTreeFind normal zz endfunction