diff --git a/vim-files/vimrc b/vim-files/vimrc index 34295c3..3f45dff 100644 --- a/vim-files/vimrc +++ b/vim-files/vimrc @@ -75,7 +75,7 @@ set rtp+=~/dotfiles/misc-files/powerline/powerline/bindings/vim " """ Easymotion map / (easymotion-sn) -map / (easymotion-tn) +omap / (easymotion-tn) map n (easymotion-next) map N (easymotion-prev) let g:EasyMotion_landing_highlight = 1 @@ -253,3 +253,51 @@ function! s:RunShellCommand(cmdline) setlocal nomodifiable 1 endfunction + + +function! MoveToPrevTab() + "there is only one window + if tabpagenr('$') == 1 && winnr('$') == 1 + return + endif + "preparing new window + let l:tab_nr = tabpagenr('$') + let l:cur_buf = bufnr('%') + if tabpagenr() != 1 + close! + if l:tab_nr == tabpagenr('$') + tabprev + endif + sp + else + close! + exe "0tabnew" + endif + "opening current buffer in new window + exe "b".l:cur_buf +endfunc + +function! MoveToNextTab() + "there is only one window + if tabpagenr('$') == 1 && winnr('$') == 1 + return + endif + "preparing new window + let l:tab_nr = tabpagenr('$') + let l:cur_buf = bufnr('%') + if tabpagenr() < tab_nr + close! + if l:tab_nr == tabpagenr('$') + tabnext + endif + sp + else + close! + tabnew + endif + "opening current buffer in new window + exe "b".l:cur_buf +endfunc + +nnoremap :call MoveToNextTab()H +nnoremap :call MoveToPrevTab()H