I was originally a die hard Emacs user, but I started to feel a bit of strain on the whole holding Ctrl+p, Ctrl+n etc. I was trying to find an editor/plugin that can reduce keystrokes or at least the strain. I ran across EVIL for Emacs which is just a Vim emulation and keybindings for Emacs users. Unfortunately I did not like it at first the entire hjkl felt awkward and all those modes - OMG. But after toying around…
I love vim but admittedly ctrl-backspace-backspace is just as fast as d2b and works in nearly any editor. The stuff i really like is stuff as dt. which will delete until the end of the sentence, ie until the period. Or di( which deletes everything inside the parenthesis.
Vim Anti-Patterns
31–40 of 249 posts
Re: Vim Anti-Patterns
#32Thinking I should just bite the bullet. Would mean I could work on a server using Mosh + Tmux as well, which should be rather nice.
What would the current canonical guide be for getting up and running with Vim, with plugins, auto-complete[1], inline linting, multiple carets etc?
[1] Just the ST3-style of parsing out tokens in the same file
Re: Vim Anti-Patterns
#33I was originally a die hard Emacs user, but I started to feel a bit of strain on the whole holding Ctrl+p, Ctrl+n etc. I was trying to find an editor/plugin that can reduce keystrokes or at least the strain. I ran across EVIL for Emacs which is just a Vim emulation and keybindings for Emacs users. Unfortunately I did not like it at first the entire hjkl felt awkward and all those modes - OMG. But after toying around…
others don't seem to like this, but i've found the following global key swaps effective
swap ctrl->alt
LCtrl::LAlt
RCtrl::RAlt
swap capslock->alt
Capslock::Alt
this enables you to hit "ctrl" with your thumb (next to the spacebar), and capslock becomes the new "alt". so no more reaching for that hard to reach LCtrl key with your pinky.Re: Vim Anti-Patterns
#34And here I was undoing and redoing the entire time.
Re: Vim Anti-Patterns
#35I have a programmable keyboard, so I just map escape to be right above tab, where tilde usually is.
Are you using a US-QWERTY keyboard layout? If so you're losing "switch case" (~); close alternatives are 'gu' lowercase, and 'gU' uppercase, not quite the same. And, "goto mark" operator (`); close alternatives is "goto mark, beginning of line" operator (').
Re: Vim Anti-Patterns
#36Re: Vim Anti-Patterns
#37But then I told myself, hey, why not try Emacs? So I've been using Emacs for ~6months now and cannot but notice that community is much more niche and humble compared to Vim. Just look at the sheer number of color schemes available for both editors. And I had to agree, Vim was far superior text editor, but that wasn't enough to keep me away from Emacs, since I gave the advantage to other things (everything else) that Emacs does better.
I tried EVIL mode, and it is amazing, but something just felt wrong using it inside Emacs. I wasn't using either Emacs or Vim. I would often shuffle and mix commands, sometimes I would do :w, sometimes C-x C-s. So I decided to ditch Evil until I get more comfortable with Emacs key bindings. I came to Emacs because of Lisp (and general FP audience is much, much, more based around Emacs, makes sense), amazing tools and plugins which I found more stable, better designed, and it is weird to say this but things just worked with Emacs, things like auto-completion and code navigation (ivy, ace-jump-mode) were really fast, hustle free experiences. Disclaimer, I have never touched older versions of Emacs, spent my time in 24, and now in 25, so many of myths and problems that Emacs got known for over the time, I think, aren't there anymore.
And to sum things up, what is really weird to me is that functional programming is on the rise and every year I see it more and more being adopted, but that doesn't help Emacs audience grow. (Maybe because I am young, and I am nerd often found in nerd communities where things like FP are often praised, but in the real world considered a bit awkward or esoteric.) I showed up at the FP workshop few weeks before in local dev/hacker community place, everybody rocking Sublime Text/Vim, but nobody used Emacs, people were looking at me like I was an Alien. Spacemacs is doing good job at attracting people, but maybe Emacs will stay that programmers/nerd phenomenon, the all-mighty lisp OS, that in the end people often reject or overlook. And why is it like so? I do not know. If somebody can sink into and learn Vim, I don't see a reason why it is different story with Emacs.
Re: Vim Anti-Patterns
#38So I have used ST3 for years now, and I realise that I'm slowly moving toward Vim. I started using Vim shortcuts in Chrome, and now I use Vintageous in ST3. Vintageous is good, but it is incomplete. It can't even do the first examples on this article (ctrl+f / ctrl+b) correctly. Thinking I should just bite the bullet. Would mean I could work on a server using Mosh + Tmux as well, which should be rather nice. What wou…
Re: Vim Anti-Patterns
#39These 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…
So, that said, check out ctrl-p.
https://github.com/ctrlpvim/ctrlp.vim
It's a nice quick way to see a filelist that you can filter, like fzf. You can filter on:
* the whole project, excluding .gitignore stuff
* all open buffers
* Most Recently Used (MRU) file list
In addition to the built in ^p binding, I also add:
nnoremap v :CtrlPMRUFiles
nnoremap b :CtrlPBuffer
Re: Vim Anti-Patterns
#40This is a great resource, but the article is pretty strict on the arrow keys. I would recommend `nnoremap`, over `noremap`, because it only disabled the arrow keys in Normal Mode. The author's explains his rationale in the next section, it's to prevent users from living in Insert Mode. Fair enough. But, when making several relatively close edits, the ability to tap a few arrow keys in Insert Mode is far easier and le…
I don't really disagree with your overall point, the arrows keys are not horrible, but I think for beginners removing all arrow keys is the best approach. I used vim for a while just relying on the arrow keys, and it wasn't until I disabled them completely that I really started to use vim. If I left them on in insert mode, I would have just ended up using them that way, just due to muscle memory. I'd also add that if…
What ultimately worked was to map the triangle `ijkl` like you normally see `wasd` in games.
i
jkl
i -- up
k -- down
j -- left
l -- right
I then added two more keys beyond left and right to skip forward and back by words. i
hjkl;
h -- skip backward to the beginning of a word (ordinarily `b`)
; -- skip forward to the end of a word (ordinarily `e`)
There were some echo effects since I had to replace `i`, but they were manageable. On machines where I don't have my vimrc available I'm still functional, just clumsy. It was definitely worth it.My vimrc: https://github.com/rectang/dotfiles/blob/master/vimextra