I used to use this setting in .vimrc:
inoremap \( ( inoremap ( ()<LEFT>
But escape bracket every time for
second\(first();
is a little bit stressful. (typed “first()”, then move to the head of the line, typing “second”, back slash and bracket)
Here is an improved script:
function! CompleteDetachedBracket() let line = line('.') let col = col('.') let c = getline(".")[col(".")] execute "normal \<RIGHT>%" if c == "$" execute "normal 2wi)" elseif line != line('.') || col != col('.') execute "normal a)" else execute "normal a)" startinsert endif endfunction inoremap ( (<ESC>:call CompleteDetachedBracket()<CR>
This is the first time to code vim script for me. I was guessing vim script is a weird language, so have avoided long time. But at least coding small one is not so difficult than I thought. Documentation is very organized. There are many sample codes in your .vim/plugin directory. Not like a GUI programming, but still like a Tetris. It maybe just because of the first time, I think it’s pretty fun.


Get error message “G is null” or “a is null” on jQuery
Will get an error message “a is null”. When using jquery.min.js, it might be hard to recognize what kind of error it is. On version 1.3.2 the message says “G is null”.