diff --git a/.vimrc b/.vimrc index 2319958..7d6dfc8 100644 --- a/.vimrc +++ b/.vimrc @@ -8,12 +8,12 @@ set number set binary noeol " set auto-indenting on for programming -set ai set autoindent set cindent set expandtab set shiftwidth=2 -set ts=2 +set tabstop=2 +set softtabstop=2 " turn off compatibility with the old vi set nocompatible @@ -21,22 +21,59 @@ set nocompatible " turn on the "visual bell" - which is much quieter than the "audio blink" set vb -" do not highlight words when searching for them. it's distracting. -set nohlsearch +set hlsearch +nnoremap :nohlsearch " automatically show matching brackets. works like it does in bbedit. set showmatch " make that backspace key work the way it should -set backspace=indent,eol,start +set backspace=2 " ruby indenting if has("autocmd") filetype indent on endif -" Map tab navigation to mirror cursor navigation -" tab left, similar to 'h: move-let' -nmap :tabprevious -" tab right, similar to 'h: move-let' -nmap :tabnext +"make K work like J +noremap K kJ + +"swap j/k with gj/gk (movement by window line vs file line) +nnoremap j gj +nnoremap gj j +nnoremap k gk +nnoremap gk k +vnoremap j gj +vnoremap gj j +vnoremap k gk +vnoremap gk k + +"quick command for :tabedit +nnoremap e :tabedit + +"cycle through tabs using C-h and C-l +nnoremap gT +nnoremap gt + +"move tabs left and right using S-h and S-l +func! MoveTabLeft() + let tab_n = tabpagenr() - 1 + if tab_n == 0 + exec "tabm" tabpagenr('$') - 1 + else + exec "tabm" tab_n - 1 + endif +endfunc + +func! MoveTabRight() + let tab_n = tabpagenr() - 1 + let last_tab = tabpagenr('$') - 1 + if tab_n == last_tab + exec "tabm" 0 + else + exec "tabm" tab_n + 1 + endif +endfunc + +nnoremap mz:exec MoveTabLeft()`z +nnoremap mz:exec MoveTabRight()`z