Skip to main content

Development Workflow Patterns

These are practical Neovim workflows for daily development — how experienced users actually work, not just what keys do.

Real Workflows Focus

These patterns focus on the chain of actions, not individual commands. The goal is to internalize "how do I do X completely in Neovim."

Pattern 1: Start Working on a Project

1. Open tmux session
~/bin/dev.sh → opens project with Neovim + shell + logs

2. In Neovim:
<leader>ff → find the main file to start
<leader>ha → harpoon it

3. Open 2-3 related files:
<leader>ff → select → open
<leader>ha → harpoon each one

4. Now switch between them:
<leader>1 → file 1
<leader>2 → file 2
<leader>3 → file 3

Pattern 2: Exploring an Unknown Codebase

1. Open project root:
nvim . → opens netrw
<leader>e → toggle Neo-tree

2. Get the structure:
Neo-tree sidebar for overall structure
<leader>fg "keyword" → live grep for entry points

3. Follow definitions:
gd → go to definition (LSP)
<C-o> → jump back
gr → find all references

4. Search for patterns:
<leader>fw → search word under cursor
<leader>fs → all document symbols

Pattern 3: Refactoring a Variable Name

1. Find occurrences:
* → highlight all instances of word
<leader>fw → Telescope: all occurrences in project

2. Rename with LSP (preferred):
<leader>lR → rename via LSP (renames ALL references)

3. Or manual with cgn:
/variablename → cgn → new name → Esc
n.n.n. → apply to next occurrences selectively

Pattern 4: Editing a Config File on a Remote Server

# SSH into remote server
ssh user@server

# If Neovim is not installed, use system vim with minimal config
vim /etc/nginx/nginx.conf

# If Neovim is installed, use your config over SSH:
# (your config is stored on the server or shared via dotfiles)
nvim /etc/nginx/nginx.conf

For editing remote files from your local Neovim:

-- neovim supports editing files over SSH with scp://
-- Open in local Neovim:
-- nvim scp://user@server/path/to/file

Pattern 5: Running Tests Inline

lua/plugins/testing.lua
{
"nvim-neotest/neotest",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-treesitter/nvim-treesitter",
"nvim-neotest/neotest-python",
"nvim-neotest/neotest-jest",
},
keys = {
{ "<leader>tr", function() require("neotest").run.run() end, desc = "Run nearest test" },
{ "<leader>tf", function() require("neotest").run.run(vim.fn.expand("%")) end, desc = "Run test file" },
{ "<leader>to", function() require("neotest").output.open() end, desc = "Test output" },
{ "<leader>ts", function() require("neotest").summary.toggle() end, desc = "Test summary" },
},
opts = {
adapters = {
require("neotest-python"),
require("neotest-jest"),
},
},
},

Pattern 6: Format + Lint on Save (Production Setup)

lua/config/autocmds.lua
-- Format on save (via LSP or none-ls)
vim.api.nvim_create_autocmd("BufWritePre", {
group = vim.api.nvim_create_augroup("fmt_on_save", { clear = true }),
callback = function()
-- Format using the best available formatter
vim.lsp.buf.format({
async = false,
timeout_ms = 3000,
filter = function(client)
-- Prefer none-ls for formatting if available
return client.name == "null-ls" or
(client.name ~= "null-ls" and not vim.lsp.get_clients({ name = "null-ls" })[1])
end,
})
end,
})

Pattern 7: Server Config Editing Workflow

For sysadmins editing config files:

1. nvim /etc/nginx/sites-available/example.com
2. Use /keyword to find directives
3. Use ci" to change values inside quotes
4. Use :s/old-path/new-path/g for path updates
5. :w → save
6. Exit Neovim
7. Back in shell: sudo systemctl reload nginx

What's Next