diff options
author | johannst <stoelp@eit.uni-kl.de> | 2017-07-04 22:34:45 +0200 |
---|---|---|
committer | johannst <stoelp@eit.uni-kl.de> | 2017-07-04 22:34:45 +0200 |
commit | a16dfdb7ba623a6907b8c082596ac3d58585f9b6 (patch) | |
tree | 274fdce41a37bc65b145f4d808cf8641188f3fe4 /vimrc | |
parent | fe6f40c0bb36a6b53bada98352e79364abce067e (diff) | |
download | dotfiles-a16dfdb7ba623a6907b8c082596ac3d58585f9b6.tar.gz dotfiles-a16dfdb7ba623a6907b8c082596ac3d58585f9b6.zip |
vimrc sandbox: added command to remove c-style commands
Diffstat (limited to 'vimrc')
-rw-r--r-- | vimrc | 33 |
1 files changed, 33 insertions, 0 deletions
@@ -538,6 +538,39 @@ if s:sandbox_enable " when opening file (of given filetype? maybe start with c/c++) create copy in this file in file_path/.bak/file_name " filter file creation somehow, that it does not try to create backups when opening for example /usr/include/*.h + function! s:LineClearPureBlank() + execute 'silent! %s#\m^\s\+$##g' + endfunction + function! s:LineClearTrailingBlank() + execute 'silent! %s#\m\s\+$##g' + endfunction + function! s:ReduceConsecutiveEmptyLines() + execute 'silent! %s/\m\(^\n\)\+/\r/g' + endfunction + + "function! s:LineDeleteCStyleComment() + "execute 'silent! g#\m^\s\{-}//#d' + "endfunction + + function! s:LineClearCStyleComment() + execute 'silent! %s#\m\(.\{-\}\)//.*#\1#g' + endfunction + + function! s:BlockClearCStyleComment() + " hack to keep copyright header + execute 'silent! 2,$s#\m\s\{-\}\/\*[[:alnum:][:blank:][:graph:]\n]\{-\}\*\/\s*##g' + "execute 'silent! %s#\m^\/\*[[:alnum:][:blank:][:graph:]\n]\{-\}\*\/##g' + endfunction + + function! s:RemoveCStyleComments() + call s:LineClearCStyleComment() + call s:BlockClearCStyleComment() + call s:LineClearPureBlank() + call s:LineClearTrailingBlank() + call s:ReduceConsecutiveEmptyLines() + endfunction + command! CC call s:RemoveCStyleComments() + endif "}}} |