Awesome
<h1 align="center">nvim-config</h1> <p align="center"> <b>Just another opinionated, visually appealing Neovim IDE.</b> <br /> <b>Configured for Windows, supports LaTeX, Python, Lua, C#, HTML, CSS, and Javascript.</b> <br /> <br /> <a href="https://github.com/neovim/neovim"> <img src="https://img.shields.io/badge/requires-neovim%200.8%2B-green?color=76946A&labelColor=16161D&style=for-the-badge&logo=neovim" /> </a> <a href="https://github.com/Neelfrost/dotfiles/blob/main/LICENSE" ><img alt="license" src="https://img.shields.io/github/license/Neelfrost/dotfiles?labelColor=151515&color=A270BA&style=for-the-badge" /></a> <a href="https://github.com/Neelfrost/dotfiles/stargazers" ><img alt="stars" src="https://img.shields.io/github/stars/Neelfrost/dotfiles?colorA=151515&colorB=6A9FB5&style=for-the-badge&logo=starship" /></a> <a href="https://github.com/Neelfrost/dotfiles/network/members" ><img alt="forks" src="https://img.shields.io/github/forks/Neelfrost/dotfiles?colorA=151515&colorB=788C4C&style=for-the-badge&logo=github" /></a> </p>Table of Contents <!-- omit in toc -->
Screenshots 📷
Installation âš¡
The following instructions are for Windows (powershell). An admin prompt is required.
-
Install chocolatey.
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
-
Install main dependencies.
choco install -y git.install --params "/GitAndUnixToolsOnPath /NoGitLfs /SChannel /NoShellIntegration"; choco install -y neovim python SumatraPDF.install miktex.install; # Needed for various plugins choco install -y universal-ctags strawberryperl make SQLite ripgrep fd golang; refreshenv; exit
-
Install python dependencies.
pip install pynvim neovim-remote
-
Clone the repository and open nvim-qt or nvim.
For fresh installation:
git clone https://github.com/Neelfrost/nvim-config.git "$HOME\Appdata\Local\nvim"; nvim-qt.exe
For existing config:
ren "$HOME\Appdata\Local\nvim" 'nvim-old'; git clone https://github.com/Neelfrost/nvim-config.git "$HOME\Appdata\Local\nvim"; nvim-qt.exe
LaTeX
Formatting (latexindent)
latexindent is now included with miktex, so downloading it separately is no longer necessary. Moreover, null-ls is pre-configured to run latexindent on save for tex files. Global formatting rules can be changed by:
-
Creating
$HOME/indentconfig.yaml
:paths: - C:\Users\<username>\defaultSettings.yaml
-
Creating
$HOME/defaultSettings.yaml
, followed by copying and overriding defaultSettings.
For further reading refer: docs.
Viewing PDF
To launch SumatraPDF using VimTeX (<kbd>\lv</kbd>), ensure SumatraPDF.exe
is added to environment path.
Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name path -Value $((Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name path).path + ";" + "$HOME\AppData\Local\SumatraPDF" + ";"); refreshenv; exit
Inverse Search
For inverse search, open SumatraPDF then go to Settings -> Options and set inverse search command-line to:
cmd /c start /min nvim --headless -c "PackerLoad vimtex" -c "VimtexInverseSearch %l '%f'"
Use :checkhealth
to check for errors if any.
Language Servers
Python (pyright)
-
Install npm.
choco install -y nodejs.install; refreshenv; exit
-
Install pyright.
npm install -g pyright
-
Install black, isort, and flake for formatting and linting.
pip install flake8 black isort
-
Use
:checkhealth
to check for errors if any.
Lua (LuaLs)
-
Install dependencies.
choco install -y 7zip.install; refreshenv; exit
-
cd into install directory. For example:
cd C:\tools
-
Install LuaLs.
curl.exe -L $(curl.exe -s https://api.github.com/repos/LuaLS/lua-language-server/releases/latest | findstr.exe "win32-x64" | %{"$($_.Split('"')[3])"} | findstr.exe "github") -o luals.zip; 7z.exe x .\luals.zip -olua-language-server; rm luals.zip
-
Add LuaLs to environment path.
Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name path -Value $((Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name path).path + ";" + "C:\tools\lua-language-server\bin" + ";"); refreshenv; exit
-
Install stylua for formatting.
curl.exe -L $(curl.exe -s https://api.github.com/repos/JohnnyMorganz/StyLua/releases/latest | findstr.exe "win64.zip" | %{"$($_.Split('"')[3])"} | findstr.exe "github") -o stylua-win64.zip; 7z.exe x -oC:\tools\stylua .\stylua-win64.zip; rm .\stylua-win64.zip; # Add stylua to environment path: Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name path -Value $((Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name path).path + ";" + "C:\tools\stylua" + ";"); refreshenv; exit
-
Use
:checkhealth
to check for errors if any.
C# (omnisharp)
-
Install dotnet-sdk.
choco install dotnet-sdk -y
-
Install omnisharp-roslyn.
curl.exe -L $(curl.exe -s https://api.github.com/repos/OmniSharp/omnisharp-roslyn/releases/latest | findstr.exe "omnisharp-win-x64-net6.0.zip" | %{"$($_.Split('"')[3])"} | findstr.exe "github") -o omnisharp-win-x64-net6.0.zip; 7z.exe x -oC:\tools\omnisharp .\omnisharp-win-x64-net6.0.zip; rm .\omnisharp-win-x64-net6.0.zip;
-
Use
:checkhealth
to check for errors if any.
HTML, CSS, Javascript (vscode-langservers-extracted)
-
Install dependencies.
npm i -g vscode-langservers-extracted
-
Install prettierd for formatting.
npm i -g @fsouza/prettierd
-
Use
:checkhealth
to check for errors if any.
Update 🚀
-
Pull changes.
cd "$HOME\Appdata\Local\nvim"; git pull
-
Open nvim-qt or nvim and update plugins:
:PackerSync
Features 📃
General
- Smart display line movement.
- Resume cursor position when re-opening a file.
- Auto update file if changed outside of neovim.
- Fix mixed indents (tabs are converted to spaces).
- Persistent cursor positions when switching buffers.
- Ability to search custom directories in telescope.nvim.
- Ability to reload specific modules using telescope.nvim.
- Automatically trim trailing whitespaces and newlines on save.
- Search and replace selection (automatically escape special chars).
- Open windows terminal, vscode, explorer at current directory using <kbd>\\t</kbd>, <kbd>\\c</kbd>, <kbd>\\e</kbd> respectively.
LaTeX
<details> <summary>Compile status on statusline</summary> <figure> <figurecaption>Compile not started</figurecaption> <img src="https://raw.githubusercontent.com/Neelfrost/github-assets/main/dotfiles/l1.webp" alt="Compile not started" /> <figurecaption>Compile running</figurecaption> <img src="https://raw.githubusercontent.com/Neelfrost/github-assets/main/dotfiles/l2.webp" alt="Compile running" /> <figurecaption>Compile success</figurecaption> <img src="https://raw.githubusercontent.com/Neelfrost/github-assets/main/dotfiles/l3.webp" alt="Compile success" /> <figurecaption>Compile failed</figurecaption> <img src="https://raw.githubusercontent.com/Neelfrost/github-assets/main/dotfiles/l4.webp" alt="Compile failed" /> </figure> </details>- Extensive snippets for LaTeX.
- Better auxiliary file cleaner.
- Null-ls: latexindent, chktex support.
- Automatically substitute
\
in imports (include, input) with/
on save. - Keybinds for bold, underline, math, chemical formula environments.
- Start newline with \item (or \task) if inside a list environment when pressing <kbd>Enter</kbd>, <kbd>o</kbd> or <kbd>O</kbd>.
Folder Structure
nvim
├── after
│  └── ftplugin # filetype specific options, settings, mappings
├── lua # .lua config files
│  └── user
│  └── mappings.lua # keybinds
│  └── options.lua # vim options
│  └── utils.lua # utility functions
│  └── plugins
│  ├── config # plugin config
│  └── init.lua # plugin definition file
├── ultisnips # snippets
│  └── tex # latex snippets
└── viml # .vim config files
Plugins
- Plugin manager: lazy.nvim
LSP
- LSP: nvim-lspconfig
- Diagnostics, formatting LSP: null-ls.nvim
- Python language server: pyright
- C# language server: omnisharp
- Lua language server: LuaLs
- HTML, CSS, Javascript language server: (vscode-langservers-extracted)
- Function signature when typing: lsp_signature.nvim
- Refactor functionality: refactoring.nvim
- Backup code formatting: neoformat
File navigation
- File explorer: neo-tree.nvim
- Fuzzy finder: telescope.nvim
- Telescope frecency picker: telescope-frecency.nvim
- Telescope fzf sorter: telescope-fzf-native.nvim
- Telescope ultisnips viewer: telescope-ultisnips.nvim
Code completion
- Code completion: nvim-cmp
- Ultisnips source: cmp-nvim-ultisnips
- LSP source: cmp-nvim-lsp
- Buffer source: cmp-buffer
- Path source: cmp-path
- Cmdline source: cmp-cmdline
- Omni source (for vimtex): cmp-omni
LaTeX
- LaTeX support: vimtex
- Snippet engine: ultisnips
- Tag management: vim-gutentags
Looks
- Theme support: themer.lua
- Indent lines: indent-blankline.nvim
- Thin virtual column: virt-column.nvim
- Icons support: nvim-web-devicons
- Syntax highlighting: nvim-treesitter
- Colored matching brackets: nvim-ts-rainbow2
- Color preview: vim-hexokinase
- Prettier folds: pretty-fold.nvim
Buffer, Status
- Bufferline: cokeline.nvim
- Statusline: heirline.nvim
QOL
- Repeat actions: vim-repeat
- Faster navigation: hop.nvim
- Better quickfix: nvim-pqf
- Aligning: vim-easy-align
- Commenting: nvim-comment
- Toggle booleans & more: alternate-toggler
- Multiple cursors: vim-visual-multi
- Title Case: vim-titlecase
- Start screen: alpha-nvim
- Auto pair brackets: auto-pairs
- Bracket operations: nvim-surround
- Startup time: vim-startuptime
- Fix cursorhold autocmd: FixCursorHold.nvim
- Fast expr folds: FastFold
- Markdown preview: markdown-preview.nvim
- Run commands asynchronously: asyncrun.vim
- Session manager: neovim-session-manager
- Annotation generator: neogen
Mappings
Shortcut | Mode | Description |
---|---|---|
<kbd>F2</kbd> | Normal | Replace word under cursor |
<kbd>F2</kbd> | Visual | Rename selection |
<kbd>F5</kbd> | Normal | Open telescope.nvim module reloader |
<kbd>F10</kbd> | Normal | Toggle spellcheck |
<kbd>F11</kbd> | Normal | Toggle warp |
<kbd>F12</kbd> | Normal | Toggle paste mode |
<kbd>\\t</kbd> | Normal | Open windows terminal at cwd |
<kbd>\\e</kbd> | Normal | Open explorer at cwd |
<kbd>\\c</kbd> | Normal | Open current file in VSCode |
<kbd>\\n</kbd> | Normal | Open current file in notepad |
<kbd>tf</kbd> | Normal | Open telescope.nvim find files |
<kbd>tr</kbd> | Normal | Open telescope.nvim recent files |
<kbd>ts</kbd> | Normal | Open telescope.nvim session browser |
<kbd>\q</kbd> | Normal | Toggle quickfix |
<kbd>\h</kbd> | Normal | Disable search highlight |
<kbd>\v</kbd> | Normal/Insert | Paste from system clipboard in paste mode |
<kbd>\w</kbd> | Normal | Close buffer (will discard changes if not saved) |
<kbd>\u</kbd> | Normal | Open URL under cursor in browser |
<kbd>\s</kbd> | Normal | Search word under cursor in browser |
<kbd>\n</kbd> | Normal | Open dashboard |
<kbd>f</kbd> | Normal | Search buffer using 1 chars |
<kbd>S</kbd> | Normal | Search buffer using 2 chars |
<kbd>Tab</kbd> | Normal | Move to next buffer |
<kbd>Shift Tab</kbd> | Normal | Move to previous buffer |
<kbd>Tab</kbd> | Insert | Expand trigger or jump to next tab stop |
<kbd>Shift Tab</kbd> | Insert | Jump to previous tab stop |
<kbd>Ctrl j(k)</kbd> | Command | Move between completion items |
<kbd>Ctrl j(k)</kbd> | Insert | Move between completion items |
<kbd>Alt d</kbd> | Normal | Duplicate current line below |
<kbd>Alt j(k)</kbd> | Normal/Visual | Move line (block) up or down |
<kbd>Alt ]</kbd> | Normal | Increase indent |
<kbd>Alt [</kbd> | Normal | Decrease indent |
<kbd>Ctrl /</kbd> | Normal/Visual/Insert | Comment current (selected) line(s) |
<kbd>Enter</kbd> | Insert | Select completion item |
<kbd>Ctrl Space</kbd> | Insert | Force completion menu to open |
<kbd>Ctrl c</kbd> | Insert | Force completion menu to close |
<kbd>Ctrl e</kbd> | Insert | Select first completion item |
<kbd>Ctrl t</kbd> | Insert | Open omni-func completion |
<kbd>Ctrl Backspace</kbd> | Insert | Delete previous word |
<kbd>Ctrl Delete</kbd> | Insert | Delete next word |
<kbd>Ctrl b</kbd> | Normal | Toggle nvim-tree |
<kbd>Ctrl f</kbd> | Normal | Format document |
<kbd>Ctrl h(jkl)</kbd> | Normal | Move to window to the left (down, up, right) |
<kbd>Ctrl s</kbd> | Normal | Save current file |
<kbd>Ctrl Shift s</kbd> | Normal | Save and reload module (current file) |
<kbd>Ctrl v</kbd> | Insert | Paste from system clipboard |
<kbd>Ctrl z</kbd> | Insert | Correct preceding misspelt word |
<kbd>Ctrl z</kbd> | Normal | Correct misspelt word under cursor |
<kbd>gD</kbd> | Normal | LSP: Goto function declaration |
<kbd>gi</kbd> | Normal | LSP: Goto function implementation |
<kbd>gh</kbd> | Normal | LSP: Preview documentation |
<kbd>gd</kbd> | Normal | LSP: Preview function definition |
<kbd>gs</kbd> | Normal | LSP: Preview signature help |
<kbd>gr</kbd> | Normal | LSP: Rename instance |
<kbd>gl</kbd> | Normal | LSP: Show line diagnostic |
<kbd>gR</kbd> | Normal | LSP: Show references |
<kbd>ga</kbd> | Normal | LSP: Trigger code action |
<kbd>\li</kbd> | Normal | VimTeX: Info |
<kbd>\lT</kbd> | Normal | VimTeX: TOC toggle |
<kbd>\lq</kbd> | Normal | VimTeX: Log |
<kbd>\lv</kbd> | Normal | VimTeX: View pdf |
<kbd>\lr</kbd> | Normal | VimTeX: Reverse search |
<kbd>\ll</kbd> | Normal | VimTeX: Compile |
<kbd>\lk</kbd> | Normal | VimTeX: Stop |
<kbd>\le</kbd> | Normal | VimTeX: Errors |
<kbd>\lC</kbd> | Normal | VimTeX: Clean full |
<kbd>\lx</kbd> | Normal | VimTeX: Reload |
<kbd>\lX</kbd> | Normal | VimTeX: Reload state |
<kbd>\t</kbd> | Normal | Python, Lua, C#: Run code in external terminal |
<kbd>\r</kbd> | Normal | Python, Lua: Run code without terminal output |
<kbd>\lt</kbd> | Normal | Lua (LÖVE2D): Run game in external terminal |
<kbd>\lr</kbd> | Normal | Lua (LÖVE2D): Run game without terminal output |
Todo ✔
- Improve mappings table
- Document snippets
- Automatic install script
- Create video to showcase snippets