Neovim Plugins for a Better Coding Experience — Part 3

Let’s continue to improve our coding experience using Neovim.

alpha2phi
6 min readDec 16, 2021

--

Neovim Plugins for a Better Coding Experience

Let’s continue to explore Neovim plugins that can improve our coding experience.

This article can be read independently from the other related articles.

Better Status Line with Context

nvim-gps is a simple status line component that shows the context of the current cursor position in the file. It integrates seamlessly with your existing status line components like feline, galaxyline, lualine, and windline. You can also integrate it just by using Vimscript or Lua functions.

It is similar to the status line function provided by nvim-treesitter but smarter. Using custom treesitter queries for each language, nvim-gps is able to show the exact name of containing class, struct, function, method, etc. along with some fancy symbols!

To install it using packer.nvim,

use {
"SmiteshP/nvim-gps",
config = function()
require("nvim-gps").setup()
end,
}

I use lualine. In my lua/config/lualine.lua file, I only need to add the following lines.

local gps = require "nvim-gps"ins_left {
gps.get_location,
cond = gps.is_available,
}

More details on how to configure it for different status line components can be found in the documentation.

You can check out my configuration using lualine here.

Now as I navigate my source code, I can see the current context, e.g. classes, functions, methods, etc.

nvim-gps in Action

nvim-gps is deprecated. Check out this article to use nvim-navic to display the current code context.

--

--

alpha2phi

Software engineer, Data Science and ML practitioner.