From f938a84f6b9265f14e96dade6c6260ecf523c5dd Mon Sep 17 00:00:00 2001 From: Urbain Vaes Date: Wed, 7 Feb 2018 16:30:19 +0000 Subject: Add -romainl- suggestions --- vim/.vimrc | 96 ++++++++++++++++++++++++++++++-------------------------------- 1 file changed, 46 insertions(+), 50 deletions(-) (limited to 'vim/.vimrc') diff --git a/vim/.vimrc b/vim/.vimrc index a7a0981..12cb7de 100644 --- a/vim/.vimrc +++ b/vim/.vimrc @@ -127,8 +127,8 @@ function! Call_heytmux(vm) call feedkeys(":'[,']Heytmux! ") endfunction -nmap gh :set opfunc=Call_heytmuxg@ -xmap gh :Heytmux! +nnoremap gh :set opfunc=Call_heytmuxg@ +xnoremap gh :Heytmux! " Iron let g:iron_map_defaults=0 @@ -221,7 +221,7 @@ function! Multiple_cursors_before() if has("nvim") let b:deoplete_disable_auto_complete = 1 else - exe 'NeoCompleteLock' + execute 'NeoCompleteLock' endif endfunction @@ -229,7 +229,7 @@ function! Multiple_cursors_after() if has("nvim") let b:deoplete_disable_auto_complete = 0 else - exe 'NeoCompleteUnlock' + execute 'NeoCompleteUnlock' endif endfunction @@ -241,7 +241,6 @@ let g:tex_flavor='latex' " }}} "" Vim options {{{ set backup -set swapfile set undofile set backupdir^=~/.vim/backup// set directory^=~/.vim/swap// @@ -267,13 +266,11 @@ set showcmd set splitright set smartcase set smartindent -set softtabstop=4 -set t_Co=256 -set tabstop=4 +set softtabstop=-1 " set sotftabstop=&shiftwidth " set formatoptions+=orw silent! set breakindent let &showbreak='--> ' -set clipboard=unnamedplus,unnamed +set clipboard^=unnamedplus,unnamed " set spellfile="$HOME/.vim/spell/en.utf-8.add" if !has("nvim") set encoding=utf-8 @@ -283,8 +280,8 @@ if has("nvim") endif " }}} "" Mappings {{{ -nmap n nzz -nmap N Nzz +nnoremap n nzz +nnoremap N Nzz nnoremap AddWhiteSpaceAfter a h:silent call repeat#set("\AddWhiteSpaceAfter") nnoremap AddWhiteSpaceBefore i l:silent call repeat#set("\AddWhiteSpaceBefore") @@ -293,7 +290,7 @@ nmap ]w AddWhiteSpaceAfter nmap [w AddWhiteSpaceBefore nnoremap w :update -nnoremap q :q! +nnoremap q :q nnoremap d :bd! nnoremap tn :tabnew @@ -304,6 +301,8 @@ nnoremap tm :tabmove nnoremap t0 :tabmove 0 nnoremap t$ :tabmove +nnoremap c :!rm ~/.vim/swap/\%* + nnoremap cqo :copen nnoremap cqc :cclose @@ -314,7 +313,6 @@ nnoremap goF :call system('urxvt -e vifm '.expand("%:p:h").' '.expand("%:p:h").' nnoremap h :e %:p:s,.hpp$,.X123X,:s,.cpp$,.hpp,:s,.X123X$,.cpp, nnoremap Y y$ -nnoremap h nnoremap fw :%s/\s\+$// nnoremap ft :%s/^ \+//g @@ -324,19 +322,13 @@ cnoremap cnoremap cnoremap -nmap -nmap >b :BufSurfForward -nmap :bd! # -nmap >B :BufSurfForward:bd! # -nmap [B [b:bd! # -nmap ]B ]b:bd! # +nnoremap +nnoremap >b :BufSurfForward +nnoremap :bd! # +nnoremap >B :BufSurfForward:bd! # +nnoremap [B [b:bd! # +nnoremap ]B ]b:bd! # -if has("nvim") - nnoremap goh :let @a=getcwd() \| lcd %:h \| terminal:execute 'lcd '.@aA - tnoremap :bd! # - nnoremap :b # \| norm A - tnoremap -endif " }}} "" Colorscheme {{{ let g:airline_theme='deus' @@ -345,35 +337,33 @@ colo seoul256 "" Autocommands {{{ augroup vimrc autocmd! - au BufWritePost *vimrc,*exrc :source % - au BufNewFile,Bufread /tmp/mutt-* setlocal tw=72 - au BufWritePre * + autocmd BufWritePost *vimrc,*exrc :source % + autocmd BufNewFile,Bufread /tmp/mutt-* setlocal tw=72 + autocmd BufWritePre * \ if !isdirectory(expand(':p:h')) | \ call mkdir(expand(':p:h'), 'p') | \ endif " Detect filetypes (! 'setf freefem' does not override...) - au BufNewFile,BufRead *.geo,*.msh set filetype=gmsh - au BufNewFile,BufRead *.pde set filetype=freefem - au BufNewFile,BufRead *.plt set filetype=gnuplot + autocmd BufNewFile,BufRead *.geo,*.msh set filetype=gmsh + autocmd BufNewFile,BufRead *.pde set filetype=freefem + autocmd BufNewFile,BufRead *.plt set filetype=gnuplot " Filetype specific - au FileType gmsh setlocal makeprg=gmsh\ % - au FileType gnuplot setlocal makeprg=gnuplot\ % - au FileType gnuplot setlocal commentstring=#%s - au FileType cpp setlocal commentstring=//%s - au FileType freefem comp freefem - au FileType dirvish setlocal relativenumber - au FileType dirvish setlocal errorformat=%f - au FileType tex set spell + autocmd FileType gmsh setlocal makeprg=gmsh\ % + autocmd FileType gnuplot setlocal makeprg=gnuplot\ % + autocmd FileType gnuplot setlocal commentstring=#%s + autocmd FileType cpp setlocal commentstring=//%s + autocmd FileType freefem comp freefem + autocmd FileType dirvish setlocal relativenumber + autocmd FileType dirvish setlocal errorformat=%f + autocmd FileType tex set spell augroup END " }}} "" My search {{{ " http://vim.wikia.com/wiki/Searching_for_files -" 1 argument: set search program and options -" 2 argument: do search function! MySearch(...) let l:prevgrepprg=&grepprg let l:prevgrepformat=&grepformat @@ -412,20 +402,26 @@ function! FillSearch(...) call feedkeys(':' . g:my_fillprg . ' "' . l:filltext . '"'."\") endfunction -cmap setSearchMode let g:my_fillprg=g:my_searchprgs[g:my_searchprg] -cmap setFindMode let g:my_fillprg=g:my_findprgs[g:my_findprg] -nmap g/ :setSearchMode:set opfunc=FillSearchg@ -nmap ,g :setSearchMode:call FillSearch() -xmap ,g :setSearchMode:call FillSearch(visualmode()) -nmap ,f :setFindMode:call FillSearch() - let g:my_searchprgs = ['Rg', 'GitGrep', 'VimGrep'] let g:my_findprgs = ['Gnufind', 'Gitfind'] let g:my_searchprg = 0 let g:my_findprg = 0 +nnoremap g/ :let g:my_fillprg=g:my_searchprgs[g:my_searchprg]:set opfunc=FillSearchg@ +nnoremap ,g :let g:my_fillprg=g:my_searchprgs[g:my_searchprg]:call FillSearch() +xnoremap ,g :let g:my_fillprg=g:my_searchprgs[g:my_searchprg]:call FillSearch(visualmode()) +nnoremap ,f :let g:my_fillprg=g:my_findprgs[g:my_findprg]:call FillSearch() + " Cycle search / find prgs -nmap cog :let g:my_searchprg=(g:my_searchprg+1)%len(g:my_searchprgs):echom g:my_searchprgs[g:my_searchprg] -nmap cof :let g:my_findprg=(g:my_findprg+1)%len(g:my_findprgs):echom g:my_findprgs[g:my_findprg] +nnoremap cog :let g:my_searchprg=(g:my_searchprg+1)%len(g:my_searchprgs):echom g:my_searchprgs[g:my_searchprg] +nnoremap cof :let g:my_findprg=(g:my_findprg+1)%len(g:my_findprgs):echom g:my_findprgs[g:my_findprg] " }}} +"" Neovim terminal {{{ +if has("nvim") + nnoremap goh :let @a=getcwd() \| lcd %:h \| terminal:execute 'lcd '.@aA + tnoremap :bd! # + nnoremap :b # \| norm A + tnoremap +endif +" }}} -- cgit v1.2.3