Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set cmdheight=0 #1004

Closed
trusktr opened this issue Jul 29, 2014 · 27 comments · Fixed by #16251
Closed

set cmdheight=0 #1004

trusktr opened this issue Jul 29, 2014 · 27 comments · Fixed by #16251
Labels
enhancement feature request
Milestone

Comments

@trusktr
Copy link

trusktr commented Jul 29, 2014

Being able to hide the command line and gain an extra line would be nice.

This one is tricky. What do we do when there's output and the height is 0? One thing we could do is just not show any output, except for output that requires interaction (a choice, or tab completion). Another thing we could do is show output like normal and treat it like a multiline output that tells you to press enter to continue, after which the cmdline goes back to it's original height (0). A third thing we could do is give the user a new flag for the shortmess option to turn off all non-interactive messages. The flag could be N for "No output and all other flags are ignored".

When : is typed the cmdline changes to a height of 1. After the command is executed, the cmdline disappears.

A new feature could be to make the status line more customizable so that a portion of the status line could be designated for commands. Commands could appear in the middle of the status line for example, and after executing the command the output appears in the same spot, truncated on the right side with a configurable symbol like ... or >.

@justinmk justinmk added this to the vNext milestone Jul 29, 2014
@justinmk justinmk added the idea label Jul 29, 2014
@nfultz
Copy link

nfultz commented Aug 2, 2014

You can comment out the lines that check if command height is <1, and it mostly works, although it occasionally segfaults or corrupts the display (hit ^L to redraw). The command line still pops up in the bottom line, disappears after you're done.

