LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Stop man and vim from forking new window (https://www.linuxquestions.org/questions/linux-newbie-8/stop-man-and-vim-from-forking-new-window-4175619975/)

Warluck 12-20-2017 09:47 AM

Stop man and vim from forking new window
 
Bonjour,
In linux, how do you prevent vim and man from forking new window on top of the shell?

When I exit man, the pages are gone from the terminal, I don't want that.

When I run vim, I can not scroll the window as I scroll "out of vim", I don't want that.

How can I fix both man and vim so they are kept in the current shell, so man printout remains on the shell screen?

thanks for your help on this very basic question :P)

rtmistler 12-20-2017 09:51 AM

I think you'd have to go as far as to download the source for those programs, modify their behavior and recompile. There are no settings that I'm aware of to avoid this behavior.

Warluck 12-20-2017 09:53 AM

Well, let me explain something else. I was using, up until now, SSH Secure shell software and there everything behave as I want to. When I exit man, man stays in the same screen.

I am now using mobaXterm and I'm having the problem with man and vi that I didn't have with the other tool.

Might be a configuration there but couldn't find anything!

Habitual 12-20-2017 09:55 AM

I utilize this is my ~/bashrc

Code:

export PAGER=""
Keeps man pages on screen (locally)

rtmistler 12-20-2017 10:07 AM

I fully understand the behaviors you described in your first post.

VIM and MAN do behave exactly like that. Once you exit, the screen, and buffer, are cleared.

I feel this beneficial behavior you have been seeing is due to how the ssh was working for you. Unsure if terminal settings played any factor in that or if it was the specific SSH implementation. You may have become accustomed to a happenstance. Not a bad thing, but I do not see any guarantee of a solution except something along the lines of my earlier code suggestion. Or perhaps to continue to use ssh over this new terminal program.

Warluck 12-20-2017 10:09 AM

Thanks, I have set export PAGER="more" so fix the man pages. Now, when I exit man, man page remains on the screen.

I need to do the same with vim as it still behave as before which means, it's gone when I quit vim.

fatmac 12-20-2017 10:12 AM

Use a multiplexer, screen or tmux, both will allow running sessions.

Warluck 12-20-2017 10:17 AM

I do not know if there are better ways to fix this but here how I did to fix everything at once :

export TERM=linux

Problem fix for man and VIM

Thanks guys.

P.S. the PAGER thing lead me to form my google search differently which lead to the fix.

Sometimes, the answer you search depends on how you ask the question 8¬)

MadeInGermany 12-20-2017 02:43 PM

The traditional method (full screen terminal) is to pause vi/vim with Ctrl-Z. This should restore the shell screen and give control back to the shell. If desired continue with vi/vim with the fg command.

If you have a graphical desktop, start vim in a new graphical terminal window
Code:

xterm -e vim &
Or get used to the graphical
Code:

gvim &

Warluck 12-20-2017 04:15 PM

Bah .... it's not quite like it, with TERM=linux you trade xterm for a console with less functionnality.

In xterm, you can set these two options in the .vimrc
cat .vimrc
set t_ti=
set t_te=
As per doc,
t_te out of "termcap" mode
t_ti put terminal in "termcap" mode

http://vimdoc.sourceforge.net/htmldoc/term.html

Need a way to keep the current nice man PAGE with the termcap off.

From what I read, you need to mess with terminfo to completely get rid of the alternate screen.

rnturn 12-24-2017 10:18 AM

Quote:

Originally Posted by Habitual (Post 5795540)
I utilize this is my ~/bashrc

Code:

export PAGER=""
Keeps man pages on screen (locally)

You can also set the PAGER variable to "more".

Or, if "less" is more useful to you (it's generally the default pager nowadays) and you don't want to disable use of a pager, set up an alias for man:
Code:

alias man='PAGER=more man'
and add that to your .bashrc (or whatever). I keep all those aliases in a separate file that I source in my profile at login. (If you make a change to or add an alias, just re-source the file rather than logout/login.)

Hope this helps.

Later...

scasey 12-24-2017 02:23 PM

In /etc/man_db.conf change
Code:

less -is
to
Code:

less -isX
The -X
Quote:

Disables sending the termcap initialization and deinitialization strings to the terminal. This is sometimes desirable if the deinitialization string does something unnecessary, like clearing the screen.
This is the only change I've had to make to keep the man page on the screen. My ssh connection uses xterm.

I don't use vi/vim, so can't help with that. I'm a nano or ScITe guy.


All times are GMT -5. The time now is 02:12 AM.