Skip to content

Instantly share code, notes, and snippets.

@khanghh
Last active April 10, 2019 07:55
Show Gist options
  • Save khanghh/1e8253f97b91f575153d631033a1810a to your computer and use it in GitHub Desktop.
Save khanghh/1e8253f97b91f575153d631033a1810a to your computer and use it in GitHub Desktop.
hide comment line vim
set lines+=1
let s:is_cmdline_open = 0
function! s:cmdline(key)
if a:key ==# ':'
if !s:is_cmdline_open
let &lines-=1
let s:is_cmdline_open = 1
redraw
endif
else
if s:is_cmdline_open
let &lines+=1
let s:is_cmdline_open = 0
endif
endif
return a:key
endfunction
nnoremap <expr> : <sid>cmdline(':')
cnoremap <expr><silent> <cr> <sid>cmdline("\<cr>")
cnoremap <expr><silent> <esc> <sid>cmdline("\<C-c>")
cnoremap <expr><silent> <C-c> <sid>cmdline("\<C-c>")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment