X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=.vimrc;h=4a8453c2a933a4e2556258ec41bff049a290f2b2;hb=6edf846e3fd0060b3ab79da7535df36d1dca687a;hp=d743be717f83686b9ed92935f7260d87224116f9;hpb=85887d410140eb8dd603b20a5fe006fc79f30530;p=dotfiles.git diff --git a/.vimrc b/.vimrc index d743be7..4a8453c 100644 --- a/.vimrc +++ b/.vimrc @@ -44,7 +44,9 @@ set whichwrap=b,s,h,l,<,>,[,],~ " Wrap to the previous/next line on all keys and set display=lastline,uhex " Show the last line instead of '@'; show non-printable chars as set lazyredraw " Do not update screen while executing macros set list " listchars only works with 'list' -set listchars=tab:>_,trail:_,extends:+ " Show tabs, trailing spaces, long lines +" Show tabs, non-breaking/trailing spaces, long lines +set listchars=tab:>_,nbsp:_,trail:_,extends:+,precedes:+ +" Another usefull additions: eol:$,space:_ set wrap " Visually wrap long lines " With 'set wrap' wrap long lines at a character in 'breakat' @@ -586,25 +588,28 @@ endif " From Tip 212: " http://vim.wikia.com/wiki/Setting_file_attributes_without_reloading_a_buffer -function! SetExecutableBit(x) - if !executable('chmod') - return - endif - checktime - let fname = expand("%:p") - execute "au FileChangedShell " . fname . " :echo" - if a:x - silent !chmod a+x % - else - silent !chmod a-x % - endif - if v:shell_error - echoerr 'Error running chmod: ' . v:shell_error - endif - checktime - execute "au! FileChangedShell " . fname -endfunction -command! Xbit if executable(expand("%:p")) | call SetExecutableBit(0) | else | call SetExecutableBit(1) | endif +if executable('chmod') + function! SetExecutableBit(x) + checktime + " Avoid 'Reload Y/N?' question + autocmd FileChangedShell call _BufChangedCB() + let fx = executable(expand("%:p")) + if a:x && !fx + silent !chmod a+x % + elseif !a:x && fx + silent !chmod a-x % + endif + if v:shell_error + echoerr 'Error running chmod: ' . v:shell_error + endif + checktime + endfunction + function! _BufChangedCB() + autocmd! FileChangedShell + endfunction + command! ToggleXbit if executable(expand("%:p")) | call SetExecutableBit(0) | else | call SetExecutableBit(1) | endif +endif + " ---------- " From http://slobin.pp.ru/vim/_vimrc.html