dotfiles

My personal shell configs and stuff
git clone git://git.alex.balgavy.eu/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

commit b44c5a9fe27a6cfa86c840ba05ad16da3bf388d8
parent df989e86a1afc0fff1363d94bd946c9aee4039f3
Author: Alex Balgavy <a.balgavy@gmail.com>
Date:   Wed, 15 May 2019 14:53:06 +0200

vim: netrw hacks for changing root of tree

netrw would give weird error messages if the cursors wasn't directly
over the name of the directory. Now it doesn't.


Former-commit-id: 84769b5b1c63510c263e66c337e76955611438e1
Diffstat:
Mvim/autocmd.vimrc | 1+
Mvim/commands.vimrc | 8++++++++
2 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/vim/autocmd.vimrc b/vim/autocmd.vimrc @@ -38,4 +38,5 @@ augroup END augroup netrw autocmd! autocmd FileType netrw setl bufhidden=delete + autocmd FileType netrw nnoremap <buffer><silent> gn :<C-u>silent! call NetrwxSetTreetop()<CR> augroup END diff --git a/vim/commands.vimrc b/vim/commands.vimrc @@ -1,4 +1,12 @@ " Functions +function! NetrwxSetTreetop() abort + if w:netrw_liststyle == 3 + let netrwx_snr = strpart(mapcheck('u'), 11, 8) + exe 'let s:NetrwxTreeDir = function("' . netrwx_snr . 'NetrwTreeDir")' + let l:treetop = s:NetrwxTreeDir(1) + call netrw#SetTreetop(l:treetop) + endif +endfunction function! InsertTabWrapper() abort let col = col('.') - 1 if !col || getline('.')[col - 1] !~ '\k'