Vim shell command messages output printed outside vim editor - shell

Normally, whenever I enter shell command like !ls or rm file in vim, the message along with confirmation prompt will be printed below vim status line. My issue is, when I'm doing shell command, the message is printed out outside vim editor (like it was minimized) and then bring me back to the editor after I press enter button to confirm. What is causing this to happen?
UPDATE
This is what I mean:

Related

Starting st from a vim keybind failes

I am using vim as an editor for LaTeX and I use bib-files for my citations.
I want to write a function with which vim opens the currently used bib-file in a terminal which itself runs vim on the .bib-file and lets me edit it.
In the bash script I am using the line
st -t bibfile_edit_terminal_floating -e nvim $BIBFILE_PATH &
where $BIBFILE_PATH is the path of the file (which is correct and works).
When I run the line from a terminal, it opens a st as a separate process and in st opens the file in vim as I want it.
If I call the same line from vim / nvim as a command in a script, the command opens a terminal for a split second and then closes again.
I don't know what is going on.
If I use the line
st -t bibfile_edit_terminal_floating -e nvim $BIBFILE_PATH (without the ampersand at the ending), the file opens in a terminal like I want it but I cannot edit my original document as it waits for the process to finish, which is not what I want.
Please help!

disable console pop-up for shell script

When I run a shell script in pycharm/powershell or command window, eg: ./abc.sh, then a popup window is open and then shows the status of the execution and closes before I could read it. Making it pointless. A better option would be to show the status right below when I input the command. Or redirect it to a text file. How to achieve it?
Run run the command in git bash and it stays in the window itself.

Print terminal command output directly into vim - macOS

Whenever I enter a terminal command in vim (e.g., !echo hello), I am momentarily kicked out to view the result of that terminal command and then prompted with Press ENTER or type command to continue. This is a bit jarring. I would like to stay within vim and with the command output printed out at the bottom.
I know vim :read will take the terminal output and actually put it into my buffer, but that is not what I am looking to do. Here is some reading if you are interested in a tangent.
It looks like when I run vim in Screen I get what I am looking for, but I am trying to get this to work with tmux and the stock Mac terminal.
After a ton of research, probably too much, I got it! It looks like vim will send commands to the terminal, which in turn defines the behavior of how the terminal commands are processed from vim. Put this into your .vimrc file:
set t_ti= t_te= " show results from terminal commands within vim!
From what I understand, this just makes sure to send nothing to the terminal, which yields my desired results!
Side note: the above addition to your .vimrc file will also prevent the vim buffer from clearing when exiting vim (e.g., :wq). I am okay with this! It is kind of nice sometimes to see what you were just working on :).

Execute a bash command in the text of a vim buffer

I know that I can get into bash while in vim via:
Ctrlz
or
:sh
or
:shell
etc.
Then use bash commands as normal, and get back out using fg.
What I am wondering is, can I execute a line of code from a script in vim straight to Bash, without having to exit vim, or having to copy it (via highlighting in visual mode for example) from vim, then going to a terminal and pasting it and hitting enter etc.?
Easiest way is to put the cursor on the line and type:
!!shreturn
This will replace the line with the output of the script. If you don't want that, simply follow up with u.
Arguably easiest way:
Yank the text you want to execute.
Open the cmdline (by pressing :)
type ! and then press ctrl-r and ", which will paste the content of the unnamed register to the cmdline (which will contain the text you wanted to execute)
press Enter

Geany "LIBDBUSMENU-GTK-CRITICAL **: watch_submenu: assertion `GTK_IS_MENU_SHELL(menu)' failed"

I'm doing this Ruby on Rails tutorial, and everytime I input
:~/rails_projects/first_app$ geany .gitignore
I get this
(geany:12043): LIBDBUSMENU-GTK-CRITICAL **: watch_submenu: assertioN
`GTK_IS_MENU_SHELL(menu)' failed
#ubuntu:~/rails_projects/first_app$ geany .gitignore
(geany:12369): LIBDBUSMENU-GTK-CRITICAL **: watch_submenu: assertion
`GTK_IS_MENU_SHELL(menu)' failed
The text editor still opens, but the terminal doesn't let me input anything unless I close the text editor, unlike the tutorial where he has it open, and the terminal still works.How can I get the functioning terminal with the text editor?
I have the same question.
Any ideas on how to correct it??
The way I found to continue to use the command line and still have the geany opened is:
$ geany file &
$ <ctrl+c>
It's useful, but not perfect.
A solution would be good
Cut and paste the following bash function definition into your bash profile ~/.bash_profile to use this from a login bash terminal (or into ~/.bashrc to use this from a non-login terminal). This function will be available only in terminals started after this change is made.
geany() {
$(which geany) --no-msgwin --no-session "$#" &>/dev/null & disown
}
Now typing geany followed by zero or more filenames will have the desired effect.
Explanation:
$(which geany) finds the path to geany by searching your PATH, and substitutes that path in place of the text $(which geany).
The options --no-msgwin and --no-session are optional, but respectively start geany without its message window at the bottom and without remembering to open files that were open the last time geany was closed.
"$#" is the bash way to substitute into this command the rest of your command line (i.e. all the filenames you type after you type geany to use this function).
&>/dev/null redirects geany's standard output and standard error output to /dev/null which stops any messages from geany being displayed in the console.
& disown runs geany as a separate process that is not a child process of the terminal that starts geany. So it is immediately not a job associated with the terminal, and no termination message will appear in the terminal when you quit geany.

Resources