Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [bash]

BASH is the GNU Bourne Again SHell, the successor to the classic Unix Bourne sh (shell). It's the default shell for various Linux/GNU systems.

3
votes
1answer
20 views

Invalid syntax for a bash file called catalog

I have a file written in bash (with the she-bang) and called "catalog", and the syntax highlighting is incorrect. If I rename the file, the colors become correct. I have not configured anything in ...
1
vote
2answers
54 views

Run processes in shell while editing in Vim

I am a new Vim user. I can do : :! <some command> in Vim to run a bash command in Linux. After that bash command is executed, I can press Enter to go back to Vim. What happens if the bash ...
0
votes
2answers
39 views

Shell running inside vim windows

Is there a way that a open up a window or buffer, where i can run my bash commands? I thought on something like you know it from VS Code(1). The code windows on the top and a small command prompt on ...
1
vote
1answer
30 views

Change Vim command :terminal so instead of CMD there will open Bash terminal [duplicate]

I am used working on Vim on Linux, where I use tmux + vim to switch between terminal and vim edit quickly. Now I am trying to setup the same on windows 10. I try to use gVim on Windows 10, but I like ...
1
vote
1answer
153 views

Execute Vim commands from shell

How to execute Vim commands from shell? For ex I want to see man pages of grep command in vim typing command from shell(bash,zsh) command something like: vim ':Man grep' Is it possible?
1
vote
1answer
29 views

Why do I get “incompatible error” while opening .sh files using vi in cygwin?

I am very much annoyed by this error: $ vi abc.sh Error detected while processing /home/DELL/.virc: line 1: E518: Unknown option: incompatible Press ENTER or type command to continue /bin/bash: ...
3
votes
0answers
87 views

Why are Vim 8 :term colours with gvim different from those in plain vim :term or bash?

Vim 8 :term colours in gvim happen to be different from those seen in plain vim :term or bash. How come? How does one obtain the same bash colours in gvim? EDIT: I have been reading a bit more about ...
1
vote
2answers
263 views

Error when opening shell scripts

I began to get the error Error detected while processing BufRead Auto commands for "*.sh": E117: Unknown function: dist#ft#SetFileTypeSH when I opened shell scripts (*.sh) I think it happened after ...
1
vote
1answer
83 views

Extended ASCII characters changed upon opening Vim in different shell

Specifically, I have encountered this issue with the lowercase a with an umlaut ä and the lowercase scharfes s ß. Their (extended) ASCII values are 0xDF and 0xE4, respectively: This can be seen, in ...
3
votes
2answers
885 views

How to run the history search in Vi mode in bash

I want to find the alternative to ctrl+R to search history in bash. I can enable vi mode in bash but I cannot make it search. When I do /search or ?search nothing happens. Is there something more I ...
3
votes
2answers
81 views

Use current filename register in bash command ran from VIM

I'm making a command that runs tests and opens coverage report for the currently opened file. nnoremap cov :!vendor/phpunit/phpunit/phpunit --coverage-html \ /tmp/coverage/ test/ && google-...
2
votes
0answers
55 views

Bash process substitution on vim command line?

I want to be able to show someone a particular file's undo history in vim, remotely. It's a little complicated, so let me explain one step at a time. For starters, I can set a custom undofile and ...
5
votes
2answers
119 views

MacVim - doesnt find programs in PATH when running commands using “!”

When I'm using vim in a terminal, it uses the PATH I have set, and I can run programs and scripts located in my ~/bin folder using ! For example :! some_bash_script.sh When I try this in MacVim, it ...
0
votes
2answers
63 views

Why all lines dispear after executing the lines on edited file?

vim command.txt key="123456" openssl enc -des3 -a -salt -in /tmp/test -k ${key} -out /tmp/test.asc In vim's command mode :1,2!bash,the file /tmp/test was encrypted into /tmp/test.asc ,but all the ...
1
vote
1answer
142 views

How to customize the color of an HTML output file generated from Git Bash?

I have used the following command in Git Bash to perform a 'vimdiff' for 2 XML files. vimdiff xml1.xml xml2.xml -c TOhtml -c 'w! result.html' -c 'qa!' The HTML file which is getting generated is ...
1
vote
0answers
64 views

Vim: error opening files <SNR>62_InitializePythonBuiltin the Python's site module could not be loaded [duplicate]

I have set up vim on a new machine according to Vimlander-2-The-Quickening, but I keep running into the following errors when I open a file in command mode: :e /path/to/file, :vs /path/to/file, or :sp ...
1
vote
0answers
393 views

