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
0 votes
0 answers
219 views

How do I make the bashls language server work with nvim-lspconfig?

bashls is not working. I have multiple working servers with nvim-lspconfig yet I can't figure out how to make the bashls server work at any capacity. I've tried this ... other lsps ... ...
Quadro Developer's user avatar
0 votes
2 answers
267 views

Writing a bash script to startup Vim in a particular configuration for a project

I want to write a bash script that starts up a Vim session using a specific configuration. For instance consider a C project with the following structure project_dir - src - file1.c - file2.c ...
Sina's user avatar
  • 115
0 votes
1 answer
56 views

Adding colour to the output of a bash command?

I'm working with pytest and have keybindings set up to run all the tests in the specific file I'm working on. The command I run is: :! pytest -vs "<C-r>%" However, the output of this ...
tcotts's user avatar
  • 101
2 votes
1 answer
45 views

:.w !bash a temporarily modified line and executing it in the shell

#!/usr/bin/env bash # scp /tmp/abc.sh SERVER1:~/bin && ssh SERVER1 "~/bin/abc.sh" echo "Hello Stack Exchange" echo "thanks for the help I would like to be able to use ...
Aaron Burda's user avatar
10 votes
3 answers
1k views

Syntax highlighting for shell scripts broken

Since recently my syntax highlighting for ft=sh (also syn=sh is set) is broken: Why is that? How can I fix it? Edit: I'm using Vim 9.0 with patches 1-1302. I add here the code from the screenshot. ...
pfnuesel's user avatar
  • 724
0 votes
2 answers
262 views

What does ! in the %retab! mean?

%retab! can replace all characters with spaces. The % in command %retab! means the whole lines in the current file. help retab show something such as: With !, Vim also replaces strings of only normal ...
newview's user avatar
  • 291
0 votes
1 answer
80 views

Which linux commands are native to Vim?

You can execute commands from vim like this: :!cp <src> <dest> However, the command is executed externally. The above can save typing and effort, but which are the commands that don't ...
user avatar
6 votes
0 answers
177 views

How to fix bash highlighting for left shift?

