Skip to content

Instantly share code, notes, and snippets.

@rhysd
Last active November 11, 2016 18:39
Show Gist options
  • Save rhysd/11d126984ead5eab99d50467e42f953d to your computer and use it in GitHub Desktop.
Save rhysd/11d126984ead5eab99d50467e42f953d to your computer and use it in GitHub Desktop.
行指定ジャンプするついでにちょっと行番号も見れるやつ
@@ -441,7 +443,15 @@ noremap gm m
"Esc->Escで検索結果とエラーハイライトをクリア
nnoremap <silent><Esc><Esc> :<C-u>nohlsearch<CR>
"{数値}<Tab>でその行へ移動.それ以外だと通常の<Tab>の動きに
-noremap <expr><Tab> v:count != 0 ? "G" : "\<Tab>zvzz"
+function! s:go_to_line(lnum) abort
+ set number
+ augroup vimrc-go-to-line
+ autocmd!
+ autocmd InsertEnter,CursorHold * set nonumber | autocmd! vimrc-go-to-line
+ augroup END
+ return 'G'
+endfunction
+noremap <expr><Tab> v:count != 0 ? <SID>go_to_line(v:count) : "\<Tab>zvzz"
" コマンドラインウィンドウ
" 検索後画面の中心に。
nnoremap n nzvzz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment