Live data from Hacker News

Vim Anti-Patterns

sanctum.geek.nz

231–240 of 249 posts

Re: Vim Anti-Patterns

#231

Earlier quoted context omitted.

I used vim for everyday use for almost ten years before I realized that navigating around with the keyboard would never be as good as clicking a mouse. All the mental overhead of trying to be efficient with vim, for me at least, ended up being a bit of a false oasis. I happily switched to Sublime for two years and then VS Code. I still use emacs with Clojure though.

Similar story here. I use IntelliJ for Java and Emacs for Clojure. We're porting our codebase from Clojure to Java at work, so soon it'll all be IntelliJ, which will be pretty sweet. I do kinda miss Paredit, but IntelliJ makes up for it with lots of other pretty sweet features.

Out of interest did you try using the Vim plugins for Clojure?

I'm only playing, but found a good set-up with vim-fireplace; vim-clojure-highlight; vim-sexp; Vim-sexp-mappings-for-regular-people; vim-surround and luochen1990/rainbow

Re: Vim Anti-Patterns

#232
post #26

These are all good tips but most of the anti-patterns seem to skew towards beginners ( e.g. don't use the arrow keys, don't navigate in insert mode). One that I think is more common among intermediate, and even advanced, users is the misuse of tabs, windows, and buffers. A lot of people have a tendency to think of each tab as corresponding to a single open file. This is very understandable because it closely matches…

For any Windows devs that happen to use vim inside of mintty (that comes with downloading git), you'll discover that installing fzf doesn't work out so well. It'd be fine on cygwin, surely. In mintty, though, it'll yell about missing ncurses and then offer to install the legacy Ruby version, which also fails for curses related reasons. So, that said, check out ctrl-p. https://github.com/ctrlpvim/ctrlp.vim It's a nice…

> vim inside of mintty (that comes with downloading git),

Is git for windows using msys2 yet? If not, do yourself a favor and start using msys2 instead. It has packages for git and vim, and it uses pacman for pacage management. I've had a great experience using it.

Re: Vim Anti-Patterns

#233

Earlier quoted context omitted.

Yeah, scripting a huge focus in emacs: they say it's a scripting environment that happens to have a text editor embedded in it. I don't know who "they" are, but they're quite perceptive. Some lisp experience (especially CL) can help with learning elisp, but it's entirely possible to do so without it. The process of learning emacs is roughly this: -Launch emacs -Run through the tutorial -Learn the shortcuts and gain g…

Haha, you described many things perfectly! But what drove me the most towards emacs despite being suitable for FP, huge amount of tweaking and customizability it provides. And it felt much better doing it in Elisp than Vimscript. Everything has it's good and bad sides, that is normal imho. But really nice comment! :)

> Vimscript

I'd go so far as to say that if you _don't_ feel comfortable using vi "out of the box", you probably should steer toward something else - vi is just not customizable like other editors/IDEs are.

Re: Vim Anti-Patterns

#234

Earlier quoted context omitted.

For any Windows devs that happen to use vim inside of mintty (that comes with downloading git), you'll discover that installing fzf doesn't work out so well. It'd be fine on cygwin, surely. In mintty, though, it'll yell about missing ncurses and then offer to install the legacy Ruby version, which also fails for curses related reasons. So, that said, check out ctrl-p. https://github.com/ctrlpvim/ctrlp.vim It's a nice…

> vim inside of mintty (that comes with downloading git), Is git for windows using msys2 yet? If not, do yourself a favor and start using msys2 instead. It has packages for git and vim, and it uses pacman for pacage management. I've had a great experience using it.

This looks really promising. Thanks. And Git for windows is using mintty, which is a terminal emulator for cygwin, msys, and msys2, but I'm not really sure what is being provided/used. A buncha unix tools and definitely not a package manager.

And for those unaware:

> MSYS2 is an independent rewrite of MSYS, based on modern Cygwin (POSIX compatibility layer) and MinGW-w64 with the aim of better interoperability with native Windows software.

> The name is a contraction of Minimal SYStem 2, and aims to provide support to facilitate using the bash shell, Autotools, revision control systems and the like for building native Windows applications using MinGW-w64 toolchains.

> We wanted a package management system to provide easy installation of packages, and ported Arch Linux's Pacman. This brings many powerful features such as dependency resolution and simple complete system upgrades, as well as providing the build system - makepkg{,-mingw} - which is used to make these packages

Also: http://stackoverflow.com/a/25023611/463678

Github: https://msys2.github.io/

Re: Vim Anti-Patterns

#235

Earlier quoted context omitted.

> vim inside of mintty (that comes with downloading git), Is git for windows using msys2 yet? If not, do yourself a favor and start using msys2 instead. It has packages for git and vim, and it uses pacman for pacage management. I've had a great experience using it.

This looks really promising. Thanks. And Git for windows is using mintty, which is a terminal emulator for cygwin, msys, and msys2, but I'm not really sure what is being provided/used. A buncha unix tools and definitely not a package manager. And for those unaware: > MSYS2 is an independent rewrite of MSYS, based on modern Cygwin (POSIX compatibility layer) and MinGW-w64 with the aim of better interoperability with n…

