My Neovim Config

2025-02-08

My Neovim Config: Plugins, Keybindings, and Tweaks

Recently, I realised that I haven’t really touch my Neovim configuration in over a year. The biggest change I made was removing Copilot from my plugins. Comparing that to when I started using vim back in 2021 I couldn’t help but update my config daily. Now that my configuration is somewhat stable, I thought I’d share an overview of plugins, keybindings, and tweaks I’ve implemented. Hopefully, you’ll find something useful to implement into your own configuration.

Preview

As you can see I think we can agree that I like to keep my configuration minimal. I try to keep my plugin count low, currently using 10 excluding dependencies. For example I’m a fan of using fzf to navigate my files rather than using anything like NERDTree, but if I do want to manually navigate files I’ll just use netrw.

If you aren’t interested in reading this post and just want to check out my dotfiles here is the repo, you’ll find all the files relating to my neovim config in the nvim directory. I’ll assume if you haven’t ran off you’re interested in my opinions, I’m only going to cover things I think are important else we’ll be here all day. The topics being covered are: plugins, keybindings, and tweaks.

Plugins

Before I talk about the plugins I think add the most value here is a list of all the plugins I use: git gutter, vim fugitive, vim wiki, catppuccin, dumbtab, tmux navigator, fzf.vim, mason, nvim-cmp, treesitter.

From all the plugins I use I would say fzf.vim, mason, and nvim-cmp are the most important to my workflow. So I am going to only cover those 3 in this section, that doesn’t mean I think the other plugins aren’t worth talking about. Just that they don’t add as much value, plus I’m not trying to make this post into an essay…

I really think people should use some sort of fuzzy finding in there work flow, nothing is more painful than seeing someone struggle to find a file. For me I feel that fzf.vim helps to add this feature into neovim, I know a lot of neovim purist would be disgusted that the plugin is written in vim script. But it works and it works well, if you prefer some other fuzzy finding tool use that; all I recommend is you use fuzzy finding as it is a massive productivity boost.

Some of you may be wondering why don’t I use telescope, I just find that fzf felt faster when using. Admittedly, this was back in 2023, so take it with a grain of salt. Now if you do decide to use fzf.vim there are some cli tools I recommend installing which are: fzf, ripgrep. The reason for both of the cli tools are: fzf allows me to search over my files, while ripgrep allows me to search inside of my files. I find this combo to be more than enough, here are the keybindings I use with fzf.vim:

-- fzf key mappings
vim.keymap.set('n', '<leader>g', ':Rg<CR>')
vim.keymap.set('n', '<leader>f', ':GFiles<CR>')
vim.keymap.set('n', 'ff', ':Files<CR>')
vim.keymap.set('n', 'gs', ':GFiles?<CR>')

The next plugin I use daily is mason which is how I manage my LSPs. With mason here are the dependencies I install to make it all work: lsp config, mason lsp config. I find this setup pretty easy to manage and have been very happy using since migrating over from Conquer of Completion.

If you aren’t using neovim and just vim I would recommend checking out Conquer of Completion, as coding without an LSP is pretty painful. With my lsp I keep the keybindings quite minimal, with only having the following set: go to definition, go to references, and hover being setup. This is what they look like in my config:

-- Configure key mappings for LSP
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, {})
vim.keymap.set('n', 'gr', vim.lsp.buf.references, {})
vim.keymap.set('n', 'K', vim.lsp.buf.hover, {})

In terms of my setup with the LSP I find using nvim-cmp makes the whole process feel seamless, nvim-cmp is a completion engine which enables for autocompletion. Basically it helps to unlock the full potential of using LSPs in your config.

If I were to write my config again I would probably only install fzf.vim, mason, and nvim-cmp. Then only adding other plugins when I hit pain points in my work flow, I know it is tempting to install loads of other plugins; but I feel that its only going to slow you down in the long run.

Keybindings

Now moving on to some of my favourite keybindings I use, just to note I set space as my leader key because I find this most comfortable. So with out anything further to do here are some of my favourite bindings:

-- Standard key mappings
vim.keymap.set('n', '-', ':Ex<CR>')
vim.keymap.set('n', '<leader>s', function() vim.o.spell = not vim.o.spell end)
vim.keymap.set('n', '<leader>r', [[:%s/<C-r><C-w>//g<Left><Left>]])
vim.keymap.set('n', '<C-f>', '<cmd>silent !tmux neww tmux-sessioniser<CR>')

The first keybinding I use is setting hyphen to get me into netrw, this is when I don’t use fzf.vim to navigate the file system.

I set leader s to toggle spelling on and off, as when I am writing markdown I like to have a spell checker enabled. I find this a pretty straight forward solution. But somehow I still manage to add typos…

Next is how I do find and replace in a file which is set to leader r, it is pretty useful to be fair. Now I don’t need to remember the command. I used to forget it all the time, blame it on the brain rot.

Lastly probably my favourite keybinding is Ctrl-f which runs a script called tmux-sessioniser, if you’re interested in how this works I wrote a post outlining what it is and how it works.

Tweaks

Lastly I’m going to cover some tweaks which helps to make my neovim experience a lot better. These are just some standard settings which I like to set. I’m only going to highlight a select few, as I’m sure you aren’t interested in every setting I have configured and why.

-- Standard settings
vim.o.laststatus = 0
vim.g.netrw_banner = 0
vim.opt.colorcolumn = '80'
vim.opt.clipboard:append("unnamedplus")

The first one is to hide the status bar, I know that a lot of people love having this showing and use lualine.nvim to style it. For me I’ve always thought this isn’t that useful, perhaps it is because I like a minimal look.

Next I set the banner to be off for netrw as it is ugly! I don’t know why they have it on by default. It kinda reminds be of entering nano and having all the commands plastered all over the place.

I set colorcolumn enabled and to 80 chars. You might think why would someone want to have a random line down there screen right? Well there is some thought behind it, basically if my code is overlapping this line it is a sign I’ve probably nested too much in one function. When this happens it is usually time for a refactor.

The last setting enables me to copy directly to my clipboard. It makes it very easy to copy something from my editor and paste it in other applications. I feel like this should just be enabled by default, as it is very useful.

Closing thoughts

Now I’ve gone over some of my favourite features, I hope this has inspired you to create or improve your own config. If you are interested here is a link to my dotfiles. I hope you learned a thing or two from the features I have enabled, or at the very least found it an interesting read.

Thanks, Nathan.

To keep up with my latest content subscribe to my RSS feed