Thursday, November 13, 2008

Vim - my config on CentOS

set vim as a default editor
echo "export EDITOR=/usr/bin/vim" >> /etc/profile
disable flow control in a terminal (unblock ctrl+s, ctrl+q for use in vim)
echo "stty -ixoff -ixon" >> ~/.bashrc

echo '
set mouse=a
set number
set ts=2
set shiftwidth=2
set expandtab
set softtabstop=2
set smartindent
map <c-q> :mksession! ~/.vim/.session <cr>
map <c-s> :source ~/.vim/.session <cr>
nmap <F2> :update <cr>
imap <F2> <C-O>:update <cr>
' >> /etc/vimrc

Without the key mappings above, vim would be too painful for me to use for programming.
Ctrl+q ... save vim's state e.g. what files are opened, cursor position, ...
Ctrl+s ... restore saved state
F2 ... save current file - works in insert mode too

X11 clipboard
yum install vim-X11
echo "alias vim='/usr/bin/vimx'" >> ~/.bashrc
. ~/.bashrc

rails support

Before running, check for latest version and replace 9499 below.
mkdir ~/.vim
cd ~/.vim

enable rails docs
:helptags ~/.vim/doc
then run
:help rails

haml+sass syntax highlighting
Again, check for latest versions and modify 8461 and 7447 below.
mkdir ~/.vim/syntax
cd ~/.vim/syntax
echo '
au! BufRead,BufNewFile *.haml setfiletype haml
au! BufRead,BufNewFile *.sass setfiletype sass
' >> ~/.vim/filetype.vim

problem with haml.vim - carriage returns errors
vim ~/.vim/syntax/haml.vim
and save with
:w ++ff=unix

Swap Escape and Caps Lock keys (to love vim more)
echo '
remove Lock = Caps_Lock
keysym Escape = Caps_Lock
keysym Caps_Lock = Escape
add Lock = Caps_Lock
'> ~/.Xmodmap

File ~/.Xmodmap is processed by /etc/X11/xinit/xinitrc-common when X starts.
To take effect immediately, do
'xmodmap ~/.Xmodmap'

Same on Windoze
save the next 3 lines in a file, e.g. swapEscCL.reg and execute
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,03,00,00,00,01,00,3a,00,3a,00,01,00,00,00,00,00

:%s/^/ / ... indent all lines
:.,.+3s/^/ / ... indent 4 lines from cusor down
<c-v>2><esc> ... indent 2x on a selected range

vim as development environment

to do
fix problem with javascript highlighting
now have to do
perhaps filetype is not correctly set for js


Anonymous said...

Today Matchpoint | Casino Review | Up to 100% Bonus
In our 샌즈카지노 Casino 메리트카지노 Review, we will review matchpoint's casino and review the bonuses and payment methods. matchpoint It's free casino games, no deposits

Unknown said...

Oshi Casino: A Member of The Casino Rewards Club
oshi casino. air jordan 18 retro yellow shipping Oshi 토토캔 casino. Member of the casino rewards club at 777 꽁머니 토토 Casino air jordan 18 retro yellow suede great site St. John, 동행복권 먹튀 LA 70113 USA.