VIM: how to send entire line to a buffer of type “Terminal”?

In vim8, you can open a terminal inside vim with term command. This opens a new buffer of type terminal inside vim. Is there any way of sending lines from other buffers to this type of buffer? For ...
3
votes
2answers
202 views

Using vim as manpager: works on Linux, fails on macOS

:h manpager describes how to use vim as a manpager: Works on: - Linux - Mac OS - FreeBSD - Cygwin - Win 10 under Bash Untested: - Amiga OS - BeOS - OS/2 For bash,zsh,ksh or dash ...
1
vote
3answers
6k views

Fully disable mouse in console vim

I saw completely disable mouse in console vim on Stack Overflow. It sounded like exactly what I wanted, but there the problem was related to Cygwin, so the title was a misnomer. I want to know how ...
6
votes
1answer
226 views

How to prevent accidentally piping text to Vim?

I use Vim to edit the output of shell commands all the time. Appending the dash in this line is second nature: $ ./some-command | vim - But every once in a while I get distracted and forget: $ ./...
0
votes
1answer
65 views

Process substitution with read

I want to print stuff to the screen separated by key presses (any key). A reduced version of what I'm trying to do is: $ echo banana && read -rsn1 && echo orange && read -rsn1 ...
2
votes
1answer
631 views

How to set the vim path to your bash PATH?

I'd like my $PATH to be available to vim when running commands with !. How do I set vim's set path= to my environment variable $PATH?
1
vote
1answer
72 views

Why does VIM change the columns variable after Ctrl+z? (Setting the width of text in the VIM editor)

I start up vim using the following command: vim -u NONE -U NONE -c ':set columns=40 nu' Then, I push vim to the foreground... ...and return. For some reason, VIM has changed the columns variable to ...
5
votes
3answers
127 views

vi editing of bash command line: Avoid execution upon exit?

I'm running bash, and my ~/.inputrc contains set editing-mode vi. This allows me to edit my command line using vi-like behaviour. And I can press v in normal mode to enter the full-fledged vi-editor,...
3
votes
0answers
126 views

real time vim keylogger

is there anyway to log vim keypresses (or keypresses in general activated by vim) and record it somewhere (STDOUT, file, etc) in real time? I want somthing similar to vim -w file.log file and this ...
0
votes
0answers
22 views

Invoke vi help from bash without starting Vim [duplicate]

How do I invoke the vi help while I am in bash without starting a vi session?
2
votes
1answer
58 views

Is there any way to switch between Vim and a :! command passed to the shell, before it is finished executing?

