vim - 如何在 Neovim 中启用 Ruby 语法高亮?

标签 vim neovim

我是 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>

这是我在加载 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

最佳答案

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

应该让你接近使用 neovim 运行(这可能不适用于所有插件,但它是一个开始)。

所有你需要的在 $XDG_CONFIG_HOME/nvim/init.vim以下是
filetype plugin indent on
syntax on

获得 ruby​​ 的语法高亮。

关于vim - 如何在 Neovim 中启用 Ruby 语法高亮?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27515067/

相关文章:

regex - Vim 如何制作 :g work properly with zs matches

vim - .ideavimrc 中有用的自定义

lua - 望远镜查找文件和实时 grep 不起作用

c - VIM 与你一起完成我

ssh - 连接到系统 : neovim inside tmux inside ssh

bash - 如何避免 vim 内部的 vim 进行 git/mercurial merge ?

vim - tmux + vim,当从 Windows ssh 到 Linux 机器时重新连接后剪贴板失败

python - Vim:如何在 Python 中使用 omnicompletion 显示所有补全而不是扩展到“self”?

Vim:在长线内快速移动

neovim - 如何在 neovim 中滚动终端模拟器?