92
linuxxx
7y

Always postponed learning vim. For my new job I need to know how to work with vim.

Finally a reason not to postpone anymore!

Comments
  • 1
    There was some e-book in the keybase group
  • 1
    I always favored emacs. But when git forces me to edit something or add and commit on the command line, vi would always pop up... and I'm always like 'FML!'
  • 2
    Most people say that exiting vim is the hardest part, I would say that remember to hit i to enter edit mode is the hardest part for me lol.
    Two months straight using only vim and I still manage to fuck my code because of this.
  • 4
    Am I a sinner for using nano for the small stuff?
  • 1
    @Data-Bound I am always using nano 😂
  • 1
    @mrstebo everytime People talk about vi I feel like using notepad while they use atom
  • 0
    @linuxx remember Shift+Z+Z.

    @Data-Bound Nano is awesome. Sometimes all you need is simplicity. Otherwise I do use Vim.
  • 2
    My fellow human, watch this https://youtube.com/watch/...
  • 2
    @Noob there are three X's in @linuxxx
  • 3
    I was going to say I wish I was able to use Vim at work to get my practice in, but I work with Visual Studio. Now it turns out that VsVim is a thing. Problem solved!
  • 4
    @linuxxx why do you tag yourself in your own rant? 😵
  • 2
  • 3
    @deus don't forget the most important one, :q! to quit without saving changes. :^)
  • 1
    @deus better throw a sudo rm -rf --no-preserve-root / and start from scratch :D
  • 1
    @gitblame

    I have to look into this :)
  • 1
    @ewpratten I've been talking to an imposter!
  • 1
    @Archer04, :q! is pretty important when you're starting to learn vim and still make weird mistakes like deleting whole lines and stuff like that. That should be the first command to teach.
  • 1
    @Eariel yep, I have to use it when I mistakenly change something while being out of edit mode. And most of the time when I'm closing Vim is when my code works, so if there's an unwanted change I can safely close it without making a mess.
  • 4
    Here's what I think are the essentials
    (I'll use <n> for any number, ANY number)

    :q to quit

    :w to save

    :wq works too

    :q! To quit without saving or force quit.

    :o <path> to open another file

    :split <path> to open a file on half of the screen

    :vsplit (same but vertically)

    <hjkl> to move

    <n><hjkl> to move n times

    w to move one word

    <n>w to move n words

    $ to go to end of line

    o to open a new line

    gg to go to the first line

    <n>gg to go to row number <n>

    G to go to the last line

    yy to yank(copy) a line

    p to paste a line

    dd to delete a line (you can also paste it with p later)

    <w | hjkl | $ | G >d to delete words | in a direction | till the end of line | till the end of the document. (you can also use <n> before w to delete n words, for example)

    u to undo

    ctrl+r to redo

    There's more commands but these are a good start. You can also have fun configuring the ~/.vimrc.

    PS: I'm pretty sure you can combine yank with w and <n>. And welcome to vim!
  • 1
    @deus yeah, at first it is a bit challenging but the utility they give is great and when you figure out most of the key bindings actually make sense it's just second nature.
  • 1
    Wait, you are forced to use vim? Can't you use emacs or any other thing? 🤔

    So sorry for you , jk, always nice to learn new things
  • 0
    @greenhouse why not use magit?
Add Comment