Neovim comes with lots of useful plugins, and built-in features, compared to Vim. It’s lua configs is also much more readable and powerful compared to Vim. Here’s some useful tips for coding in Nvim.
Searching(files, text, diagnostics, help) # Similar to techniques mentioned in search-in-vim, we can search for text inside files, or looking for files by filtering filenames. In Neovim, we use fzf-lua which is very similar to fzf.vim.
搜索是开发中最常用也是最重要的操作之一. Vim提供了非常高效和方便的搜索功能. 这篇笔记记录了一些常用的搜索命令,例子以及自定义的key mapping
使用ripgrep搜索文件内容 (:Rg2 or ,gg, ,gw/,gW ) 使用git-grep搜索git branch/commit, 以及使用fzf显示git grep的结果 (:Ggrep) 使用fzf/coc list搜索当前文件/buffers中的lines, 实现快速定位/跳转 使用quickfix lists快速访问上述搜索的结果, 以及利用:cdo/:cfdo等命令对结果进行批量操作. General searching inside files # Ripgrep with fzf # fzf.vim provides a :Rg command to call ripgrep and search the current directory. However, a more useful variant is built to support specify path and pass other parameters to ripgrep, I used this snippet and mapped this to shortcut <Leader>gg.
Search and work with many files # Searching # For searching words / symbols within files, see search-in-vim
To quick find and open files by filename, I use fzf and coc-list, and the follwing key bindings.
General search
To open files in the working directory ( not current file/buffer dir), use :Files or ,lc ( list current)