diff --git a/src/option.c b/src/option.c
index d52117e..5869812 100644
--- a/src/option.c
+++ b/src/option.c
@@ -5681,10 +5681,10 @@ set_num_option (
   }
   /* if p_ch changed value, change the command line height */
   else if (pp == &p_ch) {
-    if (p_ch < 1) {
-      errmsg = e_positive;
-      p_ch = 1;
-    }
+//    if (p_ch < 1) {
+//      errmsg = e_positive;
+//      p_ch = 1;
+//    }
     if (p_ch > Rows - min_rows() + 1)
       p_ch = Rows - min_rows() + 1;

@splinterofchaos
Copy link

@nfultz I can't reproduce a segfualt--that change actually seems to work for me. What do you do to make it happen?

@nfultz
Copy link

nfultz commented Aug 4, 2014

Actually with scrolloff=10 and laststatus=2, it works perfectly for me.

@trusktr
Copy link
Author

trusktr commented Aug 4, 2014

@nfultz scrolloff and laststatus set to what?

@Grimy
Copy link
Contributor

Grimy commented Sep 1, 2014

I second this. I looked in vain for a way to achieve this result in vanilla Vim.

@tonio
Copy link

tonio commented Jan 5, 2015

A new feature could be to make the status line more customizable so that a portion of the status line could be designated for commands

👍 it’s been a long time I want to do this… that would be a great feature!

@alexispurslane
Copy link

This looks great! I want be able to do this in neovim!!

@llpamies
Copy link

I think this feature is useful for developing GUIs. In this context it would be nice to disable command line, and have some extra notification system in the API to receive the output that is usually sent to the command line. Does it make sense?

@justinmk
Copy link
Member

justinmk commented Feb 7, 2017

This actually gets pretty close (suggested by @tweekmonster):

:set lines+=1

@tweekmonster
Copy link
Contributor

For posterity, here's an attempt to minimize weirdness:

let &lines += 1

function! s:cmdline(key) abort
  let &lines += 1 * (a:key ==# ':' ? -1 : 1)
  redraw
  return a:key
endfunction

nnoremap <expr><silent> : <sid>cmdline(':')
cnoremap <expr><silent> <cr> <sid>cmdline("\<cr>")
cnoremap <expr><silent> <esc> <sid>cmdline("\<esc>")

It'll cause the screen to flicker and messages will still overwrite the the last line. Maybe this'll be good enough if there's a PR to skip printing single line messages if there isn't enough room.

@sassanh
Copy link

sassanh commented May 12, 2017

I was struggling to simulate cmdheight=0 that I found this issue (thanks to @jamessan )
I tried let &lines=&lines+1 but flicker is really annoying. I tried to play with lazyredraw but it's unusable in vimscripts: #6729
I guess if making neovim accept 0 for cmdheight doesn't make tests fail, it's safe to have it.

@sassanh
Copy link

sassanh commented May 12, 2017

Compiled it with the patch @nfultz suggested and it's working very nice.

@dsummersl
Copy link
Contributor

Just tried out the patch myself - it does work! But...there are issues:

  • there is an extra space unpainted on my status line on the far right.
  • command line completion isn't painted (seems to do something, you just can't see what).
  • There is flickering in the lower right when you type partial commands like ciw qq etc

@sassanh
Copy link

sassanh commented May 13, 2017

A bold usecase for cmdheight=0 is to remove cmdline in some plugins interactive window (like fzf, ctrlp, gundo, etc) the above patch works perfectly for this usecase as use is not supposed to use cmdline in those windows and it just provides them more space (actually it just avoids wasting space as cmdline is absolutely useless in those windows.)
CtrlP achieves this with some magic, it has a Render method that renders its prompt in cmdline regularly so that even it doesn't really hide cmdline it has the impression that it does.
The above obviously doesn't work for users who want to "autohide" their cmdline while editing normal files.

@ilAYAli
Copy link
Contributor

ilAYAli commented May 18, 2017

I looked at something similar a while ago: #4382
image

@justinmk justinmk changed the title Feature: set cmdheight=0 set cmdheight=0 Apr 15, 2019
@twome
Copy link

twome commented Jul 26, 2019

This should really be the default functionality for users new to Vim entirely - it's simply better UI design. There's absolutely no good reason the command line (and temporary/modal messages, such as from <C-g>) should be taking up space when inactive or dismissed.

@no-more-secrets
Copy link

Would be nice to see a proper solution to this.

@kutsan
Copy link
Sponsor

kutsan commented May 31, 2020

I know it's a small feature but it'd be game changer for me.

@sassanh
Copy link

sassanh commented Jun 1, 2020

After the introduction of floating windows I don't need this feature anymore, but before that I was simply compiling a patched version of Neovim and it was working very nicely, to do so all you have to do is open /src/option.c and find the line that is checking cmd_line is greater than 1 and change it to 0. That file has changed a lot of time so the patch provided above doesn't work anymore but you can find the line usually by searching for p_ch in the file.

@no-more-secrets
Copy link

@sassanh Patching no longer works even when patching the equivalent code in the new file... it causes segfaults.

@kutsan
Copy link
Sponsor

kutsan commented Jun 1, 2020

@sassanh How's this related to floating windows? It's just better UI generally.

@sassanh
Copy link

sassanh commented Jun 2, 2020

@kutsan My usecase was to open fzf on the bottom of screen and I didn't want to have codlin below the fzf input line, after floating windows are introduced now I open fzf as a floating window. But I agree that it is generally better UI.

@BrunoGomesCoelho
Copy link

+1 That this would be a great feature to have, currently using the code provided by tweekmonster but it flashes/is buggy sometimes.

@lucastrvsn
Copy link

Would be nice to have this possibility. I want to create a statusline that provides a "omni-line" functionality that transforms itself into a cmdline when needed. Today it's not possible and should be possible to do it.

@AndreiSva
Copy link

i agree with @lucastrvsn, that would be a game changer. Imagine something like airline that integrates with the command line.

@elkowar
Copy link

elkowar commented May 14, 2021

I would love to have that!

@mhinz
Copy link
Member

mhinz commented May 14, 2021

This is not on our list, but we welcome contributions.

@neovim neovim locked and limited conversation to collaborators May 14, 2021
justinmk pushed a commit that referenced this issue Jun 13, 2022
Fix #1004

Limitation: All outputs need hit-enter prompt.

Related:
#6732
#4382
@justinmk justinmk modified the milestones: backlog, 0.8 Jun 13, 2022
kraftwerk28 pushed a commit to kraftwerk28/neovim that referenced this issue Jul 6, 2022
Fix neovim#1004

Limitation: All outputs need hit-enter prompt.

Related:
neovim#6732
neovim#4382
@zeertzjq zeertzjq modified the milestones: 0.9, 0.8 Aug 18, 2022
smjonas pushed a commit to smjonas/neovim that referenced this issue Dec 31, 2022
Fix neovim#1004

Limitation: All outputs need hit-enter prompt.

Related:
neovim#6732
neovim#4382
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement feature request
Projects
None yet
Development

Successfully merging a pull request may close this issue.