From 55ad58e683b62283ebb880c964b95a5023f77e46 Mon Sep 17 00:00:00 2001 From: Jannik ZANDER Date: Sat, 7 Jul 2018 07:36:12 +0200 Subject: [PATCH] Add ranger to vimrc --- .vim/vimrc | 45 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/.vim/vimrc b/.vim/vimrc index b15c3b6..5534c11 100644 --- a/.vim/vimrc +++ b/.vim/vimrc @@ -150,7 +150,6 @@ else endif -"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " mappings """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" let mapleader = "," @@ -175,16 +174,57 @@ nnoremap nnoremap nnoremap +" 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 r :RangerChooser + +" Maps Ctrl-[h,j,k,l,+,-] to windows split navigations and resizing +nnoremap +nnoremap +nnoremap +nnoremap + if bufwinnr(1) nnoremap :exe "resize " . (winheight(0) * 2/3) nnoremap :exe "resize " . (winheight(0) * 3/2) endif + " folding noremap za +" force save +ca w!! w !sudo tee "%" -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " autocommands """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" @@ -195,6 +235,7 @@ if has("autocmd") autocmd bufnewfile,bufread *.gradle set filetype=groovy endif +" local """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" if filereadable(expand('~/.vim/vimrc.local')) source ~/.vim/vimrc.local -- 2.43.0