Skip to content

Commit 66dba6a

Browse files
basics: refactor tools page
1 parent 72ab01a commit 66dba6a

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
- clojure: refactor namespace with Clojure LSp via command line
2929
- basics: navigate git hunks with gitsigns key mappings
3030
- clojure: add parinfer paragraph to structural editing page
31+
- basics: refactor tools page
3132

3233
### Changed
3334
- ci: spell lychee & repository trufflehog linters warn only (false positives)

docs/neovim-basics/refactor.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Refactor
2+
3+
Neovim has several built-in tools for general refactor and debugging.
4+
5+
Most languages are suppored by an LSP server which provides common refactor tools across editors (when the server is fully implemented).
6+
7+
8+
## Language Server Protocol
9+
10+
Neovim provides a Language Server Protocol (LSP) client that uses a language specific LSP server to provides code refactoring features using semantic analysis of the current project.
11+
12+
- find-references
13+
- rename
14+
- code actions (convert to function, let, etc)
15+
16+
17+
# Search and Replace in Multiple Buffers
18+
19+
There are multiple ways to search and replace a pattern in multiple buffers. We can use the commands listed below to search and replace a pattern in multiple buffers.
20+
21+
- `:argdo` — command for each file in the argument list
22+
- `:bufdo` — command in each buffer in the buffer list
23+
- `:tabdo` — command in each tab page
24+
- `:windo` — command in each window
25+
- `:cdo` — entry in the quickfix list
26+
- `:cfdo` — file in the quickfix list
27+
28+
29+
## Quickfix
30+
31+
Quickfix mode is used to speedup the edit-compile-edit cycle by saving error messages in a file that is then used to jump to relevant places in the code base.
32+
33+
This allow addressing all of the errors generated without having to remember each and every error.
34+
35+
Any generated list of position in a file can be used by Quickfix for more general editing speedups.
36+
37+
> NOTE: Commonly used quickfix commands: `:cclose`, `:cnext`, `:copen`, `:grep`, `:make`
38+
39+
Quickfix commands to try:
40+
41+
- `:copen` opens the quickfix window
42+
- `:cclose` or `:ccl` closes quickfix window
43+
- `:cw` open it if there are "errors", close it otherwise
44+
- `:cn` Go to the next error in the window
45+
- `:cp` Go to the previous error in the window
46+
- `:cnf` Go to the first error in the next file
47+
- `:.cc` Go to error under cursor (if cursor is in quickfix window)
48+
49+
50+
[Quickfix - Neovim docs](https://neovim.io/doc/user/quickfix.html){target=_blank .md-button}

0 commit comments

Comments
 (0)