1

Is there a setting I could add to my vimrc file that would hide the last entered colon-command that stays visible on the bottom of the screen after I hit enter?

For example, if I type ":3" to go to line 3 of the current file, then the ":3" stays visible on the bottom of the screen even after I hit enter. I already have my manager on my back. Now, I have a little guy with a mustache at the bottom of my screen staring at me while I'm trying to get my work done. (I know there are other ways to go to line 3—for example, by entering "3G"—that keep the command-line clear, but you get the point.)

I think I'd like to hide the last entered command because I like to keep things clean. I'm not very experienced with Vim, however, so if keeping the last command visible is actually more useful than I realize, please do enlighten me.

Also, what about for searches? Maybe if I enter "/hello" (to search for all occurrences of "hello"), for example, then I could type "Esc" (or something) to clear "/hello" from the command-line when I'm done searching. How could I make something like that possible? Or, is there already a setting or plugin that does this?

3

You can press <C-l> to force a redraw, which will clear this line, among some other things.

If you want, you can use the CmdlineLeave autocommand to echo an empty string upon leaving the commandline:

augroup cmdline
    augroup!
    autocmd CmdlineLeave : echo ''

augroup end

There isn't a setcmdline(), so as far as I know this is the best way.

This won't work for search, as searching for text will always set the commandline window (e.g. n will set it). I don't know of any way to automatically clear that outside of pressing <C-l> or remapping all search keys:

nnoremap n n:echo ''<CR>
" same for N, *, etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.