Msys2 also has mintty, and I can attest that tmux works great, if that's a consideration. This is pretty much where I spend my days (Msys2 / mintty / tmux / vim) when I have to work in Windows.

Re: Vim Anti-Patterns

#236
post #230

Earlier quoted context omitted.

Run setxkbmap in your .xinitrc if applicable: setxkbmap -option caps:escape Linux desktop environments’ keyboard configuration tools should also let you do this.

I am using Windows. Is there a lightweight solution to map Caps Lock to Escape on Windows?

Copy and paste the below into a .reg file and run it. I used Sharp Keys ( https://sharpkeys.codeplex.com/ ) to create it, but since every major Windows 10 update resets your key mappings I just extracted it from the registry and double click the reg file after each update.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout] "Scancode Map"=hex:00,00,00,00,00,00,00,00,02,00,00,00,01,00,3a,00,00,00,00,00

Re: Vim Anti-Patterns

#237

Earlier quoted context omitted.

This looks really promising. Thanks. And Git for windows is using mintty, which is a terminal emulator for cygwin, msys, and msys2, but I'm not really sure what is being provided/used. A buncha unix tools and definitely not a package manager. And for those unaware: > MSYS2 is an independent rewrite of MSYS, based on modern Cygwin (POSIX compatibility layer) and MinGW-w64 with the aim of better interoperability with n…

Msys2 also has mintty, and I can attest that tmux works great, if that's a consideration. This is pretty much where I spend my days (Msys2 / mintty / tmux / vim) when I have to work in Windows.

Is there a popular convention for using something like this or cygwin, in that it has its own $HOME, and I have a buncha dotfiles in my Windows user home?

Possibly just symlinking it all over to MSYS $HOME?

I am definitely happy about being able to install tmux.

edit: just seems like I should ditch what I was doing in windows home, because git bash used the same home and I had everything there. ssh stuff, git config, inputrc, .vim, etc. But if I'm no longer using git bash, no need.

edit: sadly git runs very oddly in this. not sure what git bash is doing differently, but I'm comparing .64 seconds for a git status, versus over a minute with MSY2. weird.

Re: Vim Anti-Patterns

#238
post #26

These are all good tips but most of the anti-patterns seem to skew towards beginners ( e.g. don't use the arrow keys, don't navigate in insert mode). One that I think is more common among intermediate, and even advanced, users is the misuse of tabs, windows, and buffers. A lot of people have a tendency to think of each tab as corresponding to a single open file. This is very understandable because it closely matches…

Thank you for the tabs and buffers reminder, that is something that I should keep in mind now that I'm using Vim on a 4K monitor. At that scale, it feels perfectly natural to have 9 to 12 windows open, so that all of the sources that I might need to even consider are within my field of view.

I just wish I had more control over window layouts. Something like the controls of a good tiling window manager, like I3. There is just no way to open 12 files in a list of windows, and then arrange them into a sort of rectangle tree, but I prefer to open all the files I will need at once from the command line, using globbing operators and brace expansion.

Re: Vim Anti-Patterns

#239
post #26

These are all good tips but most of the anti-patterns seem to skew towards beginners ( e.g. don't use the arrow keys, don't navigate in insert mode). One that I think is more common among intermediate, and even advanced, users is the misuse of tabs, windows, and buffers. A lot of people have a tendency to think of each tab as corresponding to a single open file. This is very understandable because it closely matches…

> One that I think is more common among intermediate, and even advanced, users is the misuse of tabs, windows, and buffers.

The author addresses that, too, in https://sanctum.geek.nz/arabesque/vim-misconceptions:

> The model Vim uses for [tabs and windows](https://sanctum.geek.nz/arabesque/buffers-windows-tabs) is rather different from most GUI editors, but both are supported and have been for some time.

Re: Vim Anti-Patterns

#240

Earlier quoted context omitted.

Msys2 also has mintty, and I can attest that tmux works great, if that's a consideration. This is pretty much where I spend my days (Msys2 / mintty / tmux / vim) when I have to work in Windows.

Is there a popular convention for using something like this or cygwin, in that it has its own $HOME, and I have a buncha dotfiles in my Windows user home? Possibly just symlinking it all over to MSYS $HOME? I am definitely happy about being able to install tmux. edit: just seems like I should ditch what I was doing in windows home, because git bash used the same home and I had everything there. ssh stuff, git config,…

> edit: sadly git runs very oddly in this. not sure what git bash is doing differently, but I'm comparing .64 seconds for a git status, versus over a minute with MSY2. weird.

Yikes! I work on a fairly compact codebase, so I've never waited more than a minute for anything except sometimes when fetching. (For that I blame the network, but I could be wrong.) Other operations seem snappy, and tig is pretty responsive. That being said, I haven't benchmarked against git for windows, so I could be wrong about that. Sorry to hear it's so laggy for you!

Post reply on HN