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.

Filter by
Sorted by
Tagged with
2
votes
0answers
25 views

Use external commands within venv virtual environment

Same question as Use Vim with virtualenv, except for these differences: I'm using bash, not zsh using venv, not virtualenv or virtualenvwrapper I have a keybinding to run the current buffer as a ...
0
votes
3answers
195 views

How to restart vim from within vim?

Here's how I restart vim: $ vim :q $ vim Is there a way to restart vim so that there is no need to type the second vim in the shell?
3
votes
1answer
148 views

Cannot sort my bash functions correctly

I'm trying to sort my bash functions inside my .bash_functions file. Here is what I type : :g/^function /,/^}$/ s/\n/@@@ :sort /^function / :%s/@@@/\r/g EDIT0 : Here is some of the input : ...
2
votes
0answers
34 views

head isn't included in syntax/sh.vim

head is a common Unix/Linux executable, but it's not listed in the shell syntax highlighting configuration. In contrast, many common executables are. Specifically, its counterpart, tail, is listed. ...
0
votes
1answer
32 views

Changing PYTHONPATH from inside VIM

Today I was writing code in VIM and wanted to change the PYTHONPATH and so I ran: :!echo $PYTHONPATH;export PYTHONPATH="/home/oli/git/published_libraries/computer_communication_framework";echo $...
1
vote
1answer
49 views

Using a login shell only for the :term command

I'm on MacOS, so basically all terminals are login terminals for me which source my bash_profile and load everything I need. However, the :term command does not source my bash_profile, I believe ...
2
votes
0answers
40 views

Go to current cursor position when invoking command-line edit mode

If I press v while using either the vi-mode zsh plugin or set -o vi in bash, it opens the line I'm working on in a full vim session. However, this puts my cursor at the beginning at the beginning of ...
3
votes
1answer
27 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
67 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
125 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
201 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
649 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
39 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
192 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
429 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
280 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 ...
6
votes
2answers
2k 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
143 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
96 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
194 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
64 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
206 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
79 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 ...
3
votes
2answers
876 views

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

In Vim 8, you can open a terminal inside Vim with the 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? ...
3
votes
2answers
230 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 ...
7
votes
3answers
10k 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
273 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
70 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
856 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
92 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 ...
4
votes
3answers
154 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
164 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
205 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. ...
2
votes
1answer
48 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
461 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""...
4
votes
1answer
204 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 ...
20
votes
2answers
11k 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 ...
3
votes
1answer
65 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
249 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 ...
3
votes
1answer
289 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 [...
3
votes
1answer
169 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. " ...
6
votes
1answer
581 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 ...
3
votes
2answers
979 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 ...
10
votes
4answers
1k 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
318 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 ...
3
votes
1answer
917 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 ...