Live data from Hacker News

Vim – Minimal Setup Explained

guckes.net

91–100 of 114 posts

Re: Vim – Minimal Setup Explained

#91

Question for Vim users: how do you get used to hitting Esc very often? I know some switch Cap with Esc but still clunky.

Caps Lock being Esc is so convenient that I use Esc a lot more outside of Vim too. Stop the browser loading a page? a quick pinky tap on the caps lock. Take the focus out of a text field (so I can use my Vimium commands)? tap the caps lock. Decide not to save or open that file after all? caps lock's got your back. The remapping was originally for Vim, but now at least a third of my Esc usage is outside of it.

Agreed! But it's a frustrating experience when you find when a website or application doesn't implement Esc for what you find to be nearly standard behavior across other applications. E.g., it seems like 80% of lightboxes allow closing via Esc.

Re: Vim – Minimal Setup Explained

#92

Question for Vim users: how do you get used to hitting Esc very often? I know some switch Cap with Esc but still clunky.

I use a programmable keyboard with thumb keys, similar to the ergodox. I have escape set to one of the thumb keys so that it's no more work than hitting "space".

Re: Vim – Minimal Setup Explained

#93

Question for Vim users: how do you get used to hitting Esc very often? I know some switch Cap with Esc but still clunky.

I’ve never found a problem with it. Right at the corner, it’s easy to hit with my left ring finger, sitting perfectly at a comfortable distance (based on where I rest my hands) for a slap in that general direction. (I use my Caps Lock as Backspace. Backspace near the top right is vastly less comfortable to reach than Escape in the top left.)

That’s how I use Escape too in Evil Emacs/Spacemacs. There is some funky default in Spacemacs where you can hit something like d+f in rapid succession in order to enter normal mode but I didn’t find it to be worth it.

People really like the home row but (1) I think it is fine to leave it once in a while and (2) my joints don’t like stay in a very static position for too long in any case.

Re: Vim – Minimal Setup Explained

#94

Earlier quoted context omitted.

Esc is probably the easiest key to hit in the keyboard? Tied with bottom left ctrl/fn and whatever you have in the other two corners. As in it's the easiest to misclick without accidentally hitting other keys

The easiest are F and J, the home keys where your index fingers rest. The more you have to "reach away", the harder it is to always correctly reset your hand.

well, we can’t really have F be a special key to return to normal mode

Re: Vim – Minimal Setup Explained

#95
post #17

See also `:h defaults.vim-explained` ( https://vimhelp.org/usr_05.txt.html#05.3 ) which now comes by default. You can either copy the settings you are interested in or source it entirely in your vimrc file: source $VIMRUNTIME/defaults.vim --- Here's some more related resource links: * stackoverflow: useful .vimrc tips - ( https://stackoverflow.com/q/164847/4082052 ) * vi.stackexchange: How do I debug my vimrc file? -…

Please, no. Someone else's vimrc is the last thing newcomers need.

I sort of agree. When I was first getting into Vim, reading a couple of well documented vimrcs really helped me out.

Re: Vim – Minimal Setup Explained

#96

The only thing I've really struggled with when trying to get into using vim full-time is navigating my project. In VSCode I basically hit CTRL+SHIT+F -> "portion_of_a_function_name_or_something" constantly. I abuse the heck out of global search. Is there a way of navigating your project in vim that's similar/easier? How do vim people quickly navigate their code without going "what was the name of that file with that…

Historically, people used :grep and the quicklist to jump between project files based on abitrary strings and Ctags to generate a language specific index of functions, variables which you can jump to. These days people generally use some kind of fuzzy finder plugin thats basically the same as the vscode experience. Exactly which one you use depends on various factors, but Telescope and Fzf are two big names and both…

> And neovim is heavily embracing the LSP paradigm, where you'd use something like gd to jump to definition when on top of a function and a language specific LSP server will tell Neovim where to jump to.

This x100. I switched to neovim+pylsp a few months ago, and it's been an absolute delight. I use lspconfig [1] and pyslp [2] since most of my time is spent developing Python code. Not only can I navigate more quickly and easily, I also find myself catching more silly errors before run-time due to better linting from the lsp.

It used to be that I wouldn't use vim beyond quick edits on single files. Although I still prefer to use vim style bindings in IDEs, I can go much further before I feel the need to fire up an IDE in the first place.

[1]: https://github.com/neovim/nvim-lspconfig

[2]: https://github.com/python-lsp/python-lsp-server

Re: Vim – Minimal Setup Explained

#97

Question for Vim users: how do you get used to hitting Esc very often? I know some switch Cap with Esc but still clunky.

I use `jk` or `jj` instead of esc. Its so much easier imap jj

I've been using this mapping for so long and it's so ingrained in my brain that I completely forgot about it. It used to happened that I'd start typing jjjjj into a textarea or a word processor, and it took me a while to realize what was wrong.

Re: Vim – Minimal Setup Explained

#98
post #63

Earlier quoted context omitted.

Quite apart from the fact that many (most?) vim short forms have long form equivalents, and vim has autocomplete - this argument feels misguided to me, mostly because I don't see why it would be limited to just vim. It seems natural, if you hold such a position, to also advocate abandoning CLIs like `ls`, `cd`, `jq`, `aws`, et al? - and I would despise having to put up with stuff like: $ change-directory foo/bar $ am…

Looks just like Powershell.

which interestingly enough can also have things abbreviated, ie Invoke-Web-Request can be used as iwr.

Re: Vim – Minimal Setup Explained

#99

Earlier quoted context omitted.

Aside from the advice mentioned (I bind caps to escape), I find that beginners use escape waaaay more often than is necessary because they aren't using all the commands at their disposal. For example, entering insert mode to delete some characters instead of using d+motion or x. Or entering insert mode to add indentation instead of using the = operator. It would take too long to enumerate all the cases where there is…

Thanks. This is helpful. I never use those shortcuts and yes most of my Esc are for indentation and deletion.

Indentation is a good example where insert mode isn't needed. Just do stuff like 5>>

Re: Vim – Minimal Setup Explained

#100

Earlier quoted context omitted.

I relate quite heavily to this when using vi to do all my git-related activities. git rebase -i ... followed by ↓dw ↓←dw ↓←dw ↓←dw ↓←dw ↓←dw i s ↓s ↓s ↓s ↓s ↓s because I keep forgetting :s/pick/s/g is a thing i, a, :q, :wq, dd, xdd, and D are all the ones I remember, but cutting/yanking pasting is still something I don't have the muscle memory for. Shift+G takes me to the bottom of a file, but I don't know how to get…

I'm guessing you want :%s/^pick/s/ to replace "pick" at the start of line with "s" on all lines? If you execute it once in vim you can recall it later with just typing :%↑ and confirm with Enter. As for the top of the file: gg I use the mnemonic "go go line" (as in Inspector Gadget's "go go gadget") and since you can prefix it with a line number (e.g. 4gg to go to line number 4), leaving it out gets me as close to li…

Vim has some built in support for that syntax

https://github.com/Konfekt/vim-compilers

Post reply on HN