LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-20-2017, 10:47 AM   #1
Warluck
LQ Newbie
 
Registered: Dec 2017
Posts: 9

Rep: Reputation: Disabled
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)
 
Old 12-20-2017, 10:51 AM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: MA, USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 7,214
Blog Entries: 12

Rep: Reputation: 2656Reputation: 2656Reputation: 2656Reputation: 2656Reputation: 2656Reputation: 2656Reputation: 2656Reputation: 2656Reputation: 2656Reputation: 2656Reputation: 2656
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.
 
Old 12-20-2017, 10:53 AM   #3
Warluck
LQ Newbie
 
Registered: Dec 2017
Posts: 9

Original Poster
Rep: Reputation: Disabled
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!
 
Old 12-20-2017, 10:55 AM   #4
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Yawnstown, Ohio
Distribution: Mojave
Posts: 9,340
Blog Entries: 36

Rep: Reputation: Disabled
I utilize this is my ~/bashrc

Code:
export PAGER=""
Keeps man pages on screen (locally)
 
Old 12-20-2017, 11:07 AM   #5
rtmistler
Moderator
 
Registered: Mar 2011
Location: MA, USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 7,214
Blog Entries: 12

Rep: Reputation: 2656Reputation: 2656Reputation: 2656Reputation: 2656Reputation: 2656Reputation: 2656Reputation: 2656Reputation: 2656Reputation: 2656Reputation: 2656Reputation: 2656
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.
 
Old 12-20-2017, 11:09 AM   #6
Warluck
LQ Newbie
 
Registered: Dec 2017
Posts: 9

Original Poster
Rep: Reputation: Disabled
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.
 
Old 12-20-2017, 11:12 AM   #7
fatmac
Senior Member
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Posts: 2,671

Rep: Reputation: Disabled
Use a multiplexer, screen or tmux, both will allow running sessions.
 
Old 12-20-2017, 11:17 AM   #8
Warluck
LQ Newbie
 
Registered: Dec 2017
Posts: 9

Original Poster
Rep: Reputation: Disabled
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)
 
Old 12-20-2017, 03:43 PM   #9
MadeInGermany
Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 929

Rep: Reputation: 403Reputation: 403Reputation: 403Reputation: 403Reputation: 403
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 &
 
Old 12-20-2017, 05:15 PM   #10
Warluck
LQ Newbie
 
Registered: Dec 2017
Posts: 9

Original Poster
Rep: Reputation: Disabled
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.
 
Old 12-24-2017, 11:18 AM   #11
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (Chicago area)
Distribution: CentOS, MacOS, [Open]SuSE, Raspian, Red Hat, Slackware, Solaris, Tru64
Posts: 1,241

Rep: Reputation: 80
Quote:
Originally Posted by Habitual View Post
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...
 
Old 12-24-2017, 03:23 PM   #12
scasey
Senior Member
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.5
Posts: 1,985

Rep: Reputation: 624Reputation: 624Reputation: 624Reputation: 624Reputation: 624Reputation: 624
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] slackware - ls, vim, even man always hiden sth and how to handle this? vencent Slackware 13 06-22-2017 09:10 AM
[SOLVED] vim on 14.2 issue with man files + workaround jmccue Slackware 5 12-24-2016 10:31 AM
[SOLVED] Fedora shows 'man vim' but when execute 'vim' got "bash: vim: command not found..." ? flash_os Linux - Newbie 19 01-04-2015 12:56 AM
Man pages with vim keybindings, and touch pad scrolling j.todd Linux - Desktop 1 10-20-2008 07:41 AM
php causes kernel to stop forking bfreeburg Linux - General 1 12-21-2006 11:49 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:35 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration