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
1answer
19 views

Is there a filetype in Vim when opening the a file containing output/errors from g++ so that I can see those files with the original coloring?

Sometimes, when faulty outputs from compilations of C++ files/projects are to long, I like to redirect that output to a file, so that I can inspect it side-by-side with each of the offending files in ...
1
vote
1answer
90 views

Cannot Edit ~/.vimrc file without both E297 error and E667 From Appearing

I am SSHing into an Ubuntu machine where I use Bash as the shell. I used to be able to edit my ~/.vimrc file very easily. Now, whenever I try to write to it, I get a warning E297 write error in swap ...
0
votes
1answer
21 views

How to escape a single quote when passing an ex-mode command from the command line, back to the command line?

Here is the command I'm trying to escape a ' from bash, to vis' to ex-mode, and then back to bash so it can be read into the buffer again: vi -c 'sp | enew | read ! echo "Use to jump between ...
1
vote
0answers
34 views

How to set the Bash python env and vim python env paths the same?

When I check for python version in vim file, it displays 3.6 whereas it shows python 3.7 when I check from the bash terminal. As a result, when I pip install from the terminal, it installs in the ...
1
vote
1answer
26 views

Open or create a specific Vimwiki page from a command prompt

For opening the index page of my Vimwiki instance, I have the following alias in my ~/.bashrc: alias vimwiki='vim -c VimwikiIndex' But how to open a specific Vimwiki page right from a command prompt?
1
vote
0answers
40 views

gvim remove menu and toolbar, but keep original geometry

I start gvim with this entry in .bashrc alias G='gvim -fg white -bg black -geom 80x45 ' and have in .vimrc set guioptions=aeik which works as expected and gives me a gvim that looks like vim in a tty, ...
2
votes
2answers
89 views

Shell syntax highlighting

I've noticed in bash/shell it highlights $(...) in red, for example: However, if I change the syntax from ft=sh to ft=bash, it does not do this: What's the reason for this? Am I doing something ...
3
votes
1answer
288 views

Can't search for strings within hidden files with fzf's Rg command in vim

I just installed fzf for my bash terminal and the fzf.vim plugin for vim. I've placed the following code at the bottom of my .bashrc script: export FZF_DEFAULT_COMMAND='rg --files --hidden --no-ignore-...
0
votes
0answers
20 views

How to follow while searching regex in vim? [duplicate]

In my previous vim, when i typed /something and after reaching upto so vim started immediately following and with each letter typed i got into new word until i got the perfect. However this following ...
1
vote
2answers
60 views

Vi: how to use bash from the vi command line?

Suppose I have mapped the following function: noremap <C-F12> :! bash -c "\ git rev-parse --show-toplevel \ | xargs -I {} \ ctags -R --sort=yes --c++-kinds=+p --fields=+iaS --extra=+q {}...
4
votes
2answers
184 views

Open multiple files in custom split layout

I want to open three files file1.txt file2.txt file3.txt in vertical and horizontal split combination, like this: +-------------------------------+ | | | | file1.txt | ...
0
votes
0answers
23 views

How to use bash aliases in ftplugin files? [duplicate]

I want to be able to compile and run C++ files directly from inside vim. I have a custom compilation alias gmm defined in ~/.bash_aliases. I do not want to copy it over to my ~/.vim/ftplugin/cpp.vim ...
2
votes
0answers
13 views

vim command mode g++ doesn't pick the bash alias [duplicate]

I have g++ alias defined in my .bashrc file as alias g++='g++ -Wall -DLOCAL=1' I am invoking following command from vim command/normal mode to compile a program - !g++ % The issue is, this ...
6
votes
2answers
262 views

Shell scripting: A more elegant way to complete then…fi, do…done, case…esac pairs?

The problem In shell scripting, conditionals and loops don't use curly braces to indicate blocks, but rather special keywords: if [ ... ]; then statements close with fi, while [ ... ]; do statements ...
0
votes
1answer
71 views

Whats the benefit of using :term inside Vim compared to a separate terminal emulator app?

I am using iTerm2, which is working well for me. I've been using VIM for almost 2 years now, with MacVim. Then suddenly I became curious whether my coding experience will improve when I use terminal ...
4
votes
1answer
513 views

How can neovim on Windows be configured to use gitbash as the shell without breaking temp files?

At work I use neovim on Windows, and set the shell to bash using the bash executable that comes with Git for Windows (gitbash), which is in my PATH. The settings in the minimal init.vim pasted below ...
2
votes
0answers
235 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
3k 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
155 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
38 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
409 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
159 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
54 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
47 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 ...
2
votes
2answers
174 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
782 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
689 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
2k 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
57 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: ...
4
votes
0answers
356 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 ...
2
votes
2answers
702 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
527 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 ...
9
votes
2answers
5k 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
290 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
121 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 ...
6
votes
2answers
390 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
396 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
105 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 ...
5
votes
2answers
3k 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
338 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 ...
17
votes
4answers
20k 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
314 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
85 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
1k 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
157 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
317 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
230 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
65 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, ...