Last active
April 10, 2019 07:55
-
-
Save khanghh/1e8253f97b91f575153d631033a1810a to your computer and use it in GitHub Desktop.
hide comment line vim
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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