Live data from Hacker News

Why Vi Rocks

why-vi.rocks

61–70 of 80 posts

Re: Why Vi Rocks

#61
post #49
post #21

Earlier quoted context omitted.

> And I know devs that swear by vi...they are developing any faster than I am I hear about this from time to time, but have never seen it people do it successfully first hand, what I do see is silly mistakes in their checkins; incomplete variable renames, formatting is off, syntax errors, switching between browsers and their code while looking at manuals, or other obvious mistakes that can be caught inline by IDEs wh…

Most of the things you're describing as editor issues would be caught by formatters and linters and a test suite, so I have a hard time understanding where you're coming from with this. edit/ A word.

This is a good point actually, the sooner you catch the mistake the quicker you can correct it. So once it gets down the line, even in a pre-commit, you're just wasting your own time on getting the feedback. It's not always possible to get it sooner of course.

Re: Why Vi Rocks

#62
post #18
post #14

Vim is like Dvorak. The cognitive burden for remembering which key maps to what is high unless you use it 24/7.

It's actually not that hard: The formula: number(Optional) action movement Examples: 2 dl - delete two characters right dw - delete a word yb - copy back a word y/foo - copy to the search foo 4cw - change the next four words actions: yank(copy, delete, change) movements: /(search), t(til character), f(to character), many many others (l, h, j, k, *, #, T, F) Combine as you see fit.

`action [number] movement` also works, and makes more sense to my brain.

Re: Why Vi Rocks

#63

Earlier quoted context omitted.

Why do you feel that Vim on Dvorak is insane?

Motion in Vi is based on treating the home row of the keyboard as arrow keys. H, J, K, and L are left, down, up, and right. They aren't mnemonics, and so scrambling them around (Dvorak) is just doubly confusing.

Oh, huh, never considered that a real issue. I've used Vim on Dvorak for years, and use hljk for motion.

It's nice that jk are adjacent on Dvorak, and hl are conveniently placed as well.

Re: Why Vi Rocks

#64
post #59

Earlier quoted context omitted.

Hmm, I've got syntax/compile checking, linting, automatic code formatting and generation, and code completion based on context in vim right now. I don't see how any of the problems you mention are vim specific.

What packages are you using and what language out of curiosity?

C++ and JavaScript. I've got about 60 plugins installed and a highly configured vimrc. Some of the important ones:

w0rp/ale

junegun/fzf

junegun/fzf.vim

majutsushi/tagbar

scrooloose/nerdtree

jistr/vim-nerdtree-tabs

erahhal/nerdtree-ack

tpope/vim-commentary

joegesualdo/jsdoc.vim

Raimondi/delimitMate

tpope/vim-surround

vim-scripts/AutoComplPop

Shougo/deoplete.nvim

carlitux/deoplete-ternjs

marijnh/tern_for_vim

Rip-Rip/clang_complete

SirVer/ultisnips

tpope/vim-fugitive

mhinz/vim-signify

vim-scripts/DirDiff.vim

sheerun/vim-polyglot

pangloss/vim-javascript

vim-utils/vim-man

Re: Why Vi Rocks

#65

I’ve learned some vi, and emacs, Visual Studio, VS Code, XCode, IntelliJ, and Android Studio. All the examples listed are pretty uncommon or trivial in any of the other IDEs (aside from the regex part, which is cool, but I never want to be in a place where I have to regex my code...ever). 90% of the time I’m doing simple code maintenance, with an occasional refactoring. And I know devs that swear by vi...they are dev…

I am writing this from emacs experience (some if not all these features are in vi as well), there are features from emacs that make a real difference in writing programs especially: * Unlimited yanking from kill rings: ie pasting text from history of the clipboard.(This is one thing I have most difficulty with when switching from emacs to modern editors) * Macro recording and playback : recording an arbitrary set of…

Friendly reply -

> Unlimited yanking from kill rings

vi has named buffers, which aren’t the same thing you’re talking about, but definitely more than a single clipboard

> Macro recording and playback

vi can “execute a buffer” which are arbitrary commands, and at least nvi can do automatic substitutions as well in a “dumb macro” sort of way

> Two or more code frames...

Same for vi. In nvi it’s :E for vertically stacked or :vsplit for side-by-side. Like emacs, you can even run an interactive shell in a buffer (frame) and cut/copy/paste with another.

> Remote file editing

I presume you’re talking Tramp. Not out of the box with nvi, but it interacts with the Unix shell fantastically if you’re lucky enough to be developing in such an env. I’d be surprised if vim doesn’t have a decent Tramp-like feature.

