閱讀764 返回首頁    go 阿裏雲 go 技術社區[雲棲]


SpaceVim 使用指南

SpaceVim 是一個社區驅動的模塊化 vim/neovim 配置集合,其中包含了多種功能模塊,並且針對 neovim 做了功能優化。SpaceVim 有多種功能模塊可供選擇,用戶隻需要選擇所需的模塊,就可以配置出一個適合自己的開發環境。

使用過程中遇到問題或者有什麼功能需求可以在 github 提交 issue,這將更容易被關注和修複。我們也歡迎喜歡 vim/neovim 的用戶加入我們的 QQ 群,一起討論 vim 相關的技巧,點擊加入Vim/SpaceVim用戶群

SpaceVim 的開發很活躍,以下是近幾周的開發匯總:

安裝

Linux 或 Mac

Linux 或 Mac 下 SpaceVim 的安裝非常簡單,隻需要執行以下命令即可:


  1. curl -sLf https://spacevim.org/install.sh | bash

想要獲取更多的自定義的安裝方式,請參考:


  1. curl -sLf https://spacevim.org/install.sh | bash -s -- -h

SpaceVim是一種模塊化配置,可以運行在vim或者neovim上,關於vim以及neovim的安裝,請參考以下鏈接:

Windows

Windows 下 vim 用戶隻需要將本倉庫克隆成用戶 HOME 目錄下的 vimfiles 即可,打開 CMD 默認的目錄默認即為 HOME 目錄,隻需要執行如下命令即可:


  1. git clone https://github.com/SpaceVim/SpaceVim.git vimfiles

Windows 下 neovim 用戶需要將本倉庫克隆成用戶 HOME 目錄下的 AppData\Local\nvim,想要獲取跟多關於 neovim 安裝相關的知識,可以訪問 neovim 的 wiki, wiki 寫的非常詳細。打開 CMD 初始目錄默認一般即為 HOME 目錄,隻需要執行如下命令即可:


  1. git clone https://github.com/SpaceVim/SpaceVim.git AppData\Local\nvim

字體

SpaceVim 默認啟用了 Powerline 字體,默認的字體文件是:DejaVu Sans Mono, Windows 用戶直接下載下來右鍵安裝即可。

vimproc.dll

Windows 下用戶如果不方便編譯,可以在 qq 群文件裏麵下載相應的 dll 文件放到 vimproc 的 lib 目錄,默認是 ~/.cache/vimfiles/repos/github.com/Shougo/vimproc.vim/lib/

特性

優雅的界麵

SpaceVim 的默認界包括 tagbar 、vimfiler 、以及 airline 界麵,配色主題采用的 gruvbox。

Unite 為主的工作平台

Unite 的快捷鍵前綴是f, 可以通過 g:spacevim_unite_leader 來設定,快捷鍵無需記憶,SpaceVim 有很好的快捷鍵輔助機製,如下是 Unite 的快捷鍵鍵圖:

自動補全

SpaceVim 采用最快補全引擎 deoplete, 該引擎不同與 YouCompleteMe 的主要一點是支持多源補全,而不單單是語義補全。 而且補全來源拓展非常方便。

用戶配置

SpaceVim 將從 ~/.SpaceVim.d/init.vim 和當前目錄的 ./SpaceVim.d/init.vim 載入配置,並且更新 rtp,用戶可以在 ~/.SpaceVim.d/ 和 .SpaceVim.d/ 這兩個文件夾下編輯自己的腳本,和 SpaceVim 的配置文件。

示例:


  1. " Here are some basic customizations,
  2. " please refer to the ~/.SpaceVim.d/init.vim
  3. " file for all possible options:
  4. let g:spacevim_default_indent = 3
  5. let g:spacevim_max_column = 80
  6. " Change the default directory where all miscellaneous persistent files go.
  7. " By default it is ~/.cache/vimfiles.
  8. let g:spacevim_plugin_bundle_dir = '~/.cache/vimfiles'
  9. " set SpaceVim colorscheme
  10. let g:spacevim_colorscheme = 'jellybeans'
  11. " Set plugin manager, you want to use, default is dein.vim
  12. let g:spacevim_plugin_manager = 'dein' " neobundle or dein or vim-plug
  13. " use space as `<Leader>`
  14. let mapleader = "\<space>"
  15. " Set windows shortcut leader [Window], default is `s`
  16. let g:spacevim_windows_leader = 's'
  17. " Set unite work flow shortcut leader [Unite], default is `f`
  18. let g:spacevim_unite_leader = 'f'
  19. " By default, language specific plugins are not loaded. This can be changed
  20. " with the following, then the plugins for go development will be loaded.
  21. call SpaceVim#layers#load('lang#go')
  22. " loaded ui layer
  23. call SpaceVim#layers#load('ui')
  24. " If there is a particular plugin you don't like, you can define this
  25. " variable to disable them entirely:
  26. let g:spacevim_disabled_plugins=[
  27. \ ['junegunn/fzf.vim'],
  28. \ ]
  29. " If you want to add some custom plugins, use these options:
  30. let g:spacevim_custom_plugins = [
  31. \ ['plasticboy/vim-markdown', {'on_ft' : 'markdown'}],
  32. \ ['wsdjeg/GitHub.vim'],
  33. \ ]
  34. " set the guifont
  35. let g:spacevim_guifont = 'DejaVu\ Sans\ Mono\ for\ Powerline\ 11'

SpaceVim 選項

選項名稱 默認值 描述
g:spacevim_default_indent 2 對齊空格
g:spacevim_enable_guicolors 1 啟用/禁用終端使用真色彩
g:spacevim_windows_leader s 窗口管理快捷鍵前綴
g:spacevim_unite_leader f Unite快捷鍵前綴
g:spacevim_plugin_bundle_dir ~/.cache/vimfiles 默認插件緩存位置
g:spacevim_realtime_leader_guide 0 啟用/禁用實時快捷鍵提示
g:spacevim_guifont '' 設置SpaceVim字體
g:spacevim_sidebar_width 30 設置邊欄寬度,文件樹以及語法樹
g:spacevim_custom_plugins [] 設置自定義插件

原文發布時間為:2017-03-20

本文來自雲棲社區合作夥伴“Linux中國”

最後更新:2017-05-24 16:01:46

  上一篇:go  《STM32庫開發實戰指南:基於STM32F4》----2.3 仿真器配置
  下一篇:go  CentOS 7 上的 FirewallD 簡明指南