Linux 安装最新Neovim

2023-05-11 09:34:25 浏览数 (1)

NeoVim 和Vim 的差异

vim 老矣

  • Vim已经几乎是老代码,维护的人较少。
  • vim 代码老旧,bugfix,新特性加入比较困难。

vim 新型分支 --neovim

Neovim是一个社区驱动的开源项目,是Vim文本编辑器的一个分叉版本,它的构建使Vim更容易为核心开发人员维护。是对vim的一个增强,相比与vim性能更好,速度更快。

安装最新版本

  • 下载最新代码,切换到nightly分支
代码语言:javascript复制
git clone git@github.com:neovim/neovim.git
git checkout nightly
  • 编译
代码语言:javascript复制
make CMAKE_BUILD_TYPE=RelWithDebInfo
sudo make install

查看版本:

代码语言:javascript复制
➜  neovim git:(heads/nightly) vim --version                 
NVIM v0.10.0-dev-304 g84378c4dd
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/cc -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wvla -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-attribute -Wmissing-prototypes -fno-common -Wno-unused-result -Wimplicit-fallthrough -fdiagnostics-color=always -fstack-protector-strong -DUNIT_TESTING -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -I/home/zeekling/project/github/neovim/.deps/usr/include/luajit-2.1 -I/usr/include -I/home/zeekling/project/github/neovim/.deps/usr/include -I/home/zeekling/project/github/neovim/build/src/nvim/auto -I/home/zeekling/project/github/neovim/build/include -I/home/zeekling/project/github/neovim/build/cmake.config -I/home/zeekling/project/github/neovim/src -I/usr/include -I/home/zeekling/project/github/neovim/.deps/usr/include -I/home/zeekling/project/github/neovim/.deps/usr/include -I/home/zeekling/project/github/neovim/.deps/usr/include -I/home/zeekling/project/github/neovim/.deps/usr/include -I/home/zeekling/project/github/neovim/.deps/usr/include -I/home/zeekling/project/github/neovim/.deps/usr/include

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/local/share/nvim"

Run :checkhealth for more info

如何把neovim配置的像IDE一样

安装SpaceVim

安装参考:https://spacevim.org/quick-start-guide/#installation

配置

/.SpaceVim.d/init.toml中添加下面内容:

代码语言:javascript复制
# Enable autocomplete layer
[[layers]]
name = 'autocomplete'
auto_completion_return_key_behavior = "complete"
auto_completion_tab_key_behavior = "smart"
auto_completion_delay = 50
auto_completion_complete_with_key_sequence = "nil"
auto_completion_complete_with_key_sequence_delay = 0.1

[[layers]]
name = "lang#python"

[[layers]]
name = "format"

[[layers]]
name = 'lang#c'
enable_clang_syntax_highlight = true

[[layers]]
  name = "lsp"

[[layers]]
  name = "ui"
  enable_scrollbar = false
  enable_sidebar = false

[[layers]]
name = "incsearch"

[[layers]]
  name = "lang#markdown"

[[layers]]
  name = "git"
  git_plugin = 'fugitive'

[[layers]]
  name = "lang#cmake"

[[layers]]
  name = "lang#java"  

[[layers]] 
  name = "lang#python"

[[layers]]
  name = "colorscheme"

[[layers]]
  name = "gtags"
  gtagslabel = "pygments"

[[layers]]
  name = "lang#tcl"

[[layers]]
  name = "lang#lua"

[options]
    # 文件树插件可选值包括:
    # - nerdtree (默认)
    # - vimfiler: 需要编译 vimproc.vim, 在目录 bundle/vimproc.vim 下
    # - defx: 需要  py3 支持
    filemanager = "vimfiler"
    enable_filetree_gitstatus = true
    project_rooter_patterns = ['.git/', '_darcs/', '.hg/', '.bzr/', '.svn/']
    vimcompatible = false
    filetree_direction = "left"
#    colorscheme = "SpaceVim"
    colorscheme = "material"
#    colorscheme = "hybrid"
#    colorscheme = "NeoSolarized"
    colorscheme_bg = "light"
    enable_guicolors = true
    bootstrap_before = "myspacevim#before"
    bootstrap_after  = "myspacevim#after"

0 人点赞