endif
-""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" mappings
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let mapleader = ","
nnoremap <C-k> <C-w><C-k>
nnoremap <C-l> <C-w><C-l>
+" ranger
+function! RangeChooser()
+ let temp = tempname()
+ " The option "--choosefiles" was added in ranger 1.5.1. Use the next line
+ " with ranger 1.4.2 through 1.5.0 instead.
+ "exec 'silent !ranger --choosefile=' . shellescape(temp)
+ if has("gui_running")
+ exec 'silent !xterm -e ranger --choosefiles=' . shellescape(temp)
+ else
+ exec 'silent !ranger --choosefiles=' . shellescape(temp)
+ endif
+ if !filereadable(temp)
+ redraw!
+ " Nothing to read.
+ return
+ endif
+ let names = readfile(temp)
+ if empty(names)
+ redraw!
+ " Nothing to open.
+ return
+ endif
+ " Edit the first item.
+ exec 'edit ' . fnameescape(names[0])
+ " Add any remaning items to the arg list/buffer list.
+ for name in names[1:]
+ exec 'argadd ' . fnameescape(name)
+ endfor
+ redraw!
+endfunction
+command! -bar RangerChooser call RangeChooser()
+nnoremap <leader>r :<C-U>RangerChooser<CR>
+
+" Maps Ctrl-[h,j,k,l,+,-] to windows split navigations and resizing
+nnoremap <C-H> <C-W><C-H>
+nnoremap <C-J> <C-W><C-J>
+nnoremap <C-K> <C-W><C-K>
+nnoremap <C-L> <C-W><C-L>
+
if bufwinnr(1)
nnoremap <C-j> :exe "resize " . (winheight(0) * 2/3)<CR>
nnoremap <C-k> :exe "resize " . (winheight(0) * 3/2)<CR>
endif
+
" folding
noremap <space> za
+" force save
+ca w!! w !sudo tee "%"
-"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" autocommands
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
autocmd bufnewfile,bufread *.gradle set filetype=groovy
endif
+" local
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
if filereadable(expand('~/.vim/vimrc.local'))
source ~/.vim/vimrc.local