I’ve spent my Easter break customizing Neovim
framal.xyz
framal.xyz
I still remember this one time, 15 years ago, where I spend literally the whole night configuring my .vimrc, reading the :help pages for all of the configuring options, doing the tutorials, and just moving around and getting comfortable with it.
At 8PM that night I didn't know Vim, but by 6AM the next morning I was very productive in it. I'd say about 80% of my productiveness with Vim was achieved that night, and I could never change to a non-Vi editor since.
https://github.com/folke/trouble.nvim
You'd appreciate nothing out of Typescript if your editor doesn't do LSP.
AstroNvim gives you a good start.
vim.keymap.set("n", "K", vim.lsp.buf.hover, { buffer = buf })
vim.keymap.set("n", "<leader>qf", vim.diagnostic.setqflist, { buffer = buf, desc = "Quickfix diagnostics" }) -- open Quickfix with LSP issues, Loclist possible too
vim.api.nvim_buf_set_option(buf, "omnifunc", "v:lua.vim.lsp.omnifunc") -- use LSP completion for omnifunc
vim.api.nvim_buf_set_option(buf, "tagfunc", "v:lua.vim.lsp.tagfunc") -- Ctrl+] for go to definition using LSP instead of ctags
vim.api.nvim_buf_set_option(buf, "formatexpr", "v:lua.vim.lsp.formatexpr()") -- Code formatting (gq etc) using LSP
Everything else one always sees with Neovim and LSP are other plugins like nvim-cmp or Telescope.This isn't only good, though. Like you, when I don't use vim itself (or nvim nowadays) I use vim bindings in my IDE.
But since I do most of my typing in this environment, I've lost track of the number of times I've closed windows by mistake because I have ^w in muscle memory...
> Bullshit. Seriously, you probably have time to watch some junk content on YouTube or whatever
I get it, we could all produce more and do more to some effort, but really, why? Is the purpose of mankind to completely dominate the universe and know everything? I'm sure the author means well, but this rubs me the wrong way. Plenty of people who just live ordinary, only very modestly "productive" lives are plenty happy and neither you nor I are better than them if we do more shit like customize our text editors. When someone says they don't have the time they mean they prioritize other things more highly than that thing and it feels wrong to tell them their priorities are wrong by accusing them of lying about their available time.
I'm sure this comes off as overly sensitive and really I'm not that bothered by it, but I do think we as technical people can do better than I perceive us doing. Non-tech people seem to believe we're a very judgemental group and I can't say that I blame them.
It also begs the question, if I "have" to be learning about something productive, why Neovim? Why not Golang, Zim, the latest React plugin, etc
People really need to calm down
It’s also only once you move on past that first nonsense answer that I can make my case: it’s worth spending your time on subject X, for reasons…
But if we never get there, you’ve just brushed off the person unfairly.
I don't think there's anything condescending about that, it's probably an advice the author found genuinely helpful in the past as well (well, I did).
Me too.
I don't want to live running on the treadmill my whole life. Default human state is idle - all work comes from necessity, whether from hunger, cold, or some other, more sophisticated need.
The idea that "we can all do better, therefore we must" might seem noble from at first - striving for the perfection and whatnot - it's still an idea that mostly benefits those who benefit from our work and don't benefit from our idleness, whoever those people may be. And it is often used as an excuse to bully those who fail to meet such expectations.
I agree the tough love to tone is a bit much, and harms the author's message.
The real message is that learning vim is like learning stenography after learning how to type. Many people don't want or need to do it, but people that know both can do things that others can't.
My guess is that the author may be presenting that tough love attitude because they had to tell themselves that to get over the comfortable rut for themselves.
I love vim, but what do I care what you use?
I just prefer learning about things when bored, instead of begin forced to. I find idleness very comfortable for exploring new stuff on my own pace.
And then it's up to you what you do with that. Maybe that means you push yourself and do more, and chase the raises and promotions. Or maybe it means you work a half hour less every day and still get the same amount of work done.
It's unfortunate that the knee-jerk reaction to a suggestion to master our tools is cynical.
I think we all should invest more of our time in improving ourselves and our productivity, because then we get to decide what to do with that, not our employers.
Let me explain what was on my mind when writing this paragraph. I feel like atm many of my University colleagues are working very ineffective and thus they actually don't have free time, or very little to say so. This is very depressing for some of them and I think that their coding effectiveness and often poor knowledge of shell, linux administration in general or other dev tools is the main bottleneck here. This comment was not about working more effective for the sake of it. It was about getting you more time to do stuff you want to do.
I like vim because I don't have to mess around with cursor keys and remember whether the system I'm using expects me to press home, or fn+arrow, or the key in the left corner (ctrl) or the key next to the space bar (command) or the one in between (option – office for mac) to select a word text. It just gets out of my way and lets me enjoy what I'm doing.
I prefer a tiling window manager not because it allows me shave some milliseconds off window management, but because having to drag windows around is irritating to me. Bonus point for not having a different behavior if there is one or multiple open windows of the same application running.
The same with keyboards, I may type faster on a mechanical keyboard, but that's not why I use it. I use it because it feels better when I type on it. I don't have to make sure I press the keys exactly in the middle or else they may or may not get stuck in the middle and not register (cheap HP keyboard at work). Do I type faster? You bet. But cranking code faster isn't the reason.
For me, it's not about productivity. It's about how less frustrating the process is. You don't realize the base level of stress you have in your day to day life as a result of the unergonomic UX of your tools until you try something different. I wanted to learn vim like operation as a sort of academic experience, and now my computer just does what my mind wants it to do, very little friction. The hard part is convincing yourself to learn to do something a different way. Don't worry yourself with the productivity sales pitch, just do it out of curiosity and I'm almost certain, when you're done, you'll like it a lot better.
One project that seems super cool I hope continues on is helix. https://helix-editor.com/. I just started messing around with it but the selection -> action philosophy behind text manipulation feels much more intuitive to me even though I'm proficient with vim at this point.
My vim config was at least a hundred lines, and that's not counting the endless plugins. My helix config is three or four lines to set my theme persistently and disable auto-filling parens. Something like:
theme = "onedark"
[editor]
auto-pairs = false
And Helix doesn't even support plugins (yet), so this is all bundled with the default install.Helix is surprisingly good for how young it is. I agree that movements in Kakoune and Helix are more intuitive.
There have many, many editors hoping to make vi and emacs obsolete, yet decades later they still are heavily used. Not true for some of the newer contenders --- time is a great filter.
- https://github.com/folke/trouble.nvim
- https://github.com/lewis6991/gitsigns.nvim
I also have a tendency to review my current plugins to see if there are any I'm not using.
as the author mentioned, LunarVim is a great project worth checking out. i'm using it now and recommend it.
For multi-file find/replace you should check out far.vim: https://github.com/brooth/far.vim
> LunarVim is a great project worth checking out. i'm using it now and recommend it
Haven't tried LunarVim but AstroNvim is great too.
This is something I’ve found very easy in vim with bufdo , windo, or populating the quickfix list (or args list) and using cfdo/cdo or argdo to be really specific about where the replace should happen (e.g. replace FOO with BAR only on lines containing STRING or in files containing STRING).
I have a similar experience to the author. I did the tutor, wrote some notes as a cheat sheet, keep it open somewhere and just use the editor. I began using lots of tools that were keyboard focused and used vim-like keybinds (qutebrowser and other things). I wouldn't say productivity is increased, and I'm not a productivity zealot, but I'd say that once my mind adapts to the new environment, doing things is smooth as butter. The hard part is the fight inside yourself against the idea that you're relearning something you already can do another way that you don't actually need, afterwards you'll ask yourself why you ever did it the old way.
Also, do you have any plugin recommendations for debugging?
Granted, I get it, you didn't design the thing but you still need to debug it so no judgement, just more of an observation that if you limit yourself to simple tooling you might be surprised at how the pain points will force you to spend more time thinking about how to design your own code to be more simple and that's bound to have a far greater impact than any debugging tool could provide you.
With a debugger you can also change the behavior of a live program, e.g. modify variables or jump over a piece of code that would otherwise be executed.
Every person I've encountered professionally who either "doesn't use debuggers" or thinks "print statements are better" seems to be under the mistaken impression that all a debugger is good for is stepping through code.
Debuggers are fantastic tools. You should re-evaluate your view of debuggers and you will become a better programmer.
I think they have their place as tools but largely that's dwarfed by other practices. In the notion of systems thinking, I try to limit the scenarios where needing a debugger is seen as the natural extension. This means having tests, practicing type-driven design, mapping my APIs to some real-world model (and knowing where that fails or falls short), using languages that obviate the existence of certain classes of bugs (e.g. Rust, languages with a GC), etc.
Sometimes you're trying to inspect behaviour that changes in the moment, and debuggers do great there. However, I'll say that some of the most interesting bugs I've dealt with were only visible in release builds with no debug symbols, so my debugger didn't do much of anything for me there.
Plus, this doesn't even dig into other tools that _aren't_ taught because people reach for their debuggers. How many of the folks grabbing debuggers every day have been given the same speech / sentiment given to toolz above about strace? valgrind / address sanitizer? thread sanitizer? syslog?
I feel like this comment might be a bit rambly, but I was hoping to expound on what toolz mentioned above -- there's a lot of ways to crack an egg here and the debugger is something I almost never reach for.
I personally find that both are good tools, but to know what you should be using, you need to think about which viewing angle you want to choose: which components of state do you want to inspect and which moments in time do you want to track? If the answer is "these specific state components/unknown" (e.g. "when is my program accessing invalid memory?"), that's where print debugging comes in, with specializations depending on which particular state components you're looking at (strace or eBPF for IO, valgrind for invalid memory accesses, etc.) If it's "unknown/these specific times" (e.g. "where is my program setting HTTP response headers when a request occurs?"), then a debugger is a good idea.
However, what you said does have truth to it. Good programming practices generally center around the management of program state* (using types, specifications, whatever). If your program is not designed well in those terms, then the more likely it is that you have no idea what state components you want to inspect, meaning you reach for a debugger first. And if it is designed well, you won't need a debugger nearly as often. But sometimes we have no choice, whether that's due to an inherently hard problem space or lots of bad code that we didn't write, so a debugger is necessary.
* I don't actually know if there are programming practices that center around managing moments in time. I can't even think how that would work, but I would be very interested to know if there are any :)
I don't disagree! The notion of state vs. time snapshots in terms of the mental model seems like it might be missing something small but sounds mostly on the mark? E.g. in dynamic languages my REPL is more of a debugger than any actual debugger could be.
> * I don't actually know if there are programming practices that center around managing moments in time. I can't even think how that would work, but I would be very interested to know if there are any :)
I think this depends on how you abstract control flow. Actor model comes to mind, as Smalltalk really doesn't have this notion of "time" in the same way. You debug live in such a system, and "time" is more a matter of what abstraction sent or received something (and as such may have failed). Similar arguments could be made for conditions / restarts in Lisp, perhaps even more strongly, since you can manage errors through conditions and then restart code (going back in time, so to speak) in a sort of live-debugging way. Not sure it measures quite to the degree you were asking, but that's the first thing that comes to mind.
Another thing is the movement towards async-await / cooperative coordination in programs. Even if you ignore concurrency, designing code in a way that coroutines cooperatively yield to one another (e.g. generators in Python) helps sort this out too. Basically, you make "time" in a program a function of control flow, and do that by forcing an abstraction where you explicitly yield control in the program. This relates to both the actor model and conditions / restarts in Lisp, so I feel like I'm pulling on the same train of thought there.
There was a live, 3D, peer-to-peer interactive environment back in the early 2000s called Croquet that made use of the concept of "pseudo-time." It was built on top of Squeak Smalltalk (there are some decendants today, including croquet.io). The part that handled the time management in a way you might find interesting was called TeaTime [1], and built on the ideas of David Reed thesis about pseudo-time [2]. If you are not familiar with these you might want to check them out!
[1] https://dl.acm.org/doi/10.1145/1094855.1094861
[2] http://publications.csail.mit.edu/lcs/pubs/pdf/MIT-LCS-TR-20...
Vimspector isn't nearly as friendly as vscode but the which-key plugin jogs my memory on the key bindings pretty fast.
One thing I'm not so sure of though -- the justification for neovim seems to be partially due to needing a pretty recent version (at least newer than 0.5.0, for LSP features). There seems to be a big portion of vim users who seem to dump on neovim for one reason or another as some kind of meme, but I'm not sure that I agree about it being bloated or whatever. If I have to run Slack for work next to neovim / vim, I'm pretty sure I know what is using the majority of my system resources... Anyways, back to needing a recent version of neovim: I think the author could probably get by with just regular vim + extensions if they didn't use LSP stuff.
To be honest, I still haven't really used LSP much, and most of my experience using similar features in other products (Intellisense in Visual Studio, whatever the equivalent broken thing in Xcode is called) is that it really was never that useful? Maybe I'm misunderstanding something and it's just not good for me and my workflow, but I feel like a lot of newer devs seem to enable it and declare that they can't work with anything that doesn't support it. For a long time I've avoided such features since they often seem to have poor performance (Xcode's version of such has definitely taken down a Macbook Pro on me before), or just generally don't add much to the experience other than some coloured lines under parts of my code.
A good compiler (e.g. rustc) and corresponding linter for static analysis (e.g. cargo clippy) are actually pretty good on their own! This isn't true for every language out there, and maybe that's where LSPs are more useful - the Typescripts / Pythons / Javas of the world! I don't know if I'm over-simplifying it though. Either way, I'm pretty sure my point is that whether you choose vim or neovim, it's a great idea to sit down and spend a good chunk of time just getting better at using your tools. It's the kind of exponential improvement that won't even seem egregious a year down the line.
It's useful especially when you're switching many languages, or working with new libraries.
Syntax error is immediately highlighted. Saves a context switch of changing to compiler tab and back to editor.
With every symbol, you can view documentation by hovering. When autocompleting also, a small window/popup shows docs for currently selected symbol.
You have automated refactoring available in-place, especially renaming. In most LSP it renames across all files and modules.
Granted it's not that useful if you're in-and-out familiar with the stack you're working on. But once in a while you still need to switch languages and use new libraries it will be useful.
I can't go back to pre-LSP world.
I do think if folks find LSPs useful they should keep using them. I might even be convinced one day! But at the moment I find I'd rather not. Vim's default auto-complete functionality is actually fine enough for me most of the time, so I might actually be weird here.
I have a file browser (ranger) with a preview pane set up, I can select logs on a remote server and open the tmux select buffer as a new tab, I can pipe or redirect output into a tab.
It really brings my tmux terminal workflow into one cohesive system.
I can do everything else with vim that I can do with neovim, completion, linting, formating though a lot of that is either in a tmux pane below or pulled in as a shell command at the vim prompt. (though I'm probably not as hard core as some who do more with neovim)
But I can't replicate that remote setup.
But yeah, tmux & vim together definitely changed a lot of my workflow when I'm not at my local machine. Now working away from "the office" is just a matter of ssh-ing into my machine and jumping into tmux.
I do keep a pretty spartan config though, so I imagine I could do most of what I do in regular vim as well. ¯\_(ツ)_/¯
I have in my past done quite a bit of work out on prod hosts with vim so I don't like to get too out there from stock.
everything works in vim with the exception of the server:
When I start tmux I create a window:
new-window -n "Code" 'cd ~/working; NVIM_LISTEN_ADDRESS=/tmp/code nvim ; bash -i'
then split the window with my file browser: split-window -t 1.0 -h -p 20 'cd ~/working ; EDITOR="$HOME/bin/ranger-edit.sh" ; ranger ; bash -i'
ranger edit is just a command that opens a file as a tab in the server and then switches tmux panes: FILEARGS="$@"
nvr --servername /tmp/code --remote-tab $FILEARGS ; tmux selectp -t 0
Thats about it. I guess you have to have nvr installed. Other than that, I have a pretty sparse config all around.I do a similar thing where I set a global nvim_listen_address variable when I log in and I can use that to pipe to a different editor for things like logs and such. I don't generally want my ops work opening a bunch of tabs in my coding window but I could set it globally and use the single editor if I wanted to.
No, they are not useful
I have been using IDE for sometimes, none of the features helped me to solve very complex logic in the codebase. I have to debug, test and trace the errors manually
And those who often refactor their code (with their IDE), I don't know if they are designing the architecture correctly. Once in a while is fine, but if they are doing too much of that, yea probably they are messing up the codebase. I don't really want to work with somebody like this, imagine that you have to solve the errors that they produce and IDE doesn't actually help at all
The vscode neovim plugin gets you closer, but it can't seem to keep up with fast typing speeds in some modes.
I like vscode for other features, but neovim is still superior for raw editing productivity in my book.
- plain lies about IDEs, followed by
- painstakingly recreating half-baked partly-working parts of what IDEs give you out of the box
> I feel like moving your hand from the keyboard to the mouse every time you want to move the cursor a few words back or forth
This interaction is literally built into your OS. It's called navigating with cursor keys and modifiers (Option on Mac, Ctrl on Windows, etc.)
> to create a new file
Even if there's no direct shortcut (such as Cmd+N/Ctrl+N), all menu items are available from keyboard.
Moreover, you rarely create just a file. An IDE's "Create New" tools usually give you a plethora of choices to create a file and all the necessary boilerplate in one go
> split the window or whatever
This I can agree with, and I think I even reported this as a request for improvement to JetBrains.
> Searching for some cool plugins and tweaking them was a very cheerful time and I run into almost no problems during the whole process. And, to be honest, 20 hours for creating a virtually full IDE from scratch customized entirely for your personal needs does not seem that much time at all. Lua is an easy and pretty language for configuration code, I think I’ve learnt it pretty well just by reading plugins’ code
No mention of plugins or what they do. Random screenshot shows something a modern IDE has out of the box.
I don't see why some people insist in this BS
The arrows keys exist for more than 30 yrs now, use them!!
Or I can use PgUp/PgDown as well.
Qwerty has existed for more than 30 years but it really sucks. Why cling to suboptimal things just because they're old?