Vim syntax highlighting for Oils
  • Vim Script 86.1%
  • Shell 13.9%
Find a file
2025-06-13 20:10:26 -04:00
demo False positives, regexp test, screenshot.ysh code 2025-06-08 20:47:46 -04:00
doc [doc] Remove TODOs that are done 2025-06-13 20:10:26 -04:00
ftdetect [refactor] Create ysh.vim 2025-06-05 23:45:04 -04:00
syntax [refactor] To common varNameRegex 2025-06-13 14:19:50 -04:00
testdata Remove testdata after fixing the --foo=r'bar' problem in YSH 2025-06-13 20:01:46 -04:00
.gitignore Move docs to doc/ 2025-06-08 11:49:04 -04:00
git.sh Time the push to both git hosts 2025-06-08 12:31:12 -04:00
LICENSE Add license 2025-06-08 15:36:05 -04:00
README.md Remove testdata after fixing the --foo=r'bar' problem in YSH 2025-06-13 20:01:46 -04:00
run.sh Remove testdata after fixing the --foo=r'bar' problem in YSH 2025-06-13 20:01:46 -04:00

Vim Syntax Highlighting for Oils

This repo has an accurate Vim syntax highlighter for YSH.

(Note: most editors have shell plugins, so they already understand OSH syntax!)

Installation

I use vim-plug, which is configured in your ~/.vimrc like this:

call plug#begin()

Plug 'https://github.com/oils-for-unix/oils.vim'

call plug#end()

Configuration

YSH has more syntax than say Java, which can make it harder to pick colors. My vimrc overrides these colors:

let g:ysh_expr_color = 20        " blue  
let g:ysh_sigil_pair_color = 55  " purple
let g:ysh_var_sub_color = 89     " lighter purple

let g:ysh_proc_name_color = 55   " purple
let g:ysh_func_name_color = 89   " lighter purple

For contributors

To test locally, temporarily change the line to point at a local copy:

Plug '~/git/oils-for-unix/oils.vim'

Run all tests:

./run.sh all-tests

Export testdata/ as HTML, and publish it;

./run.sh write-html
./run.sh deploy-html

And then go to:

Write Your Own YSH Syntax Highlighter

I wrote this doc after writing the Vim highlighter:

Here's an alternative plugin supports more features:

Though I found an issue where it incorrectly highlighted single quotes within # comments.

Code Hosts

This repo is hosted at:


Stages of Coarse Parsing