My (Neo)Vim workflow
seniormars.com
seniormars.com
vim.keymap.set('n', '\\.', ':tabedit %:p:h<CR>')
My leader is \, so when I press \. it will open netrw in a new tab in the directory containing the file whose buffer I was just editing. I use this all the time when I need to navigate source trees as I don't care much for fuzzy file finders. Credit to -romainl- who taught me about %:p:h.There's a shorthand :Texplore which does the same thing as your :tabedit invocation. Also, if you change it to
':Texplore */%:t'
, it'll open the directory of the current file and put the cursor on the current file.I've added this to my .vimrc:
noremap <C-b> <Cmd>Explore */%:t<CR>
This binds Ctrl-b to browse in the directory of the current file.Tossing up the idea whether to switch to Texplore, but you know if it aint broke...
Edit: Switched to :Texplore and also have \v bound to :Vexplore -- very handy.
The regular fuzzy finder is unfortunately useless in the home directory (too many files), with this limit, it's useful.
local builtin = require("telescope.builtin")
local utils = require("telescope.utils")
vim.keymap.set("n", "<leader>fa", function()
builtin.find_files({ cwd = utils.buffer_dir() })
end, { desc = "[F]ind [A]round currently open buffer" }) require("telescope.builtin").find_files({
cwd = buffer_directory(),
prompt_title = "Find Around",
find_command = vim.list_extend(vim.list_slice(default_find_command), {"-d2"}),
})Genuine question for the author - have you configured Vim this way in order to be more productive or because you enjoy customizing it? I don't mean for that to be antagonistic, people build and customize muscle cars to show off even though they're slower than Teslas.
It's wild to see the community around recreating VSCode in the terminal (Astro Nvim, NvChad, etc.) I guess if I had to customize Vim so much for it to be a usable solution I'd just go back to using VSCode. After all, keyboard-action-speed is pretty much never the bottleneck when coding, thinking is.
Look some people just like tinkering. To me a text editor is a tool, not a hobby or a love affair. You see people going "I've added 100 plugins and it's great now" and the same people later "I've got rid of 100 pluggins and it's great now". The mean time I'm getting stuff done.
I've used vim as primary editor for about a decade. Just started using Cursor (vscode fork) for last few months and still much prefer nvim - but copilot++ is a game changer so I deal with it. I do use the vscode-neovim extension.
The biggest thing I miss is a terminal based workflow. I find GUI editors unnatural. Much prefer my editor in the terminal.
I had to learn vim back when I was a basic system administrator so when it came time to start doing real coding it was an obvious choice. I also prefer properly open source software, and if possible, non-corporate backed. So it checks all my boxes especially now that I'm not "missing" anything from VSCode.
When people ask me though I recommend VSCode to most normies, I don't think vim is worth it nowadays.
I'd try to avoid using your mouse altogether; because it's faster and for me, avoids neck/shoulder strain.
Also, I'd recommend oil.nvim which is great for doing file exploration and manipulating. You can edit/move filenames naturally in a vim buffer, and then save to apply changes.
For now I got to setting up LSP configs and servers for a few languages but didn't get into using it yet besides getting extra syntax highlighting.
vim.keymap.set('n', 'gr', function()
local clients = vim.lsp.get_clients({ bufnr = 0 })
for _, client in ipairs(clients) do
if client.server_capabilities.renameProvider then
vim.lsp.buf.rename()
return
end
end
end)local on_attach = function(client, bufnr) vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, bufopts) end
https://www.youtube.com/watch?v=zHTeCSVAFNY&list=PLsz00TDipI...
There is a separate playlist that shows how to smoothly integrate Tmux with Nvim so you can do things like Ctrl H/J/K/L between Neovim splits and Tmux splits seamlessly.
Very interesting! I want to write the test cases myself. When copilot writes some code that passes my tests, I think I can trust it.
If you don't even trust copilot to write your logic, how can you trust it to write the specification for how the logic should behave?
Tests also tend to have a repetitive and clearly defined structure, an environment that AI thrives in.
(Also, devs usually find writing tests boring, while AI never gets bored.)
And once your tests are in place, if desired you can then get AI to write the actual code too.
Finally the tooling around LSPs has got better, but I feel it needs to go further. Modern languages like Go and Rust have excellent LSPs, but java. It's not great. I know java is just an absolute mess when it comes to tooling, but I wish there was some standardisation here.
I'm thinking of leaving ignorecase off and mapping / to /\c so that it's clearly only applied to interactive searches, and can be disabled with just 2 backspace presses.
What's your take?
Good to see neovim integration progressing. When I stopped using vscode years ago neovim integration was limited to ex mode in vsvim
-- Ctrl + arrows resizing splits
vim.keymap.set('n', '<C-Up>', '<Cmd>resize +1<CR>') -- increase window size vertically
vim.keymap.set('n', '<C-Down>', '<Cmd>resize -1<CR>') -- decrease window size vertically
vim.keymap.set('n', '<C-Right>', '<Cmd>vertical resize +1<CR>') -- increase window size horizontally
vim.keymap.set('n', '<C-Left>', '<Cmd>vertical resize -1<CR>') -- decrease window size horizontallyMason makes it very easy to install additional language support.
This, however, only works with software with good backward compatibility. Here is to nvim to be that kind of software.
Is this your own? Or just one you liked?
It's wild to me the extent to which some devs just sorta volunteer for RCE.
And often, for the most superficial of reasons? "Oooh, this plugin adds emoji error messages!" one hundred and forty-three black-box dependencies from anonymous github accounts later...
Some snippets simply have comments like "I use lazy.nvim to load plugins" and that's it.
A toolchain should also be discoverable and well documented.
A toolchain should also be complete:
- editing
- syntax highlighting
- syntax validation
- linting
- building
- testing
- profiling
- debugging
- searching
- documentation
- version control
Optionally also
- deploy
- inspect logs
You can do a lot of work and testing to these working correctly, install a "distribution", or you can simply use an IDE.
You can argue that you can do all these things with plugins, but plugins do not follow unified guidelines and the result can be an inconsistent experience like the Dwarf Fortress menus.
A TUI editor with many plugins installed isn't necessarily faster than an IDE. Languages like vimscript are interpreted, not compiled. And many implementations not always take advantage of multi-threading capabilities.
Among the distribution of TUI editor users, only a small subset of users can get their toolchain to be ergonomic, complete and work correctly. The rest just have a minimal experience that just gives them more work to do and that places a quality handicap on them.
How do you read profiler output in your TUI editor? or show test coverage? or run a specific test case in a test file and get a test report? 99.9% of the time the answer will be "Well, I haven't set that up yet...but look at this multiple cursor trick!". And the median skill level TUI editor user often hasn't even set up a linter or something like LSP integration.
What TUIs are excellent for, in my opinion, is to encourage an immersive experience that's distraction free. But now many IDEs have distraction free modes.
They can be good for customization (which can even result in customizations that make your work more difficult), although IDEs have SDKs that are not hard to use and many plugins are open source.
TUI editors are also more compatible with working on remote hosts.
Now, through customizations you could in theory create a universally superior development experience compared to what IDEs offer, but that is yet to be seen. Only in some aspects TUI plugins have achieved this level of excellence in specific areas, like Magit for emacs.
You can just open both editors next to each other and ask how they are. For me, it's trivial to see that vim is at least an oom faster than VSCode. I don't need to profile or show test coverage. I can just use it and it works. Even if they were about the same speed, the less-than-perfect vim mode implementation always takes too much time out of my editing flow.
Occasionally, an ide will have such a great curated experience that I'll use it for something specific -- but the general case is a no contest for me.
All your "one OOM away from VSCode" scripts run in a script language that is in the slowest category among all programming languages: interpreted languages.
There are probably millions of dollars invested in making scripting languages like JavaScript faster, but that's not the same case for vimscript. Same applies to other languages behind IDEs such as Java. So that intuition is not true.
With hardware accelerated widget toolkits, the TUI advantage is not necessarily true either.
It just doesn't matter. Vim is objectively faster. I don't care how many millions of dollars or pl optimizations my editor has. I care how quickly it works.
But that doesn't necessarily negate what I said: having a complete toolchain with a complete set of capabilities is the end goal. How you achieve that is means towards an end. If you achieved it with a TUI editor, good.
But there's a subculture in the TUI editor world where the end goal is often the prestige of being a TUI editor user rather than how capable the tooling makes you. And the situation in the wild is that most of these TUI users have a sub-optimal development experience that causes them to push more defects, because even though you could integrate LSP, a linter, etc... a lot of them don't.
With respect to when vim was invented, you have a supercomputer now. You may be solving a performance problem you don't have.
If editing with a minimal experience is a deep part of who you are, yet you are not going to pay for the cost of detecting and correcting preventable problems which can cost the company thousands to millions of dollars... maybe you are not acting in the best interest of your development org, your colleagues, your career or your family even. What do we call a person that exhibits that behavior?
What an amazing pile of unsubstantiated horsefeathers!
I think you overestimate the amount of work needed to get these things working… With Vim, for example, you can install a single plugin “ALE”, and it will autodetect and integrate every known LSP server, linter, and formatter that is in $PATH. For Emacs, you won’t even need a plug-in: “Eglot” is included in Emacs itself, and autodetects and integrates LSP servers in $PATH when you turn it on. Turning it on can be done by clicking a discoverable menu bar item.
> yet you are not going to pay for the cost of detecting and correcting preventable problems which can cost the company thousands to millions of dollars... maybe you are not acting in the best interest of your development org, your colleagues, your career or your family even
This is a bit of a stretch, isn’t it? If a single dev turning off their linter can cause millions of dollars worth of problems and bankrupt your family, then your org has deeper problems.
- If you’re working on critical code where one wrong line can bring down the planet, it is your organization’s responsibility to adapt. This means thorough testing before you roll it out to production, code review, etc.
- If you’re convinced that linting, testing, etc. is essential to prevent calamities, it shouldn’t be up to individual developers IDE choices to use these. Then it’s again up to your org to centralize and mandate those tools, e.g. by adding autoformattets, linters, and test coverage checks to their Git precommit and code review. This is an organizational issue.
- If we take a step back from these calamities, and claim that an IDE just makes people more efficient… Isn’t it again up to your org to promote and pay the efficient developers more, and gradually the top positions will be filled with IDE users and that becomes the company culture if your hypothesis is right?
In any case, I strongly disagree with your angle that not using an IDE is “irresponsible”. I have my reasons for sticking with a terminal-based workflow, but respect and understand why other people might find an IDE better.
My conclusion now about an integrated environment (like an IDE) versus a more handbuilt (like vim) is that a handbuilt one requires the dev to know it's tools. With an IDE you are seduced to trust the magic black box, that the box will help you. This makes it that when stuff goes different then expected (usually user error), you are lost.
With a more custom environment you are pushed to learn your tools. And while this is not a given, I like this approach more. I might miss some fancy new tools, but the tools I do use, I *know*. This could be done with an IDE but is more forced in a terminal based flow.
And IDEs have integrated terminal panes as well.
Same way an IDE is a nicer debugger, linter, profiler, test run platform...
for the longest time (pre-LSP), my non-kotlin dev experience was just vim-polyglot and running watch - build in a :vsp and it gets you far.
Ah yes, the classic "takedown" with the invented statistic about what people "probably" haven't done while "probably" focusing on something less important. Bravo.
Side note: most Vimmers don't use multiple cursors... it's 99.9% of them, I believe!
If your code caused data loss on production because you are LARPing about being a hotshot instead of adopting the processes that keep the code running I don't care how fast your editor is.
- sent from my terminal
The linter feedback would take longer to get back to the developer though, increasing the "cost of change".