[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Vim tip (was Re: Suspend/Resume issues - Custom scripts notrunning? Mouse frozen?)



Chris Bannister wrote:
If you use vim for your editing, put this in your .vimrc file:

" automatically give executable permissions if file begins with #! and
" contains '/bin/' in the path

function ModeChange()
 if getline(1) =~ "^#!"
   if getline(1) =~ "/bin/"
     silent !chmod a+x <afile>
   endif
 endif
endfunction

au BufWritePost * call ModeChange()

Excellent Chris, I put them into my /etc/vim/vimrc.local file along with the following useful mods:

map <F10> :set paste<CR>
:map <F11> :set nopaste<CR>
:imap <F10> <C-O>:set paste<CR>
:imap <F11> <nop>
:set pastetoggle=<F11>


" Added this setting for swp file location, so as not to adjust
" date/times of actual directory holding the file(s) being edited
" reference: http://www.vim.org/tips/tip.php?tip_id=20
" - this works even if the working directory is writeable..
set directory=/vim-temporary-swp-files


Now I want to find some more gems like this... you have inspired me.

Kind Regards
AndrewM

Andrew McGlashan
Broadband Solutions now including VoIP


Reply to: