Mercurial > dotfiles
changeset 626:f795168ece65
clean up unused vim comfig
author | zegervdv <zegervdv@me.com> |
---|---|
date | Tue, 26 Jul 2022 22:33:25 +0200 |
parents | c8960ba7f019 |
children | a2a5862a3bd3 |
files | .chezmoitemplates/config.vim |
diffstat | 1 files changed, 0 insertions(+), 162 deletions(-) [+] |
line wrap: on
line diff
--- a/.chezmoitemplates/config.vim Thu Aug 04 22:04:39 2022 +0200 +++ b/.chezmoitemplates/config.vim Tue Jul 26 22:33:25 2022 +0200 @@ -3,20 +3,6 @@ let s:darwin = has('mac') let s:windows = has('win32') -" Activate built in plugins -if !has('nvim') - if has('packages') - packadd! matchit - packadd! shellmenu - endif -endif -source $VIMRUNTIME/ftplugin/man.vim - -if has("nvim") - let g:python3_host_prog=expand('$HOME/.config/virtualenvs/python3/bin/python') - let g:python_host_prog=expand('$HOME/.config/virtualenvs/python2/bin/python') -endif -" " General Settings and options @@ -146,141 +132,6 @@ cnoremap <expr> <CR> CCR() " -" Text objects -function! s:inIndentation() - " select all text in current indentation level excluding any empty lines - " that precede or follow the current indentationt level; - " - " the current implementation is pretty fast, even for many lines since it - " uses "search()" with "\%v" to find the unindented levels - " - " NOTE: if the current level of indentation is 1 (ie in virtual column 1), - " then the entire buffer will be selected - " - " WARNING: python devs have been known to become addicted to this - " magic is needed for this - let l:magic = &magic - set magic - - " move to beginning of line and get virtcol (current indentation level) - " BRAM: there is no searchpairvirtpos() ;) - normal! ^ - let l:vCol = virtcol(getline('.') =~# '^\s*$' ? '$' : '.') - - " pattern matching anything except empty lines and lines with recorded - " indentation level - let l:pat = '^\(\s*\%'.l:vCol.'v\|^$\)\@!' - - " find first match (backwards & don't wrap or move cursor) - let l:start = search(l:pat, 'bWn') + 1 - - " next, find first match (forwards & don't wrap or move cursor) - let l:end = search(l:pat, 'Wn') - - if (l:end !=# 0) - " if search succeeded, it went too far, so subtract 1 - let l:end -= 1 - endif - - " go to start (this includes empty lines) and--importantly--column 0 - execute 'normal! '.l:start.'G0' - - " skip empty lines (unless already on one .. need to be in column 0) - call search('^[^\n\r]', 'Wc') - - " go to end (this includes empty lines) - execute 'normal! Vo'.l:end.'G' - - " skip backwards to last selected non-empty line - call search('^[^\n\r]', 'bWc') - - " go to end-of-line 'cause why not - normal! $o - - " restore magic - let &magic = l:magic -endfunction - -" "in indentation" (indentation level sans any surrounding empty lines) -xnoremap <silent> ii :<c-u>call <sid>inIndentation()<cr> -onoremap <silent> ii :<c-u>call <sid>inIndentation()<cr> - -function! s:aroundIndentation() - " select all text in the current indentation level including any emtpy - " lines that precede or follow the current indentation level; - " - " the current implementation is pretty fast, even for many lines since it - " uses "search()" with "\%v" to find the unindented levels - " - " NOTE: if the current level of indentation is 1 (ie in virtual column 1), - " then the entire buffer will be selected - " - " WARNING: python devs have been known to become addicted to this - - " magic is needed for this (/\v doesn't seem work) - let l:magic = &magic - set magic - - " move to beginning of line and get virtcol (current indentation level) - " BRAM: there is no searchpairvirtpos() ;) - normal! ^ - let l:vCol = virtcol(getline('.') =~# '^\s*$' ? '$' : '.') - - " pattern matching anything except empty lines and lines with recorded - " indentation level - let l:pat = '^\(\s*\%'.l:vCol.'v\|^$\)\@!' - - " find first match (backwards & don't wrap or move cursor) - let l:start = search(l:pat, 'bWn') + 1 - - " NOTE: if l:start is 0, then search() failed; otherwise search() succeeded - " and l:start does not equal line('.') - " FORMER: l:start is 0; so, if we add 1 to l:start, then it will match - " everything from beginning of the buffer (if you don't like - " this, then you can modify the code) since this will be the - " equivalent of "norm! 1G" below - " LATTER: l:start is not 0 but is also not equal to line('.'); therefore, - " we want to add one to l:start since it will always match one - " line too high if search() succeeds - - " next, find first match (forwards & don't wrap or move cursor) - let l:end = search(l:pat, 'Wn') - - " NOTE: if l:end is 0, then search() failed; otherwise, if l:end is not - " equal to line('.'), then the search succeeded. - " FORMER: l:end is 0; we want this to match until the end-of-buffer if it - " fails to find a match for same reason as mentioned above; - " again, modify code if you do not like this); therefore, keep - " 0--see "NOTE:" below inside the if block comment - " LATTER: l:end is not 0, so the search() must have succeeded, which means - " that l:end will match a different line than line('.') - - if (l:end !=# 0) - " if l:end is 0, then the search() failed; if we subtract 1, then it - " will effectively do "norm! -1G" which is definitely not what is - " desired for probably every circumstance; therefore, only subtract one - " if the search() succeeded since this means that it will match at least - " one line too far down - " NOTE: exec "norm! 0G" still goes to end-of-buffer just like "norm! G", - " so it's ok if l:end is kept as 0. As mentioned above, this means - " that it will match until end of buffer, but that is what I want - " anyway (change code if you don't want) - let l:end -= 1 - endif - - " finally, select from l:start to l:end - execute 'normal! '.l:start.'G0V'.l:end.'G$o' - - " restore magic - let &magic = l:magic -endfunction - -" "around indentation" (indentation level and any surrounding empty lines) -xnoremap <silent> ai :<c-u>call <sid>aroundIndentation()<cr> -onoremap <silent> ai :<c-u>call <sid>aroundIndentation()<cr> -" -" - " Filetype specific settings " Text augroup ft_text @@ -307,24 +158,11 @@ " " Plugin settings -" Gundo tree -nnoremap <leader>u :GundoToggle<CR> - " " Vinegar/NetRW autocmd FileType netrw setl bufhidden=delete " -" Load local vimrc -if filereadable($HOME . '/.vimrc.local') - source ~/.vimrc.local -endif - -" Load project local vimrc -if filereadable('.vimrc.local') - source .vimrc.local -endif - augroup Chezmoi autocmd! autocmd BufWritePost ~/.local/share/chezmoi/* silent !chezmoi apply --source-path %