Questions tagged [shell]

Question about the functionality that let Vim interact with shell command typically triggered Cia the :! command.

Vim can trigger shell command via the :! function. The tags marks question related to thus functionality.

95 questions
13
votes
3 answers

Why does !cd not change the directory

I'm going through vimtutor and just learned about using :! to execute a shell command from within vim. I read a bit up on why not to use just : and apparently it's because some character sequences like ls are used by vim itself. Alright,…
user9007131
  • 141
  • 1
  • 7
4
votes
1 answer

No color in Vim while using Google Cloud Shell

I am using the Google Cloud Shell and wanted to install a theme for Vim. Adding the following to my .vimrc (using vim-plug as a plugin manager): Plug 'mhartington/oceanic-next' syntax enable if (has("termguicolors")) set…
user20129
3
votes
1 answer

Add comment to file while opening (C)

I have output from static analyzer, that I parsed with Bash. Now I want Vim to run on specified by analyzer line and add comment containing warning id and description. I tried this, vim $file +$line+'normal A'+'/* KW: $kwid desc: $desc */' Where…
user23336
  • 31
  • 1
2
votes
2 answers

How to turn this piped bash command into a vim map?

I have a bash command that will align text into a tabular form. If I have input such as this: A | B | C Alpha | Beta | Gamma 12 | 34.56 | 78.9 I can run cat test.txt | sed -e 's/|/'$'\001''|/g' | column -t -s $'\001' to get: A | B |…
Roxy
  • 177
  • 3
2
votes
1 answer

How to chain shell command with vim Ex command?

I'm trying to do the following: autocmd BufWritePost *.py :!isort % | :edit The isort command in this case is writing to the buffer and so I'd like to reload the buffer to see the changes to the file I'm currently viewing. But i find that because…
Integralist
  • 131
  • 4
1
vote
3 answers

How can I open a file, edit it and save its output to a shell variable?

I know that I can open a file through a pipe with vim with the following command: cat myfile.txt | vim - I also know that I can edit files on vim directly from the command line as the following: vim -e myfile.txt -c ':%s/^/newstring-/g | x' The…
raylight
  • 535
  • 1
  • 4
  • 12
1
vote
1 answer

vim/gvim freezes when shelling out, how to trace events?

NOTE: This underlying problem was solved by an update of Cygwin packages and re-install of vim. However, the question of how to trace errors in shelling out remains, so answers along that front would be appreciated. I use Cygwin's 64-bit…
user2153235
  • 905
  • 5
  • 14
0
votes
0 answers

Shell commands in Vim vs. Neovim?

When I run a shell command in Neovim like :!ls the results come up in a little minibuffer. In Vim, the Vim instance is temporarily closed and the results are printed to the terminal without my terminal syntax highlighting (oh my zsh). Is there a way…
Vinn
  • 761
  • 1
  • 6
  • 17
0
votes
2 answers

how to run a shell command in the same shell process that vim was started

I want to source a file in the same shell process vim was started, from within vim as an ex command. As far as I know, vim creates a new subshell and run commands. In addition to that, If I source a file, and then start vim, vim does not detect the…
Ali
  • 151
  • 6
0
votes
1 answer

How show underlying container for vim, ie xterm etc

When I run :maps that use ! to execute linux commands, the vim display is suspended to show the command output in the underlying container (xterm in my case). When the mapping terminates, any shell messages it may have produced are immediately…
user985675
  • 141
  • 3
0
votes
0 answers

aliased commands don't work with the shell ex command?

I have a number of aliased commands in my .bashrc and they work fine on the command line. However, if I use them in Vim, they do not work. For example: :!mycommand results in: /binbash: mycommand: command not found What is the explanation?
Tyler Durden
  • 2,091
  • 2
  • 23
  • 42