If you are reading this document using
:TheovimReadme, use:MarkdownPreviewToggleto render the contents in your browser.
Theovim is my Neovim configuration, geared toward my CS studies (C, Python, Java, LaTeX, LaTeX, and LaTeX). It features opinionated base Vim settings and keybindings, ~30 carefully selected plug-ins, and custom UI components written 100% in Lua.
The philosophies I stick to when I configure Neovim are:
- Prefer Neovim API and Lua over plug-ins
- When you use a plug-in, keep the stock configuration as much as possible. The author knows more about the plug-in than you do
- Always comment on the code!
- Avoid duplicate keybindings and features
- 10 keybindings you can memorize are better than 50 complicated keybindings
- Keep things minimal
I don't advise using this repository as your personal config because it contains some opinionated features, and you can learn much about (neo)vim when you configure it yourself.
Instead, you are welcome to fork the repository or read/copy the source code. It contains some of my proud and interesting work, such as:
- No-plug-in core config with memorable keybindings
- TabLine
- Startup Dashboard
- StatusLine and Winbar components
- Notepad, floating term, and custom menu using
vim.ui.select()
I also wrote articles about some of my Neovim config components in my blog.
If you found Theovim helpful, please leave a star!
- A terminal emulator with true color support
- Wezterm is my choice of terminal emulator. It's fast, feature-rich, and configured in Lua
- Kitty, Alacritty, and iTerm 2 for MacOS are great options
- Alternatively, you can use a GUI Neovim client like Neovide
- Neovim version > 0.8.3
- Unfortunately, my school's Debian server uses outdated Neovim, forcing me to use some deprecated APIs and older versions of plug-ins
- These will be indicated in code comments and will be fixed as soon as possible
- Thanks to my friend Shriansh for at least making them upgrade from 0.5 to 0.8
- NerdFonts to render glyphs
npm,g++(gcc-c++), andunzipforbashlsandclangdlanguage servergitto update Theovim
# Optional backup
[[ -e ~/.config/nvim ]] && mv ~/.config/nvim ~/.config/nvim.bak
# Install Theovim files in ~/.config/nvim
git clone --depth 1 https://github.com/theopn/theovim.git ~/.config/nvimFile structure
├── init.lua --> Module initializations
└── lua
│
├── config.lua --> User configuration
├── core.lua --> Core functions (opt and keymaps)
├── misc.lua --> Miscellaneous Theovim features
├── plugins.lua --> Plug-in table, simple setup(), and Lazy bootstrap
├── util.lua --> Utilities for float win, vim.ui.select, etc.
│
├── config
│ └── ... --> Long plug-in setup() functions
│
├── lsp
│ ├── completion.lua --> nvim-cmp and snippet init
│ └── lsp.lua --> Neovim built-in LSP config and other LSP-related features
│
└── ui --> Handmade Theovim UI elements
├── components.lua --> Statusline and Winbar modules
├── dashboard.lua --> Cute startup Dashboard
├── highlights.lua --> Custom highlights used by UI components
├── statusline.lua --> Simple global Statusline
├── tabline.lua --> Clean tabline with buffer and tab info
└── winbar.lua --> Simple Winbar to complement global Statusline
Leader ([LDR]) key is the space bar (SPC).
-
j k(insert): ESC -
[LDR] a: Select [a]ll -
[LDR] /: Clear the last search and search highlights -
Yank and paste:
[LDR] y(visual): Yank to the system clipboard (unnamedplus)[LDR] p(visual): Paste the selection without overriding the default register
[LDR] p(normal): Open a register (similar to clipboard history --:h registers) selection
-
Buffer navigation:
-
Window resizing: Theovim does not offer many window resizing/navigation bindings since Vim already has
C-wkeybindings. Familiarize yourself withC-hjkl,C-w(for navigating to floating windows),C-w =,C-w |, etc.[LDR] +/-: Increase/decrease the current window height by one-third[LDR] >/<: Increase/decrease the current window width by one-third
-
Tab navigation:
[LDR] t: new [t]ab. Create a new tab. Hit enter to make a new tab with the current buffer or type buffer numbers (reference the[LDR] kdemo above)[LDR] q: [q]uit. Close the current tab. (you cannot close the one and only tab. UseC-w qor:q)[LDR] 1-5: Navigate to tab number 1 - 5
-
Overridden keybindings: These are Vim keybindings overridden by Theovim
gx: Open URL in the current line (error notification if no URL found in the current line)- In Vim, this keybinding is provided by
netrw, which is disabled in Theovim for a better file management plug-in
- In Vim, this keybinding is provided by
n/N: Cycle through search results and center the screen- Vim does not center the screen by default
Many of these commands are accessible through [LDR] m keybinding (reference "Miscellaneous Theovim Features" section).
:TrimWhiteSpace: Remove trailing whitespaces:ShowChanges: Show the difference between the saved file and the current Vim buffer:CD: You might launch Vim in~directory and open~/foo/bar/baz/file.txt. Use this command to change the working directory tobaz(to narrow the Telescope search down, etc.). It only affects the current buffer. You can see the CWD and relative file path in the Statusline
-
By default, tab characters are set to 2 spaces. For some filetypes, the value of
tabstopwill change (e.g., Java has a tab width of 4 characters) -
- Tab character : Renders as
⇥ - Two leading spaces (indentation) : Render as
│ - Trailing space : Renders as
␣ - Non-breaking space : Renders as
⍽ - Beginning of a wrapped line : Renders as
↪
- Tab character : Renders as
-
In some filetype,
colorcolumn(highlights a specific column) is enabled based on the language style convention. For example, in C/C++ buffers, the 80th column will be highlighted -
You can override any of the options in
core.luain yourconfig.lua:-- Example of overriding options in config.lua vim.opt.scrolloff = 10 --> show at least 10 lines above/below from the current cursor, which is 7 lines by default vim.opt.confirm = false --> turn off confirm prompt when quitting with unsaved buffer, which is on by default
-
English spell check is supported via the Vim built-in spell check feature. Use the
:h spellfor more information -
Spell check is enabled by default in text filetypes (
*.txt,*.md,*.tex, etc.).- You can turn spell check on in other buffers using the toggle keybinding
-
C-s: [s]pell- (insert): Fix the nearest spelling error and put the cursor back
- (normal): Bring up spell suggestions for the word under the cursor
-
[LDR] s t: [s]pell [t]oggle. Toggle spell check
[LDR] z: [z]sh. Prompts you for the location to launch a new terminal window (bottom, left, or right third, floating, new tab)- Theovim uses Neovims built-in terminal emulator. For more information,
:h terminal - There are autocmd to:
- Automatically start the insert mode when terminal buffers open. Use
ESCto escape to the normal mode - Closes the terminal if the exit code is 0. Otherwise, you will get a notification, and the terminal window will persist until you hit enter
- Automatically start the insert mode when terminal buffers open. Use
When Winbar says you have an LSP server running in the buffer, you are in for a treat! Theovim uses the Neovim built-in LSP to provide modern IDE features.
The following keybindings are enabled when an LSP server is active in the current buffer:
[LDR] c d: [c]ode [d]oc. Open a hover doc for the cursor item[LDR] c r: [c]ode [r]name. Rename the cursor item[LDR] c e: [c]ode [e]rror. List diagnostics in the current buffer[LDR] c p: [c]ode [p]rev. Navigate to the previous diagnostics[LDR] c n: [c]ode [n]ext. Navigate to the next diagnostics[LDR] c a: [c]ode [a]ll. Open the menu for other LSP features
Following features are accessible through [LDR] c a:
- Code action: Get a suggestion menu for LSP diagnostics
- References: See where the variable/function under the cursor was used
- Symbols: List all variables, functions, and other components that the LSP server detects for a quick navigation
- To stop LSP server, use
:LspStop
Many LSP servers detect information from your code as well as system-wide libraries and project files in the same directory. If the LSP doesn't work as you wish, consult the LSP server documentation.
Whenever an LSP server detects an error or has a suggestion for your code, Theovim will display the diagnostics status in your Winbar. Four types of diagnostics are: "Error", "Warning", "Hint", and "Info". For example, the below image is the clangd LSP server displaying warnings and an error for my C code.
You can get a list of current buffer diagnostics using [LDR] c e. You can navigate to the nearest diagnostics using [LDR] c p/n.
Theovim offers completion engines for LSP buffers as well as general text editing.
C-j/k: Scroll through completion itemsTAB/S-TAB: Scroll through completion itemsRET: Confirm the selection- Or, once a completion item gets rendered on screen using
TAByou can continue typing without hittingRET
- Or, once a completion item gets rendered on screen using
C-[/]: Scroll through completion documentationC-e: Close the completion windowC-n: Manually open the completion menu
The order of completion item detection:
There is also a Vim command line completion.
- Linter is available for some buffers when LSP servers provide formatting (
vim.lsp.buf.format()) - You can track the status of Linter in the Statusline component (reference the "Built-in UI" section below).
- When Linter is on, it will format the code every time you save. You can turn this off using
:LspLinterToggle LspLinterToggleis a global option, meaning if you turn on/off Linter, it applies to all buffers- It also does not have a memory, meaning when you turn Linter off and relaunch Neovim, it will be on again
- To disable Linter by default, add the following line to
config.luavim.g.linter_status = false ```
- Theovim automatically installs bashls, clangd, lua_ls, pylsp, and texlab
- Browse
:Masonor nvim-lspconfig server list for available LSP servers. Use:MasonInstall <lsp-name>and:MasonUninstall <lsp-name>commands to install/uninstall LSP server
Telescope is an awesome fuzzy finder for Neovim.
[LDR] ?: Help. Open keymap fuzzy finder[LDR] f b: [f]uzzy [b]rowser. File browser in the fuzzy finder form. It's useful when you want to navigate to the parent directory[LDR] f f: [f]uzzy [f]iles. Fuzzy finder for files in the current directory and subdirectories. Optionally, install fd for better performance,.gitignoresupport, and other fd features.[LDR] f r: [f]uzzy [r]ecent. Open recent file fuzzy finder[LDR] f /: [f]uzzy [/]search. Open fuzzy finder for current buffer words[LDR] f a: [f]uzzy [a]ll. Open the menu for other Telescope features
Following features are accessible through [LDR] f a:
-
Search history
-
Command history
-
Commands (all available commands)
-
Help tags (Vim built-in help documentation)
-
Colorschemes
-
C-j/korC-n/p: Scroll Telescope items -
C-d/u: Scroll Telescope preview window -
C-cor<ESC> <ESC>: Close Telescope -
<RET>: Confirm Telescope selection
:Notepad opens a tiny, semi-transparent floating window in the top right corner. Here, you can write quick notes for your current Neovim sessions. As the Notepad warning suggests, the contents of the Notepad will persist until you close the current Vim session.
- Use
:w file-name.mdto save the current Notepad contents q/<ESC>: Hides the Notepad window- Using
:qto close the Notepad messes up the closing mechanism
- Using
When Neovim launches with no argument, you will be greeted with a Dashboard containing a randomly selected ASCII art of my cat Oliver. For the ASCII arts credit, please read the comments in dashboard.lua.
jkor left/right arrow: navigate the Dashboard buttons<RET>: Confirm button selection- You can navigate to other parts of the Dashboard using a mouse or other navigation keys. However, the buffer is unmodifiable and will not function unless the cursor is on one of the buttons.
jkwill take you to the first or last button if the cursor is out-of-place
Theovim's TabLine improves the built-in Vim tab system with tab number, modified indicator, and number of tabs and buffers.
- Tab title displays current buffer file name as long as there is one
- Number of windows includes floating windows or windows for unlisted buffers (e.g.,
:Notepadscratch buffer, file tree, help, etc.) - Number of buffers does not include unlisted buffers
Winbar components:
- File name
- Modified ([+]) or read-only ([-])
- LSP server name (if an LSP server is active)
- LSP diagnostics information (if an LSP server is active)
| filename.c[+] LSP: server_name E:5 W:1 HINT:4 INFO:5 |
StatusLine components:
- Current mode
- Current working directory
- File path and name relative to the CWD
- Git branch and lines changed
- Linter status (if an LSP server is active)
- Filetype
- File format (UNIX or DOS icon)
- Current line and column number + percentage through file of displayed window
| N | CWD foo/bar.c[+] branch +13 ~20 -36 Linter ON FILETYPE file_format:encoding line:col page_percentage
:MarkdownPreviewToggle: Toggle GitHub-style real-time markdown preview in your default browser:VimtexCompile: Toggle LaTeX compile and real-time preview on buffer save. You should specify and prepare the PDF viewer of your choice inconfig.lua. Currently, Skim (for MacOS) or Zathura for Linux/MacOS are supportedvim.g.vimtex_view_method = "skim" --> or "zathura"
[LDR] n: Togglenvim-tree
-
[LDR] g: [g]it Menu for Git-related functionalities (status, diff, commits, etc.) -
[LDR] m: misc. Menu for miscellaneous Theovim features -
:TheovimUpdateupdates the latest changes to Theovim by pulling the changes and running update utilities -
:TheovimReadme: Opens this document in a floating window -
:TheovimChangelog: View the current version information and latest changes -
:TheovimChangelogHistory: View the historic changelogs