This would make my workflow immensely easier -- I have some simple maps for executing python .py files, and sometimes it would be nice to open an interactive session after running them (for example, ...
10
votes
2answers
1k views

How can you use vim as a stream editor? [duplicate]

Like most programmers, I perform a lot of repetitive tasks. In optimising my workflow, I'm taking some of those repetitive tasks, and refactoring them into shell scripts. One thing that I'm trying to ...
4
votes
2answers
157 views

Why do exclamation ! shell commands in GVIM show error: “syntax error near unexpected token (” for “ls() (”?

E.g., it I do: !echo a or any other !, it first prints: syntax error near unexpected token ( ls() ( /* my alias */ ) and then the actual command. The problem only happens in GVIM, not in Vim. ...
3
votes
1answer
45 views

How should I move the cursor when running shell by using :sh?

If I use arrow keys, I will get the text in the above picture.
2
votes
0answers
344 views

How should I fold a shell script in vim? Is there an existing script or function for this?

I'm working on some shell scripts with a lot of: # Parameter: images.0.created_at if [ -z "$images.0.created_at" ] then echo "images.0.created_at is empty" else woostring="$woostring""...
5
votes
1answer
149 views

Why doesn't vim recognize bash self-made functions

Say, I defined a command in my ~/.bash_profile, (MacOS Sierra, Macbook Air, if it's relevant) function sayHello(){ echo Hello world! } and while using vim, intend to call :! sayHello It does ...
16
votes
2answers
7k views

Execute bash script from vim

I use vim for bash scripting. the thing is sometimes I don't want to create a new file, make it executable, execute it and then remove it. I mean the scripts which are going to be used only once. For ...
4
votes
1answer
58 views

multiple shell command execution failed

I want to execute two shell command at the same time in vim. So i use | like below :!ls|!pwd Its Returns the following error E34: No previous command But what happen ls output is forward to ...
2
votes
2answers
214 views

Source a vimrc from a webpage?

I work with lots of different servers and would like to unify my vimrc across them all. I see that vim has the source command, which I'm assuming works similar to bash. In bash, to source a file from ...
4
votes
1answer
286 views

How to comment a line directly from bash using vim?

What I usually do from bash/vim ... is open file with vim go to line to comment comment a line save and quit My file is /usr/local/etc/php/7.0/conf.d/ext-xdebug.ini and the initial content is [...
4
votes
1answer
149 views

How to escape filename containing single and double quotes mix?

Let's say i create a filename with this: xb@dnxb:/tmp/test$ touch '"i'"'"'m noob.mp4"' xb@dnxb:/tmp/test$ ls -1 "i'm noob.mp4" xb@dnxb:/tmp/test$ Then vim . to go inside Netrw directory listing. " ...
5
votes
1answer
428 views

How do I turn off the “feature” where the pound sign “#” is forced to 0 position?

When writing C/C++ code, vim defaults to forcing any pound sign ("#") to the zero position column. This is fine for for C/C++, but it is very annoying for shell scripting and perl scripting, since the ...
4
votes
2answers
2k views

How do I search google from vim?

I would like to be able to search google from within any vim file. A nice command might be :goo while in normal mode. Then I type what I want to search and bam it opens my default browser with the ...
2
votes
2answers
736 views

How to export information from vim to bash

When you execute the shell in vim via the :sh command, the shell that is set in the shell option is executed. However, is it possible to pass some information from the vim instance that you are ...
9
votes
3answers
860 views

How to output result of vim commands to shell

Let's say I'm in the shell (bash) and want to see output that :scriptnames would give, but don't want to start vim or maybe I want to echo that into another file. So I execute vim +scriptnames ...
0
votes
2answers
265 views

Vim indentation of a bash script seems broken after a pipe

Vim builtin indentation seems to get confused with the following script. I cannot get Vim to indent properly the while-loop after the pipe. #!/bin/bash while true do # while loop is indented ...
4
votes
1answer
753 views

Why is bash not interactive after setting &shell='/bin/bash -i'?

My vimrc sets the shell option: let &shell='/bin/bash -i' which I confirm using echo &shell The -i makes the shell interactive. I want to do this so that it runs ~/.bashrc, which contains ...
2
votes
3answers
3k views

How do I turn Vi colors off in Ubuntu Linux 14.04

How do I turn vi colors off? I was using vim-tiny on on Ubuntu 14.04. Installed vim-nox. Version is version 7.4.52. Once I installed that, I got all these syntax colors by default. I have my Terminal ...
3
votes
1answer
135 views

Strange shell (bash) behavior when started from vim

Edit: Solved. See GitHub: amix/vimrc#204. I often drop a shell out of my vim window by :!bash but I have two problems with it. I can't use UTF8 for pipes with QWERTZ layout, I can't use Umlaut keys ...
5
votes
1answer
143 views

Use shell variable substitution with current filepath

I want to be able to easily change the filename. This works: :! var=%; mv % ${var/.txt/.asc} But this doesn't: :! mv % ${%/.txt/.asc} My questions: Why doesn't this work? Doesn't VIM simply ...
4
votes
0answers
137 views

readline: inputrc vi keys, ipython and the del key [closed]

I have the following .inputrc: set editing-mode vi set keymap vi-command set show-all-if-ambiguous on set completion-ignore-case on In bash when I type following (in insert mode!) as an example, # ...
27
votes
2answers
7k views

How to run bash command over current file and replace buffer with result? [duplicate]

I currently deal with lots of json files and am quite fond of the bash comand jq, e.g. if I want to format the file I do jq . ugly.json > formated.json Now, I don't want to leave vim, but run it ...
6
votes
1answer
845 views

Trouble to call a bash command from vimrc with autocommands | “Error: no previous command” (neovim)

basically i want to test within my vimrc, if /home/$USER/.dotfiles/nvim/bundle/vim-snippets/snippets was symlinked to /home/$USER/.dotfiles/nvim/snippets If not, it should create the symlink. the ...
18
votes
1answer
32k views

How do I configure the Vim airline plugin to look like its own project screenshot?

I am trying to get the vim-airline up and running. I have required it via vundle in my ~./vimrc: Plugin 'bling/vim-airline' I have installed it and expected my Vim to look like the screenshot on ...