我是Neovim的新用户,并试图弄清楚如何为Ruby启用语法高亮.
我应该编辑什么配置?
编辑:
这是我目前的配置:
? ~ cat ~/.nvimrc
filetype plugin indent on
syntax on
set tabstop=2
set number
set noswapfile
" Automatically indent on new lines
set autoindent
" Copy the indentation of the previous line if auto indent doesn't know what to do
set copyindent
" Indenting a line with >> or << will indent or un-indent by 2
set shiftwidth=2
" Pressing tab in insert mode will use 4 spaces
set softtabstop=2
" Use spaces instead of tabs
set expandtab
" [SEARCH]
:set incsearch
:set hlsearch
" <Ctrl-l> redraws the screen and removes any search highlighting.
nnoremap <silent> <C-l> :nohl<CR><C-l>
Run Code Online (Sandbox Code Playgroud)
这是加载Neovim时出现的错误:
? ~ nvim test.rb
Error detected while processing /Users/user/.nvimrc:
line 2:
E484: Can't open file /usr/local/Cellar/neovim/HEAD/share/vim/syntax/syntax.vim
Press ENTER or type command to continue
Run Code Online (Sandbox Code Playgroud)
FDi*_*off 10
Neovim使用xdg规范作为配置文件.如果你已经在使用vim.(如果您是从旧版本neovim的转移~/.nvimrc
是现在$XDG_CONFIG_HOME/nvim/init.vim
和~/.nvim
现在$XDG_CONFIG_HOME/nvim
)
mkdir -p ${XDG_CONFIG_HOME:=$HOME/.config}
ln -s ~/.vim $XDG_CONFIG_HOME/nvim
ln -s ~/.vimrc $XDG_CONFIG_HOME/nvim/init.vim
Run Code Online (Sandbox Code Playgroud)
应该让你接近运行neovim(这可能不适用于所有插件,但它的开始).
您需要的$XDG_CONFIG_HOME/nvim/init.vim
只是以下内容
filetype plugin indent on
syntax on
Run Code Online (Sandbox Code Playgroud)
获取ruby的语法高亮显示.