dotfiles

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

commit e23894bde8f8c43510dc89433b89926dc7e6c5d9
parent fc25b565ba270e7fbb149ea20018e5963e5e97da
Author: Alex Balgavy <a.balgavy@gmail.com>
Date:   Mon, 18 Feb 2019 19:08:20 +0100

Add delete hidden buffers native

So that it isn't a plugin but is natively in my dotfiles.


Former-commit-id: f3c33b928861053b4f29cc9e283930b70f44fe23
Diffstat:
Mvim/commands.vimrc | 56+++++++++++++++++++++++++++++++++-----------------------
Mvim/plugins.vimrc | 3---
2 files changed, 33 insertions(+), 26 deletions(-)

diff --git a/vim/commands.vimrc b/vim/commands.vimrc @@ -1,26 +1,3 @@ -" Custom commands -command! TodoP vimgrep /TODO\C<Bslash><Bar>TO DO\C/ **/*.* | copen -command! Todo vimgrep /TODO\C<Bslash><Bar>TO DO\c/ % | copen -command! NoteP vimgrep /NOTE\C/ **/*.* | copen -command! Note vimgrep /NOTE\C/ % | copen -command! FixP vimgrep /FIXME\C/ **/*.* | copen -command! Fix vimgrep /FIXME\C/ % | copen -command! ListFileTypes echo glob($VIMRUNTIME . '/syntax/*.vim') -command! CDC cd %:p:h -command! Maketab set noet ts=2 | %retab! -command! Diff w !diff % - -command! Diffc w !git diff % - -command! Fuckwindows %s/ //g -command! Hexedit %!xxd -command! Unhex %!xxd -r -command! JsonSimplifyObject %s/^\(\s\{10}\){\n\s\{12\}\(.*\)\n\s\{10\}}\(,\?\)/\1{ \2 }\3 -command! BeautifyJson %!python -m json.tool -command! Dos2unix .!dos2unix "%" -command! -nargs=1 -complete=command Redir silent call Redir(<f-args>) -" Usage: -" :Redir hi ............. show the full output of command ':hi' in a scratch window -" :Redir !ls -al ........ show the full output of command ':!ls -al' in a scratch window - " Functions function! InsertTabWrapper() abort let col = col('.') - 1 @@ -59,6 +36,39 @@ function! Redir(cmd) abort call setline(1, split(output, "\n")) endfunction +function! DeleteHiddenBuffers() abort " Vim with the 'hidden' option + let tpbl=[] + call map(range(1, tabpagenr('$')), 'extend(tpbl, tabpagebuflist(v:val))') + for buf in filter(range(1, bufnr('$')), 'bufexists(v:val) && index(tpbl, v:val)==-1') + silent execute 'bwipeout' buf + endfor +endfunction + +" Custom commands +command! TodoP vimgrep /TODO\C<Bslash><Bar>TO DO\C/ **/*.* | copen +command! Todo vimgrep /TODO\C<Bslash><Bar>TO DO\c/ % | copen +command! NoteP vimgrep /NOTE\C/ **/*.* | copen +command! Note vimgrep /NOTE\C/ % | copen +command! FixP vimgrep /FIXME\C/ **/*.* | copen +command! Fix vimgrep /FIXME\C/ % | copen +command! ListFileTypes echo glob($VIMRUNTIME . '/syntax/*.vim') +command! CDC cd %:p:h +command! Maketab set noet ts=2 | %retab! +command! Diff w !diff % - +command! Diffc w !git diff % - +command! Fuckwindows %s/ //g +command! Hexedit %!xxd +command! Unhex %!xxd -r +command! JsonSimplifyObject %s/^\(\s\{10}\){\n\s\{12\}\(.*\)\n\s\{10\}}\(,\?\)/\1{ \2 }\3 +command! BeautifyJson %!python -m json.tool +command! Dos2unix .!dos2unix "%" +command! DeleteHiddenBuffers call DeleteHiddenBuffers() +command! -nargs=1 -complete=command Redir silent call Redir(<f-args>) +" Usage: +" :Redir hi ............. show the full output of command ':hi' in a scratch window +" :Redir !ls -al ........ show the full output of command ':!ls -al' in a scratch window + + " Fat finger fixes/convenience abbreviations cnoreabbrev W! w! cnoreabbrev Q! q! diff --git a/vim/plugins.vimrc b/vim/plugins.vimrc @@ -30,9 +30,6 @@ Plug 'tpope/vim-surround' " Eunuch - shell commands but in vim Plug 'tpope/vim-eunuch' -" Delete hidden unused buffers -Plug 'arithran/vim-delete-hidden-buffers' - " Markdown in vim (better than built-in) Plug 'godlygeek/tabular' Plug 'plasticboy/vim-markdown'