I have a bash function that does some bit-bashing (no pun intended, and I know the shell is not the best language for that sort of thing), but the syntax highlighter in vim is convinced that this: (( ...
Mark Reed's user avatar
  • 226
1 vote
1 answer
404 views

How to recognize Azure pipeline template expressions in bash?

When I work with Azure DevOps pipeline files (yaml), I don't get any syntax highlighting in script or bash blocks: That's why I have installed inkarkat/vim-SyntaxRange and configured it to recognize ...
MaxGyver's user avatar
  • 231
1 vote
1 answer
38 views

Turning on vi in terminal after returning to terminal [closed]

So I have set -o vi set in my .bashrc file When I open terminal it starts in INSERT mode. How can I make it so that it starts in NORMAL mode?
candrew's user avatar
  • 11
0 votes
0 answers
310 views

Call custom bash function from Vim

I have created a bash function, in its own .sh file, which I want to use from within Vim, and later use if from within the lightline config file. I have tried many ways, but I cannot make it work. ...
Xxxo's user avatar
  • 187
0 votes
1 answer
41 views

Help in troubleshooting strange behavior when resuming Vim from background

Latest update I start to think that the problem is not due to Vim in the first place. See this. Previous update I think I've almost tracked it down. The issue seems to be due to either command-t or ...
Enlico's user avatar
  • 2,194
0 votes
1 answer
823 views

How to run a bash one liner within nvim

I am running the latest version of nvim on the latest version of arch. I have this bash one liner which works as intended echo; lpstat -p | sed 's/printer //g' | sed 's/is idle. enabled since.*//g'; ...
Kes's user avatar
  • 663
0 votes
0 answers
210 views

How do I open up a new interactive shell from the command line?

When I run this command from the command line: taskopen -A c6cb317e It opens an interactive menu for choosing a file. After making a selection, it then opens a file in vim for editing, or, if the ...
StevieD's user avatar
  • 1,492
0 votes
1 answer
278 views

Vim8 && in :terminal's [command]

When running the vim command :!echo A && echo B the result is as expected A B Press ENTER or type command to continue However when I try to do the same thing with the new integrated terminal ...
Fraser's user avatar
  • 103
1 vote
1 answer
318 views

How can I open the last opened file by vim and go to a specific line?

I want a bash function to open the last file opened by vim and goes to a specfic line I tried vil() { vim -c "normal! '\''0 :$1" }
Ahmad's user avatar
  • 165
0 votes
1 answer
136 views

How do I get the line numbers to permanently appear in vim [duplicate]

I keep wanting to customize vim, how do I get the line numbers to show up everytime i open up VIM.
pythava's user avatar
-1 votes
1 answer
106 views

vimrc, like exec but replaces current process (fork?)

Such as in the following code: let cpath = getcwd() let cfile = expand('%') function Run_file_hopper(cpath, cfile) silent exec "! . ~/path/somescript.sh" a:cpath a:cfile ...
john-jones's user avatar
0 votes
0 answers
37 views

Attaching audio spoken word "escape" to Esc key stops escape key escaping to normal mode in nvim. How to fix?

I am running the latest versions of: Arch, nvim, and the Openbox window manager. I often don't know whether I have actually hit the escape key or not, when exiting another mode to normal mode. If I ...
Kes's user avatar
  • 663
0 votes
0 answers
1k views

"Inappropriate ioctl for device" and "no job control in this shell" bash error

I am getting a bash|1 warning| Inappropriate ioctl for device when Ale runs lint on cpp files with gcc/g++. Using gcc/g++ to compile manually in the terminal works fine. Otherwise the linting of cpp ...
Tiseno's user avatar
  • 1
1 vote
0 answers
609 views

Retrieving declaration not supported for filetype

I am currently using vim-lsp for bash. As in https://github.com/bash-lsp/bash-language-server#vim I have added in my ~/.vimrc the followings : if executable('bash-language-server') au User lsp_setup ...
exteral's user avatar
  • 111
5 votes
0 answers
196 views

Can I get vim to indent correctly after a here document?

In an account with just an emtpy .vimrc, under Xubuntu 20.04 and vim 8.1, I get strange indentaion after my here document if I reindent with gg=G I've boiled down an example from some pretty tangled ...
4dummies's user avatar
  • 233
2 votes
1 answer
239 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 ...
Enlico's user avatar
  • 2,194
1 vote
1 answer
2k 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 ...
Connie Jash's user avatar
1 vote
1 answer
257 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 ...
leeand00's user avatar
  • 3,545
1 vote
0 answers
129 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 ...
Plax's user avatar
  • 11
2 votes
1 answer
409 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?
Alexander Pozdneev's user avatar
1 vote
0 answers
247 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, ...
user985675's user avatar
4 votes
2 answers
2k 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 ...
David542's user avatar
  • 2,435
4 votes
1 answer
2k 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-...
rplee's user avatar
  • 177
0 votes
0 answers
23 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 ...
Machine Yadav's user avatar
1 vote
2 answers
567 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 {}...
Chris's user avatar
  • 123
5 votes
2 answers
780 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 | ...
Przemysław Czechowski's user avatar
0 votes
0 answers
27 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 ...
Gaurang Tandon's user avatar
2 votes
0 answers
15 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 ...
mtk's user avatar
  • 243
6 votes
2 answers
346 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 ...
Drake P's user avatar
  • 175
0 votes
1 answer
571 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 ...
Noel Pure's user avatar
  • 103
8 votes
1 answer
4k 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 ...
greenglass's user avatar
2 votes
0 answers
493 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 ...
Excel Help's user avatar
1 vote
3 answers
13k 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?
Flux's user avatar
  • 1,041
3 votes
1 answer
166 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 : ...
SebMa's user avatar
  • 2,958
2 votes
0 answers
52 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. ...
Dennis Williamson's user avatar
0 votes
1 answer
2k 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 $...
ojunk's user avatar
  • 143
1 vote
1 answer
418 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 ...
convergedtarkus's user avatar
2 votes
0 answers
102 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 ...
Max Coplan's user avatar
3 votes
1 answer
75 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 ...
AngocA's user avatar
  • 133
2 votes
2 answers
798 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 ...
mle0312's user avatar
  • 341
0 votes
2 answers
2k 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 ...
ChrKahl's user avatar
  • 165
1 vote
1 answer
1k 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 ...
user45189's user avatar
1 vote
1 answer
4k 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?
lluke's user avatar
  • 219