vim question

トップ ページ
添付ファイル:
Eメールのメッセージ
+ (text/plain)
このメッセージを削除
このメッセージに返信
著者: Kurt Granroth
日付:  
題目: vim question
On Sunday 21 September 2003 07:54 pm, Bart Garst wrote:
> On Sun, 2003-09-21 at 19:26, Ravi Parimi wrote:
> > in your .vimrc and type pr followed by a space, the corresponding word is
> > printed. CTRL+n also achieves something similar. Check out
> > http://www.vim.org/tips/tip.php?tip_id=4
>
> Ctrl+n is exactly what I was looking for. The 'abbrv' thing is going to
> be helpful too.


You can wrap the Ctrl+N with a function to make it easier to use (having to
deal with two keys at the same time is so anti-vi in my mind). I have it
setup on my system so that when I hit TAB (and I'm not at the beginning of a
line), it will automatically start cycling through completions. You can't
imagine how much time it saves!

Here's the function as I found it *somewhere* on the net:
function! CleverTab()
  if strpart( getline('.'), 0, col('.')-1 ) =~ '^\s*$'
    return "\<Tab>"
  else
    return "\<C-N>"
endfunction
inoremap <Tab> <C-R>=CleverTab()<CR>