Before starting the discussion, go through the following three questions:
With vim,
- How do you search a string / file in a project? Could you quickly switch between the search results?
- How do you compile a project? Could you do it with one shortcut and jump to the exact position where error occurs?
- How do you rename a variable? What if there is another variable with the same name in the project?
LeaderF, AsyncTask and coc.nvim solve the above three problems correspondingly.
LeaderF for searching
LeaderF does almost all the things related to search.
Here're its subcommands:
file search files
tag navigate tags using the tags file
function navigate functions or methods in the buffer
mru search most recently used files
searchHistory execute the search command in the history
cmdHistory execute the command in the history
help navigate the help tags
line search a line in the buffer
colorscheme switch between colorschemes
gtags navigate tags using the gtags
self execute the commands of itself
bufTag navigate tags in the buffer
buffer search buffers
rg grep using rg
filetype navigate the filetype
command execute built-in/user-defined Ex commands.
window search windows.
quickfix navigate the quickfix.
loclist navigate the location list.
Plus, it also auto-update gtags in the background, which means you don't need another plug-in like vim-gutentags. LeaderF supports fuzzy search with high speed. The navigating subcommands will trigger a display list of corresponding items. Jump through the search results is convenient.
AsyncTask for Compilation
If you prefer to run the compiling / running commands within vim, AsyncTask is a good resolution. AsyncTask simplifies the configuration for you, so that you don't need to write vim script to map the shortcuts depending on the filetype from scratch. It also supports project-specific compiling / running configuration.
coc.nvim as LSP Client
One thing that vim was often criticized before was that compared to IDE, it did not really understand the code. Instead, many of functions of vim(or its plug-ins) just based on text matching, so operations such as renaming the variables would be painful in vim, since vim couldn't distinguish variables in different scopes.
However, with the help of Language Support Protocol(LSP), vim can understand the real meaning of code, and operations such as renaming variables, jumping to definitions and searching references work much better.
coc.nvim could be used as a handy client of LSP. There're also plug-ins like coc-python, which help you set configuration with corresponding LSP server. The "coc" plug-in family also introduce some fancy features from vs-code to vim, for example, completion of snippets(coc-snippets) and so on.
Check LSP server to see the supporting features. e.g. For python with jedi server & coc-python ,
- IDE-like features
- Automatic indenting
- Code navigation ("Go to", "Find all" references)
- Code definition (Peek and hover definition, View signatures)
- Rename refactoring
- Sorting import statements (use the
Python: Sort Imports
command)
- Intellisense and autocomplete (including PEP 484 and PEP 526 support)
- Ability to include custom module paths (e.g. include paths for libraries like Google App Engine, etc.; use the setting
python.autoComplete.extraPaths = []
)
- Ability to include custom module paths (e.g. include paths for libraries like Google App Engine, etc.; use the setting
- Code formatting
- Linting
- Support for multiple linters with custom settings (default is Pylint, but Prospector, Flake8, pylama, pydocstyle, and mypy are also supported)
- Snippets
- Miscellaneous
- Running a file or selected text in python terminal
- Automatic activation of environments in the terminal
- Refactoring
- Rename refactorings
- Extract variable refactorings
- Extract method refactorings
- Sort imports
For vim8, git submodule is good enough. No extra plug-in manager is needed. With git submodule, you can enjoy the benefits of normal git, such as roll back the plug-in repo to a specific commit. It would also be nice if you backup your .vim
folder in the github. Everything works in a natural way.