Skip to content

Instantly share code, notes, and snippets.

View PhilRunninger's full-sized avatar

Phil Runninger PhilRunninger

View GitHub Profile
@PhilRunninger
PhilRunninger / nerdtree.vim
Created August 2, 2019 12:58
Syntax file to change NERDTree indentation to 1 space per level
" This syntax file changes the indentation of NERDTree to appear as 1 space
" per level instead of the normal 2 spaces. It works only if your vim has the
" +conceal feature turned on, and it must be saved as
" ~/.vim/after/syntax/nerdtree.vim to work properly.
if has("conceal")
syntax clear NERDTreeOpenable
syntax clear NERDTreeClosable
let s:dirArrows = escape(g:NERDTreeDirArrowCollapsible, '~]\-').escape(g:NERDTreeDirArrowExpandable, '~]\-')
exec 'syntax match CompressSpaces #['.s:dirArrows.' ]\zs \ze.*' . g:NERDTreeNodeDelimiter . '# containedin=ALL conceal'
@PhilRunninger
PhilRunninger / nerdtree.vim
Last active February 24, 2024 09:47
Open multiple files in NERDTree at once with Visual selection and [NERDTree defaults] o, i, s, and t.
" Filename: ~/.vim/ftplugin/nerdtree.vim
" Purpose: Given a Visual-Line selection in the NERDTree buffer, this code
" lets you open all selected files with the same key mappings, which, by
" default, are:
" o - open files in previous window
" i - open files in horizontally split windows
" s - open files in vertically split windows
" t - open files in new tabs
execute "vnoremap <buffer> " . g:NERDTreeMapActivateNode . " :call <SID>OpenMultiple('p')<CR>"
@PhilRunninger
PhilRunninger / purge.vim
Last active November 1, 2018 21:42
Here's a quick vimscript function I wrote to purge undo and swap files that pertain to files that no longer exist. Just source the file, and issue the command :call Purge()
function! s:PurgeFiles(folder, regex)
" Read file listing into new buffer, and delete empty line.
enew
call execute ("r! ls " . a:folder, "silent")
execute "1delete"
" Duplicate text on each line (minus the .swp extension). We now have:
" swapfile without extension | swapfile
" undofile | undofile
call execute(a:regex, "silent")