set display=lastline,uhex " Show the last line instead of '@'; show non-printable chars as <hex>
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'
if executable('chmod')
function! SetExecutableBit(x)
checktime
- let fname = expand("%:p")
- let fx = executable(fname)
- execute "au FileChangedShell <buffer> call _BufChangedCB()"
+ " Avoid 'Reload Y/N?' question
+ autocmd FileChangedShell <buffer> call _BufChangedCB()
+ let fx = executable(expand("%:p"))
if a:x && !fx
- !chmod a+x %
+ silent !chmod a+x %
elseif !a:x && fx
- !chmod a-x %
+ silent !chmod a-x %
endif
if v:shell_error
echoerr 'Error running chmod: ' . v:shell_error
checktime
endfunction
function! _BufChangedCB()
- execute "au! FileChangedShell <buffer>"
+ autocmd! FileChangedShell <buffer>
endfunction
command! ToggleXbit if executable(expand("%:p")) | call SetExecutableBit(0) | else | call SetExecutableBit(1) | endif
endif