This is just a repo that stores my nvim configuration
TODO: update this for use with Lazy.
- Install
diffview
: https://github.com/sindrets/diffview.nvim?tab=readme-ov-file
NEORG_ENVIRONMENT= HOME | WORK
Sets default workspace when using :Neorg workspace
with no specific
workspace specified.
Neovim rust setup and guide
-
https://rsdlt.github.io/posts/rust-nvim-ide-guide-walkthrough-development-debug/
-
[window options]{https://github.com/neovim/neovim/issues/24397#issuecomment-1650700549}
See lazyvim github for uninstall instructions.
You can also delete directories via,
rm -rf ~/.local/share/nvim
rm -rf ~/.cache/nvim
rm -rf ~/.local/state/nvim
or move them instead (backups),
mv ~/.local/share/nvim{,.bak}
mv ~/.cache/nvim{,.bak}
mv ~/.local/state/nvim{,.bak}
These can be found at:
cd ~/.local/state/nvim/swap/
- Yarn
npm install --global yarn
- Luarocks
brew install luarocks
- Stylua
brew install stylua
Alternatively Mason should install it for you.
Add mason/bin
to your $PATH
environment variable. This is to enable
finding executables installed by Mason.
# .zprofile
# Neovim Mason bin directory
export PATH="$HOME/.local/share/nvim/mason/bin:$PATH"
For this plugin to work (especially with rust) you should install the universal ctags
binary. It conflicts with exuberant ctags and
https://github.com/universal-ctags/homebrew-universal-ctags
see wiki for how to set this up.
Note that if you have exuberant-ctags etc installed, this conflicts with
universal-ctags, since installing universal-ctags creates / aliases $(brew --prefix)/bin/ctags
.
brew uninstall ctags
brew install universal-ctags
https://www.nerdfonts.com/font-downloads
brew tap homebrew/cask-fonts && \
brew install --cask font-inconsolata-nerd-font && \
brew install --cask font-inconsolata-lgc-nerd-font && \
brew install --cask font-roboto-mono-nerd-font && \
brew install --cask font-droid-sans-mono-nerd-font && \
brew install --cask font-hack-nerd-font && \
brew install --cask font-jetbrains-mono-nerd-font
The required version of these fonts is at least v3.x.x for nerd fonts. Check your version in brew or just do a greedy update:
brew upgrade --cask --greedy
on MacOS, you will get compilation errors if using the default gcc or clang. You will need to install the brew gcc
brew install gcc
However, the above installed gcc binaries have versions as suffixes, i.e. gcc-13
.
What you thus need to do is create symlinks that don't have these versions as suffixes.
ln -s $(brew --prefix)/bin/gcc-13 $(brew --prefix)/bin/gcc
Also ensure to update the CC
environment variable to point to your symlinked gcc.
# zprofile.sh
export CC=$(brew --prefix)/bin/gcc
All the above will enable neorg to install correctly, you can test this via manually running the treesitter grammer via:
nvim -c "TSInstallSync norg"
see :help copilot
for further information.
Requires node >= v18
other resources:
- Main github copilot repo but community also mentions the pure lua version found here
- Copilot completion
- https://tamerlan.dev/setting-up-copilot-in-neovim-with-sane-settings/
- CopilotChat
- Copilot lualine status symbol
- Learn copilot prompts
Commands
:CopilotChat <input>? - Open chat window with optional input
:CopilotChatOpen - Open chat window
:CopilotChatClose - Close chat window
:CopilotChatToggle - Toggle chat window
:CopilotChatStop - Stop current copilot output
:CopilotChatReset - Reset chat window
:CopilotChatSave <name>? - Save chat history to file
:CopilotChatLoad <name>? - Load chat history from file
:CopilotChatDebugInfo - Show debug information
Commands coming from default prompts
:CopilotChatExplain - Write an explanation for the active selection as paragraphs of text
:CopilotChatReview - Review the selected code
:CopilotChatFix - There is a problem in this code. Rewrite the code to show it with the bug fixed
:CopilotChatOptimize - Optimize the selected code to improve performance and readablilty
:CopilotChatDocs - Please add documentation comment for the selection
:CopilotChatTests - Please generate tests for my code
:CopilotChatFixDiagnostic - Please assist with the following diagnostic issue in file
:CopilotChatCommit - Write commit message for the change with commitizen convention
:CopilotChatCommitStaged - Write commit message for the change with commitizen convention
This is a package manager that is used for managing various development tools: it can be installed and managed via Lazy. Development tools can include LSP servers, which perform static analysis on the code sent into it by an LSP client.
Neovim natively supports LSP clients, and provides a framework called vim.lsp for developing LSP clients to communicate with an LSP server. nvim-lspconfig is simply a pluging that holds the configurations for the neovim lsp client to communicate with various lsp servers. The key word, as highlighted, is that it is configuring the inbuilt native lsp client to communicate with specific lsp servers: it is not the nvim lsp client itself!
So we have mason that can install various LSP servers, Neovim with an in-built LSP client for communicating with a server and finally, nvim-lspconfig for actually holding configurations for how the inbuilt LSP client can be configured to communicate with a specific LSP server. mason-lspconfig acts as a bridge between mason and nvim-lspconfig. It says "Hey! nvim-lspconfig has been configured to communicate with the rust-analyzer lsp server! lets use mason to ensure this server is installed, if it is not installed, we can install it with mason!".
now mason might have a package name for a given server, and then lspconfig will have a config for a given server. The names between of the actual server may differ between the lspconfig server name and the mason package name for the server to be installed / communicated with. mason-lspconfig will translate between the server names provided by lspconfig to the mason package names (e.g. sumneko_lua <-> lua-language-server = lspconfig name <-> mason package name)
In the api's that mason-lspconfig uses, you should specifiy configurations against an lsp cient config or lsp server using the lspconfig name, not the mason package name.
:h mason-lspconfig-automatic-server-setup
:h mason-lspconfig-settings
:h mason-lspconfig-server-map
General helpful guidance.
You can find the filetype ("dapui_watches", "dapui_breakpoints", etc.) by
moving the cursor to the window in question and running :echo &ft
Move your cursor under the text you want to alter the
highlight. Enter command mode and use :Inspect
to get the
name of group.
e.g.
:Inspect
# Output
Treesitter
- @spell.norg links to @spell norg
- @neorg.markup.italic.norg links to @markup.italic norg
- @neorg.markup.italic.norg links to @markup.italic norg
group name = @neorg.markup.italic.norg highlight group linked to = @markup.italic
So if we want to create a new highlight group we can use the following:
vim.cmd([[ highlight NeorgVerbatim guifg=cyan ]])
Above creates a highlight grouped called NeorgVerbatim
.
we now need to link the group to it
vim.cmd([[
autocmd FileType norg
highlight link @neorg.markup.verbatim.norg NeorgVerbatim
]])
Above creates an autocommand triggered on entering a norg
file. The autocommand will then call the following command,
:highlight link @neorg.markup.verbatim.norg NeorgVerbatim
sometimes sessions are corrupted, and while there might be better ways of resolving this;
for now the best way is to just delete sessions found in ~/.local/share/nvim/sessions/
rust-analyzer only supports the stable
toolchain. If you have an override in
place from using rustup default <some-non-stable-toolchain>
then it will fail
to understand the rust source. See docs
link below for further information.
The only way I know to fix this is to explicitly set the below environment variable
$ RUSTUP_TOOLCHAIN=stable nvim