lin.vim : Lin Rongbin's (Neo)Vim Distribution
lin.vim is a highly configured Vim/Neovim integrated tons of utilities for development, inspired by spf13-vim.
Table of Contents
- Introduction
- Installation
- User Guide
- Embeded Language Servers
- Reference
- Contribute
Introduction
lin.vim is aimed to out of box, IDE-like editing features, high performance, light weight and friendly to most users.
lin.vim is focused on and only on editing, it doesn't compile/package/debug projects, not tutorial for new vim users neither.
lin.vim solved such issues:
- Solved the difficulty of choosing/grouping/configuring plugins, a set of plugins are embeded and well configured to most needs.
- Solved the difficulty of duplicate installation on different OS and machines, it's been made easier by one line command (not on Windows for now).
- Solved the difficulty of balance between performance and features, only carefully chosen plugins are installed, try to be a modern editor just like vscode.
- Solved the UI-looking issue of original (neo)vim, make you happy working with pretty colorschemes/UI/icons.
- Document everything so nothing is confused.
- Customization ability for special needs.
Screenshots
Simple but pretty UI
Code complete for C++
Fast cursor movement
Search text
Search files
Markdown preview
Feature
- Automatically installation (not on windows for now).
- Works on multiple OS platforms:
- Windows
- macOS
- Linux(Ubuntu/Debian/Fedora/Manjaro)
- Support both Vim and Neovim, neovim 0.6+ is strongly recommended for better performance and experience.
- Modern editor UI features:
- File explorer
- Pretty icons
- Pretty color schemes (see Color Schemes - Reference) collected and randomly selected on start
- Status line
- Tab line and buffer explorer
- Outline/Tags
- IDE-like editing features supported by coc.nvim, a set of language servers(see Embeded Language Servers) are embeded by default:
- Code complete
- Diagnostic
- Lint
- Code format
- Jump between symbols
- Code Actions
- Code Lens
- Search engine features supported default by fzf.vim:
- Text search on text/lines/tags/search-histories/command-histories/yank-histories
- File search on files/buffers/history-files
- Git search on commits/uncommit-changes
- Coc.nvim integrated search on symbols/outline/diagnostics/yank
- Other enhancement search on vim-marks/vim-key-mappings/vim-commands/help-tags
- Other editing featuers (see Other Enhancements)
- Custom configuration.
Project Structure
|+install Installation scripts for different platforms.
|+setting VimL script settings.
|+template Templates for ~/.vim/plugin.vim, ~/.vim/coc-settings.json and ~/.vim/setting.vim.
|`install.sh UNIX/Linux/MacOS install script.
|`install.ps1 Windows PowerShell install script.
|`LICENSE The license file.
|`lin.vim The .vimrc file.
|`README.md The readme document.
Installation
Requirements
lin.vim requires below softwares:
- vim, nvim
- clang/gcc, make, cmake
- python3 and pip3 (python 2.x is not supported)
- node and npm
- golang
- rustc and cargo
- curl, wget
- universal-ctags
- unzip
- hack nerd font
The install script install.sh
will automatically install these requirements with system package managers:
install/apt.sh
for debian/ubuntu based linuxinstall/brew.sh
for macOS homebrew, install Xcode and homebrew as pre-requirementsinstall/dnf.sh
for fedora/redhat based linuxxinstall/pacman.sh
for archlinux based linuxx
Other Linux/UNIX systems(Gentoo based linux, bsd, etc) are not supported yet.
Access of below websites are required as well, please make sure they're available:
- github: github.com, raw.githubusercontent.com
- rust: www.rust-lang.org, crates.io
- golang: go.dev
UNIX/Linux/MacOS
$ git clone https://github.com/linrongbin16/lin.vim ~/.vim && cd ~/.vim && ./install.sh
Windows
The goal of installation on windows is to install native executable file, no WSL nor MYSY2 for below reasons:
- Native executable file has better performance, WSL/MYSY2 either use portable GNU shell or ubuntu virtual machine, which is quite slow and heavy.
- Supporting WSL backend mode (actually remote mode) like vscode is too heavy development work.
- Git for Windows already contains MYSY2 and provide Unix/Linux builtin commands, lin.vim use it directly.
-
Install Visual Studio with at least these components:
- .NET Desktop Development
- Visual C++ Desktop Development
- Common Windows Platform Development
-
Install 64-bit Git for Windows Setup with especially these options:
- In the 3rd Select Components step, enable Associate .sh files to be run with Bash
- In the 7th Adjusting your PATH environment step, choose Use Git and optional Unix tools from the Command Prompt
- In the 11th Configuring the terminal emulator to use with Git Bash step, choose Use Windows's default console window
After git installation, git.exe
should be found in $env:Path
, Unix/Linux builtin commands such as bash.exe
, cp.exe
, mv.exe
, cd.exe
, find.exe
, cat.exe
should be found as well.
Notice:
- if you are using WSL,
C:\Windows\System32\bash.exe
could lead you to WSL instead of thebash.exe
provided by Git for Windows. Make sure Git for Windows PATH environment is ahead ofC:\Windows\System32
sobash.exe
from Git for Windows (wsl.exe
could connect to WSL as well) will be first detected on Command Prompt. - Don't use old-version
vim.exe
provided by Git for Windows, usegvim.exe
provided by followed steps.
-
Install other third party dependencies (x64 is preferred):
- (Optional) make: add
make.exe
in$env:Path
- cmake: add
cmake.exe
in$env:Path
- gvim: add
gvim.exe
in$env:Path
- (Recommended) neovim: add
nvim.exe
,nvim-qt.exe
in$env:Path
- python3: since python3 installer don't provide
python3.exe
andpip3.exe
, manually copypython.exe
aspython3.exe
, copypip.exe
aspip3.exe
, then add them in$env:Path
- llvm: add
clang.exe
,clang++.exe
,clangd.exe
,clang-tidy.exe
,clang-format.exe
in$env:Path
- rust: add
rustc.exe
,cargo.exe
in$env:Path
- golang: add
go.exe
in$env:Path
- nodejs: add
node.exe
,npm.exe
in$env:Path
- ripgrep: add
rg.exe
in$env:Path
- fzf: add
fzf.exe
in$env:Path
- bat: add
bat.exe
in$env:Path
- fd: add
fd.exe
in$env:Path
- universal-ctags: add
ctags.exe
,readtags.exe
in$env:Path
- (Optional) make: add
Notice:
- Python3 version must be compatible with gvim/neovim's libpython3.so version, or it will not been loaded. Please use
gvim --version
to find its libpython3.so version. - Install these dependencies with a package manager (such as chocolatey and scoop) is another option, just make sure they're available in
$env:Path
.
-
Install Hack Nerd Font Mono Windows Compatible:
Hack Bold Nerd Font Complete Mono Windows Compatible.ttf
Hack Bold Italic Nerd Font Complete Mono Windows Compatible.ttf
Hack Italic Nerd Font Complete Mono Windows Compatible.ttf
Hack Regular Nerd Font Complete Mono Windows Compatible.ttf
-
Install lin.vim as administrator:
$ git clone https://github.com/linrongbin16/lin.vim $env:UserProfile\.vim
$ cd $env:UserProfile\.vim
$ .\install.ps1
User Guide
In this section, vim editing mode are specified with:
- 🄽 - Normal Mode
- 🅅 - Visual Mode
- 🄸 - Insert Mode
Hot Key
F1
🄽 - toggle(open/close) file explorer, see Simple but pretty UI.F2
🄽 - toggle(open/close) undo tree.F3
🄽 - toggle(open/close) vista outline/tags, see Code complete for C++.F4
🄽 - switch between C/C++ header and source files.F8
🄽 - open markdown preview.F9
🄽 - change color theme randomly, see Screenshots.F10
/SHIFT-F10
🄽 - open/close(toggle) opened buffers explorer.
You could configure these keys in ~/.vim/setting.vim.
UI
File Explorer
File explorer is supported by coc-explorer (switched to nvim-tree.lua on neovim 0.7+), you could use key mappings on the file explorer left side:
Navigation:
h
🄽 - collapse directory.l
🄽 - open or expand directory.<CR>
🄽 - open file or cd into directory.<BS>
🄽 - leave directory and goto upper directory.e
🄽 - open file insplit
.E
🄽 - open file invsplit
.t
🄽 - open file in new tab.
Create/Delete/Copy/Paste/Cut:
a
/A
🄽 - create new file/directory.m
/r
🄽 - move/rename file/directory.<C-c>
🄽 - copy file/directory into internal clipboard just like in Windows.<C-x>
🄽 - cut file/directory into internal clipboard just like in Windows.<C-v>
🄽 - paste internal clipboard file/directory to current directory just like in Windows.d
🄽 - trash file/directory to system trash-bin, only works on Windows/macOS.D
🄽 - force delete file/directory, possiblely implemented withrm
.R
🄽 - reload file explorer.
Resize Width:
<A-Right>
(<D-Right>
)/<A-.>
(<D-.>
) 🄽 - make explorer bigger.<A-Left>
(<D-Left>
)/<A-,>
(<D-,>
) 🄽 - make explorer smaller.
Preview:
P
🄽 - preview file content.I
🄽 - preview file info.
Others:
H
🄽 - toggle dotfiles hidden.y
🄽 - copy file name string.Y
🄽 - copy absolute file path string.s
🄽 - open file in system file manager(such as Finder in macOS).?
🄽 - open/close(toggle) help.
You could editing ~/.vim/setting/weirongxu/coc-explorer.vim (or ~/.vim/setting/kyazdani42/nvim-tree.lua.vim) to customize key mappings. Please refer to coc-explorer - Custom mappings example (or nvim-tree.lua - README) for more key mappings.
Buffers/Tabs
Buffers/tabs is supported by vim-buffet(switched to barbar.nvim on neovim 0.5+), you could switch/close them by key mappings:
<leader><tab>
/<A-Right>
(<D-Right>
)/<A-.>
(<D-.>
) 🄽 - go to next buffer on the right.<leader><s-tab>
/<A-Left>
(<D-Left>
)/<A-,>
(<D-,>
) 🄽 - go to previous buffer on the left(Notice some terminal/GUI could eat Alt+, Alt+. or Command+, Command+.).<leader>bd
🄽 - close current buffer and go to a nearest buffer without closing vim window.F10
/SHIFT-F10
🄽 - open/close(toggle) opened buffers explorer.
Alt-1 ~ Alt-9 are mapped to switch between 1 ~ 9 buffers, Alt-0 are mapped to navigate to the last buffer. For macOS, Command-1 ~ Command-9 and Command-0 are configured for the same thing.
<A-1>
(<D-1>
) 🄽 - go to buffer-1.<A-2>
(<D-2>
) 🄽 - go to buffer-2.<A-3>
(<D-3>
) 🄽 - go to buffer-3.<A-4>
(<D-4>
) 🄽 - go to buffer-4.<A-5>
(<D-5>
) 🄽 - go to buffer-5.<A-6>
(<D-6>
) 🄽 - go to buffer-6.<A-7>
(<D-7>
) 🄽 - go to buffer-7.<A-8>
(<D-8>
) 🄽 - go to buffer-8.<A-9>
(<D-9>
) 🄽 - go to buffer-9.<A-0>
(<D-0>
) 🄽 - go to the last buffer.
For neovim 0.5+ using barbar.nvim, especially you could re-ordering and mouse-clicking on buffers:
<A-S-Right>
(<D-S-Right>
) 🄽 - move current buffer to next position(on the right).<A-S-Left>
(<D-S-Left>
) 🄽 - move current buffer to previous position(on the left).<LeftMouse>
🄽 - go to selected buffer.<MiddleMouse>
🄽 - close selected buffer.
Font
lin.vim use Hack Nerd Font by default. Please manually install other nerd fonts and configure in ~/.vim/setting.vim for other options.
IDE-like Editing Features
Code Complete
<tab>
/<c-n>
/<down>
🄸 - navigate to next suggestion.<s-tab>
/<c-p>
/<up>
🄸 - navigate to previous suggestion.<cr>
🄸 - confirm current suggestion or snippet.<esc>
/<c-[>
🄸 - close suggestion.<c-k>
🄸 - force trigger suggestion.<c-f>
🄸 - jump to next snippet position.<c-b>
🄸 - jump to previous snippet position.
Jumps
[d
🄽 - go to previous diagnostic location.]d
🄽 - go to next diagnostic location.gd
🄽 - go to definition.gy
🄽 - go to type(function) definition.gi
🄽 - go to implemention.gr
🄽 - go to references.
Symbols
K
🄽 - show hover(symbol definition).<leader>rs
🄽 - rename symbol.
Code Format
<leader>cf
🄽🅅 - format code on current buffer or visual selected code.
Code Actions
<leader>ca
🄽🅅 - run code actions on current cursor position or visual selected code.<leader>qf
🄽 - apply quick fix on current line.
Code Lens
<leader>cl
🄽 - run code lens on current line.
Git
[c
🄽 - go to previous git chunk.]c
🄽 - go to next git chunk.
Search
Search engine use fzf.vim and integrated with coc.nvim with coc-fzf, all fzf commands are configured with prefix Fzf, for example :Files
are renamed to :FzfFiles
, :Rg
are renamed to :FzfRg
.
Text Search
<space>gr
🄽 - search text by:FzfRg
.<space>l
🄽 - search lines on opened buffers by:FzfLines
.<space>t
🄽 - search tags by:FzfTags
.<space>y
🄽 - search yank history by:CocFzfList yank
.<space>sh
🄽 - search search history by:FzfHistory/
.<space>ch
🄽 - search vim command history by:FzfHistory:
.
File Search
<space>f
/<c-p>
🄽 - search files by:FzfFiles
.<space>b
🄽 - search opened buffers by:FzfBuffers
.<space>hf
🄽 - search history files (v:oldfiles) and opened buffers by:FzfHistory
.
Git Search
<space>gc
🄽 - search git commits by:FzfCommits
.<space>gf
🄽 - search git files rby:FzfGFile
.<space>gs
🄽 - search git status(also diff files by preview) by:FzfGFiles?
.
Other Search
<space>mk
🄽 - search marks by:FzfMarks
.<space>mp
🄽 - search normal mode vim key mappings by:FzfMaps
.<space>vc
🄽 - search vim commands by:FzfCommands
.<space>ht
🄽 - search help tags by:FzfHelptags
.
Coc.nvim Search
Key mappings are configured with prefix char c
after <space>
.
<space>cs
🄽 - search symbols by:CocFzfList symbols
. Notice coc-fzf's symbols only work on neovim, it fallback to:CocList symbols
on vim.<space>cd
🄽 - search diagnostics by:CocFzfList diagnostics
.<space>co
🄽 - search outline/tags by:CocFzfList outline
.<space>cc
🄽 - search commands by:CocFzfList commands
.<space>cl
🄽 - search location by:CocFzfList location
.
Please visit fzf.vim and coc-fzf for more information.
Editing Support
Enhanced Copy Paste
when you want copy/paste between different vim instances. Use enhanced copy-paste to stored text content in a file cache:
<leader>y
🅅 - copy visual-selected text to~/.vim/.enhanced-copy-paste-cache
.<leader>p
🄽 - paste text saved from~/.vim/.enhanced-copy-paste-cache
.
You could configure these key mappings in ~/.vim/setting/linrongbin16/enhanced-copy-paste.vim.
Fast Cursor Movement
See Fast cursor movement.
<leader>f{char}
🄽 - move to a single {char}.<leader>s{char}{char}
🄽 - move to consequent two {char}{char}.<leader>w
🄽 - move to word.<leader>l
🄽 - move to line.
Support by vim-easymotion(switched to hop.nvim on neovim 0.5+).
Word Movement
Better word movement enhancement.
W
🄽 - move forward to a single word.B
🄽 - move backward to a single word.E
🄽 - move forward to the end of a single word.gE
🄽 - move backward to the end of a single word.
Support by vim-wordmotion.
Fast Repeat
Enhancement for .
operation.
Support by vim-repeat.
Fast Quotes Operation
Enhancement for add/remove quotes operation.
Support by vim-surround
Match Brackets and HTML Tags
Enhancement for brackets(pairs) and html tags.
Support by vim-matchup.
Auto Close Brackets and HTML Tags
Enhancement for auto close brackets(pairs) and html tags.
Support by auto-pairs (switched to nvim-autopairs on neovim 0.5+) and vim-closetag.
Easy Comment
gcc
🄽 - toggle(comment/uncomment) current line.gc
🅅 - toggle(comment/uncomment) visual selected blocks.gc{motion}
🄽 - toggle(comment/uncomment) from current line with motion such as jkhl.gc<Count>{motion}
🄽 - toggle(comment/uncomment) from current line with Count motion repeat.
Support by tcomment_vim.
Customization
Please add more settings in ~/.vim/setting.vim and ~/.vim/coc-settings.json.
Embeded Language Servers
These language servers are installed by default:
- c/c++
- python3 (python2 is not supported)
- rust
- go
- html/xml/markdown
- css/sass/scss/less
- json
- javascript/typescript/jsx/tsx
Reference
- Nerd font cheat sheet: https://www.nerdfonts.com/cheat-sheet
- IDE-like defaults for neovim: LunarVim
- Color Schemes:
- solarized
- monokai
- dracula
- neodark
- srcery
- palenight
- onedark
- code-dark
- rigel
- base16
- jellybeans
- edge
- gruvbox-material
- everforest
- sonokai
- nightfox
- material
- tokyonight (Only on neovim 0.5+)
- github (Only on neovim 0.5+)
- kanagawa (Only on neovim 0.6+)
Contribute
Please open issue/PR for anything about lin.vim.
Like lin.vim? Consider
Or