I think vim does columnar edits, but I’m not a vim user; nvi is out of luck there, unless again one finds a solution punting to the shell - which isn’t the end of the world. But this case I think would disappoint you the most from your feature list (speaking for nvi).

Re: Why Vi Rocks

#66
post #61
post #49

Earlier quoted context omitted.

Most of the things you're describing as editor issues would be caught by formatters and linters and a test suite, so I have a hard time understanding where you're coming from with this. edit/ A word.

This is a good point actually, the sooner you catch the mistake the quicker you can correct it. So once it gets down the line, even in a pre-commit, you're just wasting your own time on getting the feedback. It's not always possible to get it sooner of course.

Yep. I have formatters and linters run on save in vim (of course, any editor or IDE can handle this) and the linters render their results in vim, as well. I also use vim-dispatch [0] to handle running builds and test suites asynchronously, but I don't run any auto commands for that, instead preferring to kick those tasks off with a keystroke.

My workflow is crafted in a way to give me, what I have found to be, the tightest feedback loop that I can possibly get with the languages and frameworks and tooling that I use at work. I find that vim, out of every other editor or IDE that I've ever used, is set apart in it's ability to deliver on that requirement.

[0]: https://github.com/tpope/vim-dispatch

Re: Why Vi Rocks

#67
post #59

Earlier quoted context omitted.

What packages are you using and what language out of curiosity?

C++ and JavaScript. I've got about 60 plugins installed and a highly configured vimrc. Some of the important ones: w0rp/ale junegun/fzf junegun/fzf.vim majutsushi/tagbar scrooloose/nerdtree jistr/vim-nerdtree-tabs erahhal/nerdtree-ack tpope/vim-commentary joegesualdo/jsdoc.vim Raimondi/delimitMate tpope/vim-surround vim-scripts/AutoComplPop Shougo/deoplete.nvim carlitux/deoplete-ternjs marijnh/tern_for_vim Rip-Rip/cl…

That's a useful list, thanks for sharing. What would be useful is if there was just a distribution of Vim that just had everything included for a specific language. Or at least a base and then a way to discover and add more from within Vim.

Re: Why Vi Rocks

#68
post #67

Earlier quoted context omitted.

C++ and JavaScript. I've got about 60 plugins installed and a highly configured vimrc. Some of the important ones: w0rp/ale junegun/fzf junegun/fzf.vim majutsushi/tagbar scrooloose/nerdtree jistr/vim-nerdtree-tabs erahhal/nerdtree-ack tpope/vim-commentary joegesualdo/jsdoc.vim Raimondi/delimitMate tpope/vim-surround vim-scripts/AutoComplPop Shougo/deoplete.nvim carlitux/deoplete-ternjs marijnh/tern_for_vim Rip-Rip/cl…

That's a useful list, thanks for sharing. What would be useful is if there was just a distribution of Vim that just had everything included for a specific language. Or at least a base and then a way to discover and add more from within Vim.

There are definitely distributions, for instance SpaceVim. I've got my own configs shared in GitHub but I'd prefer not to reveal my identity. I'm sure there are plenty to be found.

Re: Why Vi Rocks

#69
post #28

IntelliJ with the IdeaVim plugin is my goto editor nowadays. As others have said, I honestly don't find myself using the really fancy features of vim that often. What I do use frequently are basic motions together with yanking, deletions, word movement (w/e/b), marks, indents, centering (zz), page scrolls (ctrl+u/d), and using searches (f and /) to jump around in code quickly. For those purposes, IdeaVim works just f…

Have they fixed the issues with where the cursor ends up after certain operations? It's been a couple of years since I've used it, so I can't give an explicit example, but there were multiple common operations where the cursor would end up in a different location afterwards than it does in vim. This was really difficult for me because I still used vim a lot for other things, and it felt like it was actively eroding m…

For the most part it does what I want it to do. As the other responder said, undo/redo can occasionally have some issues if you mix them with the IDE's version of those. I also have problems with the tag stack and jumplist (like ctrl+i/o) having serious latency problems so I stick to marks and `` as much as I can. The last thing I have problems with is when the IDE changes your code for you during an action - for example an auto-import when you type out a new class. The repeat action tends to mess up in those cases, trying to redo both your own typing and whatever the IDE did.

Again, I'm not a power user so to me these are the main issues and they're tolerable. For cursor movements I don't do anything too tricky, and all the movements I'm aware of do what I expect them to do.

Re: Why Vi Rocks

#70
post #14

Vim is like Dvorak. The cognitive burden for remembering which key maps to what is high unless you use it 24/7.

Does anyone use Vim on a Dvorak keyboard?

I did for a long time and I found the switch to be painless. I then replaced most of my daily used software with Emacs.
Post reply on HN