ae23d7bf98122fb2d92cce2afa9ac04ea33052ba
[wiki.git] / Nwiz
1 == nwiz, the code editor for a more civilized era ==
2
3 === What's this? ===
4
5 Neovim has no shortage of powerful plugins for programmers, but it's a fast moving ecosystem.
6 Picking the right combination of plugins and configuring them as an integrated development
7 environment is still far from trivial. I also reviewed a number of GUIs and "super plugins"
8 which aim to be a complete IDE, but all of them had maturity and usability issues.
9
10 My goal is using Neovim as a productive and unintrusive IDE for C, C++, Rust and Python.
11 I curated a short list of well-maintained plugins that take advantage of Neovim's built-in
12 IDE components:
13
14  * Language Server Protocol, for semantic completion
15  * Treesitter, for semantic syntax highlighting
16  * Virtual text, for inline diagnostics
17  * Floating windows, for inline help and function parameter assistance
18
19 The plugin ecosystem is still maturing, but over time the amount of Lua scripting required
20 to piece together a functional IDE seems to be going down. Ideally, you wouldn't have
21 to learn Lua to edit your Neovim config.
22
23 ** I want a programmer's editor, not to become an editor's programmer! **
24
25 {{nvim-completion.png | maxwidth=800}}
26
27
28 === Features ===
29
30  * Quickly open files with fuzzy search
31  * Semantic completion
32    * Configures language servers for C/C++, Rust, Python
33    * Adding more languages made easy by lspconfig
34  * Inline diagnostics and hints
35
36
37 === Installation ===
38
39 To get started, download nwiz.lua to Neovim's plugin dir so it will be autoloaded at startup:
40
41 {{{
42  curl https://codewiz.org/pub/dotfiles/nwiz.lua -o ~/.config/nvim/plugin/nwiz.lua
43 }}}
44
45 Everything is in a single file for ease of installation and to remind me to keep it short and simple.
46
47 I'm also sharing my generic .vimrc, which doesn't use Lua and works with both Neovim and Vim 9:
48
49 {{{
50  curl https://codewiz.org/pub/dotfiles/vimrc
51 }}}
52
53 Rather than overwrite your existing ##~./vimrc##, you might want to review and take some of my settings
54 for syntax highlighting and smart indentation.
55
56
57 === Packer ====
58
59 On first run, Packer (the plugin manager) will bootstrap itself and install all plugins.
60 There's a good chance this will fail the first time due to the asynchronous nature of PackerSync
61 (patches welcome!)
62
63 Any time you edit the list of plugins, run ##:PackerSync## to install, uninstall & update them. Easy!
64
65 === Language Servers ===
66
67 Neovim 0.7 comes with a built-in LSP client. The official [[https://github.com/neovim/nvim-lspconfig | nvim-lspconfig]]
68 plugin abstracts the details of spawning the correct Language Server for a multitude of filetypes.
69
70 Download and installation of language servers can be managed automatically by
71 [[https://github.com/williamboman/nvim-lsp-installer | nvim-lsp-installer]], but I find that it's
72 simpler (and much safer!) to install the already packaged ones from Linux distro. This also ensures
73 that they stay aligned with the system toolchain.
74
75  * Rust: rust-analyzer
76  * C++: clangd
77  * Python: python-lsp-server (which uses mypy, pylint, autopep8...)
78
79 === Treesitter syntax parsers ===
80
81 Install the ones you like from this list: https://github.com/nvim-treesitter/nvim-treesitter#supported-languages
82
83 For instance, I installed these:
84
85 {{{
86 :TSInstall cpp rust lua python bash vim
87 }}}
88
89 You can refresh your parsers at any time with ##:TSUpdate##
90
91 === Semantic completion ===
92
93 Just press TAB!
94
95 TODO: docs for [[https://github.com/hrsh7th/nvim-cmp#readme | cmp-nvim]]
96
97
98 === Finding and opening files ===
99
100 TODO: docs for [[https://github.com/nvim-telescope/telescope.nvim | telescope.nvim]]
101
102 === Realtime diagnostics and hints ===
103
104 TODO: document