Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 47 additions & 10 deletions .vimrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,72 @@ 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

" 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 <leader><space> :nohlsearch<cr>

" 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 <C-h> :tabprevious <cr>
" tab right, similar to 'h: move-let'
nmap <C-l> :tabnext <cr>
"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 <Leader>e :tabedit<space>

"cycle through tabs using C-h and C-l
nnoremap <C-h> gT
nnoremap <C-l> 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 <S-h> mz:exec MoveTabLeft()<CR>`z
nnoremap <S-l> mz:exec MoveTabRight()<CR>`z