Questions tagged [filetype-sh]

Questions about the sh file type

Filter by
Sorted by
Tagged with
9 votes
2 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
  • 704
0 votes
0 answers
119 views

Don’t start in insert mode when opening a shell script

How can I prevent vi from starting in insert mode when opening a "test.sh"-like file with the vi-plugin "bash-support" v4.3 ? When I vim test.sh it opens in insert mode When I vim .vimrc it opens in ...
McErroneous's user avatar
6 votes
2 answers
1k views

Highlighting another syntax in a shell heredoc

I edited my original question and title to broaden its scope to any syntax - with SQL used as just an example. You can adapt the examples and the answer to other languages. By adding suitable ...
stepse's user avatar
  • 201
4 votes
1 answer
370 views

Modify `iskeyword` for keyword-local completion only

Context Some time ago, I added the following line to ~/.vim/after/ftplugin/sh.vim to make working with parameter expansions easier: setlocal iskeyword+=$ This is nice to be able to e.g. ysiw" via ...
D. Ben Knoble's user avatar
  • 25.3k
1 vote
0 answers
145 views

indentation different on different computers

If I indent the following script with gg=G: #!/usr/bin/env bash while true; do case "${1}" in -h) usage; exit 0;; -b) branch="${2}"; shift 2;; -t) build="${2}"; shift 2;; ...
pfnuesel's user avatar
  • 704
2 votes
1 answer
514 views

Vim highlights valid shell parameter expansion syntax as an error

#!/bin/bash echo ${2:-"-l -p"} Having some bash parameter-substitution fun and (Neo) Vim complains about it, while the code is perfectly fine. I know I can suppress errors totally by doing sort of ...
Al.G.'s user avatar
  • 357
2 votes
1 answer
128 views

Modify sh.vim to accept (@)_ as part of a variable name for Bash highlighting

I have Bash file in which I have constructs that include (@)_ as part of the variable name. For example: (@)_VariableName ${(@)_VariableName[@]} ${#(@)_VariableName[@]} ${!(@)_VariableName[@]} The ...
Steve Amerige's user avatar