Archive for January, 2005

.vimrc options to assist with perl coding

Sunday, January 16th, 2005

Edit the .vimrc file and add the following:





” F2 close current window (commonly used with my F1/F3 functions)

noremap :close

” perl -cw buffer, using a temp file, into a new window

function! PerlCW()

let l:tmpfile1 = tempname()

let l:tmpfile2 = tempname()

execute “normal:w!” . l:tmpfile1 . “\

execute “normal:! perl -cw “.l:tmpfile1.” \> “.l:tmpfile2.” 2\>\&1

+ \

execute “normal:new\

execute “normal:edit ” . l:tmpfile2 . “\

endfunction

” perl buffer, using a temp file, into a new window

function! PerlOutput()

let l:tmpfile1 = tempname()

let l:tmpfile2 = tempname()

execute “normal:w!” . l:tmpfile1 . “\

execute “normal:! perl “.l:tmpfile1.” \> “.l:tmpfile2.” 2\>\&1 \
+R>”

execute “normal:new\

execute “normal:edit ” . l:tmpfile2 . “\

endfunction

” Settings for editing perl source (plus bind the above two functions)

function! MyPerlSettings()

if !did_filetype()

set filetype=perl

endif

set textwidth=78

set expandtab

set tabstop=4

set shiftwidth=4

set cindent

set comments=:#

set formatoptions=croql

set keywordprg=man\ -S\ 3

noremap :call PerlCW()

noremap :call PerlOutput()

endfunction

if has(“eval”)

augroup SetEditOpts

au!

autocmd FileType perl :call MyPerlSettings()

augroup END

endif

endif

VIM option file

Sunday, January 16th, 2005

Setting VIM options:

http://babbage.cs.qc.edu/courses/cs701/Handouts/using_vim.html



The installation program normally puts a file named .vimrc in your home directory. On Windows, the file will be named _vimrc, and will be in the directory where Vim was installed. For example, when I installed version 6.1, it was placed in D:\Utils\Vim\vim61, and the _vimrc file was put in D:\Utils\Vim. Also, the Windows environment variable, VIM, was set to D:\Utils\Vim.

The standard .vimrc file supplied with the Vim distribution is not quite correct for use in this course. You need to set the tab width to something small, you must set the option to replace tabs with spaces, and you need to tell vim to wrap lines longer than 72 characters.

I also have some keyboard shortcuts that I like to use, mostly so I can enter certain commands while I am in insert mode. Here are links to two .vimrc files, one for Windows and one for Unix that you may use as a model for your own. Feel free to modify them as you wish, but be sure not to change the expandtab and tw options!

Other example .vimrc files:

http://tabo.aurealsys.com/code/vimrc.html

Excellent page for explanation of some .vimrc options

http://www.stripey.com/vim/

Turn that irritating beep off: set visualbell


Debian – Disabling system beep

Sunday, January 9th, 2005

Just installed Debian woody on a P133/16Mb/4gb (actual memory 14Mb, -2Mb for display I guess).



Disable the beep sound of the pc speaker.

Add the following line to ~/.inputrc:

set bell-style none



If the file does not exist, create it.

If the above does not work, add this to the file:

set show-all-if-ambiguous on

Also, I did see here that the inputrc file can be put in /etc. No idea if that works or is relevant.

Will give it a try sometime.