Reformat with mdformat

This commit is contained in:
Daniel McKnight 2025-05-20 22:16:52 -07:00
parent bb43e22845
commit 387b227e5a

View file

@ -1,19 +1,23 @@
--- ______________________________________________________________________
date: 2025-05-20 date: 2025-05-20
title: Exploring Neovim title: Exploring Neovim
tags: tags:
- software - software
- linux - linux
- development - development
---
______________________________________________________________________
I don't know exactly what it was that prompted me to start looking at `vim` and `nvim` I don't know exactly what it was that prompted me to start looking at `vim` and `nvim`
about a week ago, but I ended up down that rabbithole this week. For the uninitiated, about a week ago, but I ended up down that rabbithole this week. For the uninitiated,
[vim](https://en.wikipedia.org/wiki/Vim_(text_editor)) is a modal text editor and [vim](<https://en.wikipedia.org/wiki/Vim_(text_editor)>) is a modal text editor and
[Neovim](https://neovim.io/) is a popular fork. I have no strong opinion regarding vim vs Nvim vs emacs, but I found some [good tutorials for nvim](https://www.youtube.com/playlist?list=PLsz00TDipIffreIaUNk64KxTIkQaGguqn), [Neovim](https://neovim.io/) is a popular fork. I have no strong opinion regarding vim vs Nvim vs emacs, but I found some [good tutorials for nvim](https://www.youtube.com/playlist?list=PLsz00TDipIffreIaUNk64KxTIkQaGguqn),
so Neovim is the editor I chose. so Neovim is the editor I chose.
## Background Information ## Background Information
I have worked as a software developer for more than five years, which begs the question: I have worked as a software developer for more than five years, which begs the question:
what have I been using for a text editor and why am I bothering to write about something what have I been using for a text editor and why am I bothering to write about something
so trivial? Well, I have used [nano](https://www.nano-editor.org/) for the most part when so trivial? Well, I have used [nano](https://www.nano-editor.org/) for the most part when
@ -31,6 +35,7 @@ did include `vim`, but not `nano` and I found myself using `cat` and `sed` to ma
changes just to get online so that I could get `nano` installed. changes just to get online so that I could get `nano` installed.
## Some `nvim` Basics ## Some `nvim` Basics
This post will *not* be a detailed how-to on using `nvim`, bit I feel that I should at This post will *not* be a detailed how-to on using `nvim`, bit I feel that I should at
least cover some basics. Having used `k9s` and `tmux`, I came into this with some least cover some basics. Having used `k9s` and `tmux`, I came into this with some
familiarity typing `:` to get at a command input. I also quickly discovered that familiarity typing `:` to get at a command input. I also quickly discovered that
@ -41,6 +46,7 @@ efficient for keeping your fingers on the right keys. I also noted that `home`,
etc also work in addition to the `vim` navigation using `^` and `$`. etc also work in addition to the `vim` navigation using `^` and `$`.
## Lua Scripts ## Lua Scripts
Beyond basic text editing, the real reason to use `nvim` is Lua script support. I have Beyond basic text editing, the real reason to use `nvim` is Lua script support. I have
already updated my [public dotfiles repository](https://forge.mcknight.tech/d_mcknight/dotfiles/src/commit/1e6512df4903965b6b9acf361b638c19bce9d78b/nvim) already updated my [public dotfiles repository](https://forge.mcknight.tech/d_mcknight/dotfiles/src/commit/1e6512df4903965b6b9acf361b638c19bce9d78b/nvim)
with my nvim configuration. For the most part, I followed the excellent tutorials I linked with my nvim configuration. For the most part, I followed the excellent tutorials I linked
@ -52,12 +58,14 @@ config in the future, but for now I just want to spend some more time getting us
`nvim` as a text editor. `nvim` as a text editor.
To quickly review some of the functionality I find myself using thanks to plugins: To quickly review some of the functionality I find myself using thanks to plugins:
- neotree (mapped to `<space>f` in my config) gives me a file tree to navigate to different files and show file status info, similar to VSCode - neotree (mapped to `<space>f` in my config) gives me a file tree to navigate to different files and show file status info, similar to VSCode
- treesitter provides syntax highlighting for everything I've edited so far, and it automatically pulls new definitions as needed - treesitter provides syntax highlighting for everything I've edited so far, and it automatically pulls new definitions as needed
- Telescope provides a UI for searching file names and contents, though I admittedly haven't used it much - Telescope provides a UI for searching file names and contents, though I admittedly haven't used it much
- gitsigns provides inline highlighting of changes and git blame support, just like what I use in VSCode - gitsigns provides inline highlighting of changes and git blame support, just like what I use in VSCode
### Language Server Protocol (LSP) ### Language Server Protocol (LSP)
Prior to starting to use `nvim`, I thought syntax highlighting and code completion was all Prior to starting to use `nvim`, I thought syntax highlighting and code completion was all
built into IDEs. In fact, the [Language Server Protocol](https://microsoft.github.io/language-server-protocol/) built into IDEs. In fact, the [Language Server Protocol](https://microsoft.github.io/language-server-protocol/)
is a standard method by which a program (language server) can receive information about a is a standard method by which a program (language server) can receive information about a
@ -71,6 +79,7 @@ functionality. This combination of packages provides a system for managing langu
servers and implementing syntax highlighting, code definitions, and auto-formatting. servers and implementing syntax highlighting, code definitions, and auto-formatting.
### Tmux integration ### Tmux integration
Since I have been [using tmux](https://blog.mcknight.tech/2024/03/27/Shell-Customizations/#tmux), Since I have been [using tmux](https://blog.mcknight.tech/2024/03/27/Shell-Customizations/#tmux),
I also am using [vim-tmux-navigator](https://github.com/christoomey/vim-tmux-navigator) so I also am using [vim-tmux-navigator](https://github.com/christoomey/vim-tmux-navigator) so
that I can use the same `<ctrl>`+`Arrow` shortcut to swich between tmux panes and nvim that I can use the same `<ctrl>`+`Arrow` shortcut to swich between tmux panes and nvim
@ -82,6 +91,7 @@ this might change in the future, but for now it is still very useful to move bet
the logical areas of my terminal in a consistent way. the logical areas of my terminal in a consistent way.
## Workflow Changes ## Workflow Changes
In making the transition to `nvim`, I have found it a lot easier to manage my In making the transition to `nvim`, I have found it a lot easier to manage my
[dotfiles repository](https://forge.mcknight.tech/d_mcknight/dotfiles/src/branch/main) [dotfiles repository](https://forge.mcknight.tech/d_mcknight/dotfiles/src/branch/main)
with `nvim` since I don't usually bother attaching that directory to an IDE. Now, I get with `nvim` since I don't usually bother attaching that directory to an IDE. Now, I get
@ -108,6 +118,7 @@ this point I think its worth it so I'm not twisting my left wrist every time I n
reach `esc`. reach `esc`.
## What to do next? ## What to do next?
Working through this `nvim` setup has gotten me thinking more about how I can optimize Working through this `nvim` setup has gotten me thinking more about how I can optimize
my daily workflow. I might look into CLI file management tools next as I do find myself my daily workflow. I might look into CLI file management tools next as I do find myself
using a GUI file explorer regularly, sometimes just to end up copying a path to paste using a GUI file explorer regularly, sometimes just to end up copying a path to paste