Vim Tips And Tricks Some Of My Favorite Vim Commands

แชร์
ฝัง
  • เผยแพร่เมื่อ 20 พ.ย. 2024

ความคิดเห็น • 151

  • @_lessthanzero_
    @_lessthanzero_ ปีที่แล้ว +77

    vab - selects content within parenthesis () along with it
    vib - selects only the content within parenthesis
    vaB - for {}
    vib - for {}
    % will help to jump between matching brackets, tags for that matter anything
    D - deletes from cursor position to the end of the line
    Y - copys till the end of the line
    xp - really helpful to swaps letter like , bnigo --> bingo
    gj - normally vim skips the line if its wrapped. gj helps to go down for that
    gv - selects the previously selected part in visual mode.
    gf - jumps to the file when on the file path.
    For Web developers
    cit will jump into the tag.
    vit will juno into the tag in visual mode

  • @howard-c6h
    @howard-c6h ปีที่แล้ว +33

    Long time vim user here, here are some commands I can't live without that weren't mentioned:
    1. Use A key to goto the end of line and I key to go to the start of the line.
    2. The f key and t key to navigate in normal mode and to manipulate text in inset mode(paired with the c and d key).
    3. Use "ciw" instead of "diw" to delete and go to insert mode.
    4. Bind "jk" and "kj" to so you can save your pinky.
    5. The C key, D key and "cc".
    After 20 years of using vim, my advice is to try to stay in normal mode as much as possible, and you'll find yourself blazing fast.

    • @VortexFlickens
      @VortexFlickens 5 หลายเดือนก่อน

      New vim user here!
      I use neo vim with auto completion especially for C. My biggest frustration is that I make a lot of errors in insert mode. And I always feel and tend to using the the Arrow Keys to fixing these errors which could be typos. Secondly neo vim auto completes parenthesis and and makes my cursor inside it! How do I get outside those parenthesis or any blocks without using arrow keys without escape (I tried ctrl+o but that's also bit hard). Any tips on how u proceed in these situations?
      What do u use for auto completion (tab/enter or ctrl+y)?

    • @philpeko1796
      @philpeko1796 หลายเดือนก่อน

      @@VortexFlickens You might wanna find out with ":help insert-mode" which BTW contains ":help compl-autocomplete". Peace & Prosper 🤝🖖

    • @scoopy-poop
      @scoopy-poop 11 วันที่ผ่านมา

      Wow I didn’t know about capital i that is a life saver. I remapped caps lock to esc on tap and control on hold, do you think my pinky will still hurt in the long run compared to using the actual escape key(most top left key on keyboard) to escape. Been using vim for 3 months and I love it. I already feel like I move way faster than with keyboard and mouse.

  • @Liamnissan22222
    @Liamnissan22222 ปีที่แล้ว +36

    “I love vim!”
    Sets EDITOR to eMacs 😂

  • @im_sreyas
    @im_sreyas ปีที่แล้ว +38

    in vim there is actually a lot of things you can do
    diw - delete inside word (delete a word)
    daw - delete around word(deletes a word including the whitespace)
    you can also use 'W' it will also do the same but it will consider a word as a collection of characters surrounded by whitespace
    di{ - delete the content inside {}
    di( - delete the content inside ()
    da{ - delete inside {} including the {}
    like this there are more (di", di'..etc)
    instead of i (inside) or a (around) you can also use s ( surrounding )
    it will delete the surrounding characters you are mentioning
    most of these is useful for programmers
    instead of d you can use c ( c stands for change )
    it will go to insert mode after the operation is done, but d will stay in normal mode
    use y instead of d and c, then you are doing yanking (copy) all the other are same
    also you can use v (it is for visual mode - for selecting text)
    for line search you can use f and F, it will find a purticular character in a line and then you can use ; and , to move forward and backword through that search character if there is more, f is for searching after and F is for searching behind
    also there is t and T - f stands for find, and t stands for till it will also find but wont go to that character, instead a character behind the actuat character you are mentioning, it will make sense when you do operations like delete, for example you can do dta ( it will delete the characters from where you are till the character 'a' or delete till character 'a') if you use f then the character a will also be deleted.
    instead of line you can search in entire document using /searchword and ?searchword (/ is for searching forward and ? is for backword)
    then you can use n to move throught that search forward and N for backword
    next time if you want to search the same keyword or searchword just press / and enter
    for the basic movement you can use j (down), k (up), l (right), h (left), all the keys are available in home row
    then moving faster using
    w - word -> word -> word
    e - end of each word
    b - move word backword or beginning
    you can also use numbers, it can be considers as a multiplication,
    if you do 2j it will jumb two words down (nj , where n is a number)
    this is not only possible with j k l h , but also with almost every command i have told earlier
    for example i need to delete two word then i can do d2w..etc
    there is also combination of commands like dd, yy, cc...etc
    dd will delete a line
    yy will yank(copy) a line
    cc will delete a line then go to insert mode ( while d stay in normal mode)
    this can also be combined with number like 2dd ( delete two line or d2d...etc)
    for doing number combined operations it is better to do set the numbering to relative rather than normal numbering,
    don't get what i said, right? just look at the video, he is using relative numbering rather that continueous,
    for that just do :set relativenumber ( we are now using ex commands, ex commands starts with a : )
    you can use :edit or :e for creating or editing file
    eg. :edit newFile.js will create a file if not exist in the current path or will go to edit the purticular file if exist
    you can do :w for writing the file :q for quiting the file or just :wq for write and quit
    also you can do global replacement in the document by using :%s/textThatShouldBeReplaced/newText
    now how can we move from normal to insert mode, most of the people will do ( i )
    but there are more
    i - insert mode ( it will put the cursor before the character you are in)
    a - around ( it will put the cursor after the character you are in)
    I (capital i ) for insertig at the start of line
    A - insert at the end of line
    these are used to go from normal mode to insert mode, where you can type like you do in a normal text editor...
    use % for going to end of line and ^ for going to start of line (where first character starts)
    0 for going to actual starting position or 0th column
    esc, control + c, control + [ --- can be used to go to normal mode from insert mode
    there is a lot like this...
    some tips from me :
    you can remap the key binding as you want, but if you are a programmer and you are using different text editrors then it is not recommended....
    the reason is, i am using vs code as my main text editor for all my works, i often use ide's....
    so when i am using other editors or using the computer of someone else, it is really hard because in first
    i have remapped my keys in different way because some of them are not acceptable for me, like the esc key,
    are you kidding me, i can't even reach the esc key, so i remapped it into jj, so i just need to type jj to go to normal mode,
    now it is pretty much easy, but the problem will really happen when changing editor or computer because the remapping json file is in my computer or in the vs code and it is a bit time comsuming to set up or just add all those keybinding to other editors or ide's and it may be easy for vs code configuring but not for other ide's,
    it is sure that vim extension is available at almost everywhere, but the remapping is done in different ways in different application, this problem happended to me when i have used the android studio, vim is available there in the name of ideavim,
    but i dont know how to configure or remap the keys or else you need understand it in the way of vim, because i guess vim offerese key remapping commands so you just need to use some ex commands to do that, but on that time learning any of this is time comsuming,
    also when i use others computer i use jj all the time to go to normal mode, and then it will print to screen because vim is not installed on there computer and even if it is installed, i need to remap it, if the remapping is not needed, then i could have been installed vim and used on there computer.
    do you know how harder it is to use the arrow keys to move around if you are a vim user,
    so all of the things above mentioned can be avoided by simply using default configuration. and i am now using default configuration.
    using touch typing + vim + some practice you can become god in handling file and text.
    nobody will even get understand what you are doing, they will be amazed of yours speed.
    im on the way to become that god, just need to have some practive because i have changed on the default configuration in the last week,
    also vim is really good for touch typers.... because they don't like to leave from there home row like me....☺

    • @Yupppi
      @Yupppi 10 หลายเดือนก่อน +2

      From vim tips and tricks video to the full vimtutor paraphrasing starting from the first chapter.

    • @daveqr
      @daveqr 8 หลายเดือนก่อน +1

      Insanely useful comment.

    • @im_sreyas
      @im_sreyas 8 หลายเดือนก่อน

      @@daveqr Thanks ....❤️

    • @champx5
      @champx5 หลายเดือนก่อน

      is there a way to save comments??

  • @MasterHigure
    @MasterHigure ปีที่แล้ว +39

    Indenting python scripts with = is difficult because the indentations define the ends of blocks. In bash you have keywords to define both ends of a block, and in C-family syntax it's curly braces. So the indentation itself carries non-superfluous meaning in Python, while in many other languages it can be unambiguously determined by the code in the immediate surrounding.
    Using c (for "change") instead of d (for "delete") puts you right into insert mode after the deletion, no matter what kind of deletion you do. And when deleting a word, note that dw and cw only delete from the cursor and out. daw and caw take the entire word.
    Finally, da" includes the quotation marks, as opposed to di".

  • @JorgeDB
    @JorgeDB ปีที่แล้ว +20

    One thing I like a lot is pressing f and then a character to find the next instance of the character in that line, and F to find the previous one. This also works with delete: df( will delete everything from your cursor to the first opening parenthesis it finds (including it).
    And t can do the same, but stopping before reaching the character: dt( will delete from the cursor to the character before the next parenthesis and dT( will delete from the cursor to the character after the previous parenthesis.
    Edit: Forgot to mention, you can use I (capital i) to enter insert mode at the beginning of the line (technically, before the first non-blank character) and A to enter insert mode at the end of the line.

    • @fincali197
      @fincali197 ปีที่แล้ว

      and also, at the very beginning, you could use alt+j instead of ddp

    • @IreizD
      @IreizD ปีที่แล้ว

      @@fincali197 Is that really standard vim behavior? I use a plugin for that.

    • @fincali197
      @fincali197 ปีที่แล้ว

      @@IreizD yeah sorry, I was using LazyVim at the time. I think it's possible without a plugin though.

  • @paskuini
    @paskuini ปีที่แล้ว +13

    Hi derek! Linux user from spain here, sorry if my english is a little basic. I started learning vim (and awesome wm) with your videos (i've thought on learning it many times before and ended up not bothering) and i am loving how versatile it is, i never understood why it was so 'famous' until now. Thanks for sharing your knowledge on this, i am enjoying like a child with your content. And also thanks for sharing the keystrokes on this video, it was so helpful

  • @dereklomax161
    @dereklomax161 ปีที่แล้ว +8

    Life changing commands that blew my mind
    dap to delete a paragraph
    O to open insert mode on the line above

    • @jp62200
      @jp62200 ปีที่แล้ว

      And o for below

  • @balmar3
    @balmar3 ปีที่แล้ว +5

    f and F (t and T) to find characters in line. Then repeat with ; or ,. Can also combine with visual/delete/replace commands.
    g; and g, to move among the recent changes.
    ctrl+v for visual block.
    ctrl+a and ctrl+x for advancing and decreasing a number (including dates with the speeddating plugin!)
    . to repeat the last action.
    Macros. An additional level of zen power.
    Programmed hot keys with space being the leader. Can add signatures, insert timestamps, open file read-only in new tab, call a function, a compiler or a script on the file (LaTeX it, calculate math expressions from within Vim, search for certain patterns).

    • @fejiberglibstein
      @fejiberglibstein 8 หลายเดือนก่อน +1

      i did not know about g; and g,, thats so cool

  • @jed_hed2474
    @jed_hed2474 ปีที่แล้ว +21

    Ctrl + c serves the exact same function as the ESC key but you don't have to move your hands to execute. Similarly, Ctrl + i performs an indention. Really handy when the tab key is just bouncing you around or if you want to keep your hands on the main keys

    • @Cathyprime
      @Cathyprime ปีที่แล้ว +11

      not exactly, if you have something bound to work on switching to normal mode, or just escaping, it will not trigger when pressing ctrl + c. ctrl + [ on the other hand works exactly the same as ESC key

    • @sub-harmonik
      @sub-harmonik ปีที่แล้ว +1

      lunarvim maps 'jk' to go to normal mode and in english that makes some sense imo. that way you don't have to move to the escape key either

    • @rafalg87
      @rafalg87 ปีที่แล้ว +5

      Every OS allows changing CapsLock to work like Esc now, so that's the best option IMO.

    • @gnuemacs1166
      @gnuemacs1166 ปีที่แล้ว

      Ctrl [ is sec not ctrl c as someone else has said

    • @Cathyprime
      @Cathyprime ปีที่แล้ว

      @@gnuemacs1166 Holy molly is that the GNU/Emacs the best operating system?

  • @johansmolinski
    @johansmolinski ปีที่แล้ว +1

    Commenting out every line of current file, in normal mode: ggGi# and to reverse it, ggGx (where means Ctrl+v).

  • @steeeeeeeeeeep2189
    @steeeeeeeeeeep2189 ปีที่แล้ว +4

    2:16 to swap lines you can use M-, what's interesting is how you can swap parts of text in visual mode with just selecting text

  • @zerotheory941
    @zerotheory941 ปีที่แล้ว +6

    Gotta spread that Vim love!
    I'm shocked by how many people have at least heard of vim because of the "how to exit vim" meme even if they don't understand why it's funny.

  • @dragonsage6909
    @dragonsage6909 ปีที่แล้ว +9

    I've used Vim every day, for the last 20 years, I'm still learning new tricks.. it's the cats meow..
    Thanks for this, I've learned a few new ones.

  • @ringo8410
    @ringo8410 ปีที่แล้ว +25

    A handy delete command that DT missed or forgot. Say you want to delete lines 6 through 14 in a document. In normal mode, type :6, 14d and enter. The lines will be deleted "in place" without having to use dd on each line.

    • @MasterHigure
      @MasterHigure ปีที่แล้ว +12

      Or put the cursor on line 6 and press either 9dd (delete the current line 9 times successively) or d8j (move the cursor 8 lines down and delete every line you come across, including starting and ending line).
      This is a lot easier with relative line numbers.

    • @ringo8410
      @ringo8410 ปีที่แล้ว +3

      @@MasterHigure Cool, I didn't know that trick. Vim is more of a journey than a destination.

    • @gungun974
      @gungun974 ปีที่แล้ว +5

      Personally to delete a bunch of line, I go to visual line mode (Shift V) then a select my lines with up or down (j ou k) and I just press delete (d).

    • @LDavis
      @LDavis ปีที่แล้ว +1

      ​@@ringo8410 that is the truth, my friend, vim IS a journey

  • @johansmolinski
    @johansmolinski ปีที่แล้ว +1

    I've been using vim since around 2000, still learning things now and then. Didn't know Ctrl+w in insert mode for instance. Thanks for that! :) I'll give back this: In insert mode, start writing a few characters of a word that exists within the file (or another file opened in this session), hit Ctrl+n and it will autocomplete it.

  • @teksaucee
    @teksaucee ปีที่แล้ว +3

    As a new vim user this could'nt not come at a better time 😅 slowly getting into it , there's so much keybinds 😆

  • @Nicfallenangel
    @Nicfallenangel ปีที่แล้ว +4

    One feature I use regularly is ":s" this runs search and replace in the file like the sed command. You need to specify a range to use it, but there are a couple shortcuts built into command mode that make it easy:
    If you select lines with visual mode and then start command mode with :, vim automatically adds "" meaning run the command on the selected lines.
    You can manually select the lines with :[START],[STOP] so for example ":3,5" will run the command on lines 3 through 5.
    Entering a percent sign (%) in command mode runs the command on the whole document.
    Back to the s command, I use it to replace multiple instances of a variable or keyword. For instance, I named a variable "big_name" and I want to make it "common_name" in the whole file that's easily done with:
    :%s/big_name/common_name/g
    Just like the command line sed application, the "s" command understands regex queries:
    :%s/^#\s*//
    Will remove all "hash" markings at the beginning of lines, so it will uncomment any line in the file that starts with "#" and any number (including 0) of white space characters after it.

    • @anon_y_mousse
      @anon_y_mousse ปีที่แล้ว +1

      And if you add c to the end of the line with :%s it will ask about each replacement so you can reject it selectively.

    • @albert3407
      @albert3407 ปีที่แล้ว

      can you do a video where you explain that please

  • @oalfodr
    @oalfodr ปีที่แล้ว +4

    I have never even thought to compare vim with simple text editors. I do often compare it with IDEs like vscode or eclipse. And usually wins for me

  • @terry1311
    @terry1311 7 หลายเดือนก่อน +1

    Great tips!
    Here's another useful one: colon x enter - save and exit, replaces colon wq enter. One keypress saved 🙂

    • @dracbyte
      @dracbyte 3 หลายเดือนก่อน

      I was a fan of :x until I discovered ZZ.

  • @krzysztofwaleska
    @krzysztofwaleska ปีที่แล้ว

    I learned a lot of new things. Not all useful, because my fingers are encoded with alternatives that I know and like, but many are new to me. Nice work! When MS Word appeared, few people around me speculated that it will never be as useful as vim already is. Different times, different needs.

  • @programmingloop7
    @programmingloop7 6 หลายเดือนก่อน

    I'm learning Vim and I find it useful and fun, like the copy or delete inside quotes, but some of these commands are also simple in vscode.
    Uncomment line (can be anywhere in the line not just in the comment character): *cmd+?*
    Move line down or up once or many times: *Option + up or down arrow*
    Delete whole file (Similar in almost all OS): *cmd+a then backspace*
    Delete previous word: *option + backspace*
    Delete everything before cursor: *cmd+backspace*
    The indentation vscode can do automatically on save and also code formatting, deleting white space etc
    This is not a knock on vim as I already stated I like vim. The only command I saw that to my knowledge is not as simple in vscode is the editing inside of quotes or brackets etc. That's pretty useful and I'm adding that to my workflow

  • @richardgill7781
    @richardgill7781 ปีที่แล้ว +2

    To close the help buffer, actually you can close it like any other buffer, so :q (to me easier and faster than Ctrl+W c)

  • @matk2283
    @matk2283 11 หลายเดือนก่อน +1

    Excellent tips and short cuts on vim. appreciate posting this,
    Mathew from Colorado

  • @chaitanyashahare2734
    @chaitanyashahare2734 ปีที่แล้ว

    in escape mode , gq will split a long line into multiple lines

  • @MakingStuffWithEvan
    @MakingStuffWithEvan ปีที่แล้ว +1

    Control O in insert mode is a game changer. Thanks!

  • @boyscout399
    @boyscout399 ปีที่แล้ว +2

    My two favorite commands are ZZ instead of :wq and binding jj to exit insert mode

  • @benj6964
    @benj6964 ปีที่แล้ว +1

    Now I've known all these commands for a couple of years I miss the good time when I would watch these videos and be mind blown by vim...

  • @jeromegay9865
    @jeromegay9865 ปีที่แล้ว +8

    Hey DT, thanks for this video. Even though it's not mindblowing, I realized over the years that very few people know that ":x" (think 'exit') does the same as ":wq"
    Part of the vim-way is using the shortest command and in this case, you reduce the number of keystrokes by a whooping 33%!
    Been following you for years, I love your content!
    Greetings from Paris, France

    • @BitJam
      @BitJam ปีที่แล้ว +4

      I use "ZZ" for this which is very convenient on a US keyboard because "z" is next to the shift key. It's less convenient on a French keyboard.

    • @jochen7919
      @jochen7919 ปีที่แล้ว

      I always use ZZ even though it requires both hands on my keyboard layout.

    • @jeromegay9865
      @jeromegay9865 ปีที่แล้ว

      @@BitJam Thanks, good tip! And works for me too, I've been using US keyboards for years

    • @jp62200
      @jp62200 ปีที่แล้ว +1

      ZZ has the advantage of not modifying file date if no modifications was done.

  • @nicholek11
    @nicholek11 ปีที่แล้ว +4

    Thing that really helped me is you can pipe output into vim which is nice for some syntax highlight
    echo "whatever" | vim -

    • @jp62200
      @jp62200 ปีที่แล้ว

      You can execute a command and paste it inside vim also
      :r!
      Example
      :r!ls -l

  • @Yupppi
    @Yupppi 10 หลายเดือนก่อน

    yip/yap was god damn awesome to learn. I learned ci{ instead of di{, didn't consider they're basically the same in this context. But also ce and cE were quite nice. And using f or F in combination of other motions. And finding out that if you start the motion with alt, it'll put you back to the normal mode without escaping. And the number modifiers are obviously must, very basic but convenient. A must be my favourite though, nothing like adding that ; right where it belongs. Or = to indent the line automatically in the correct place! Ctrl+u or d are also really nice to quickly browse the document. Nvim has just made life so nice, especially when programming on a laptop where I definitely don't want to use the mouse. Shift+v as well, getting the whole line is so practical. Like Vy for repeating code lines that need only minor variation. And jumping paragraphs to empty line with { and }.
    Almost forgot but finding the start of the codeblock and then jumping back and forth with % is also so handy many times. Not only to find the other end but for editing too.
    You know it's a great video if all the motions that are your favourites are mentioned. When I started learning, I wrote all the motions I wanted to use on a note file, ended up roughly 100 lines long. Then tried to start using them even if it would take me longer to think about it and how the combination goes than to manually walk there. It's initially slowing you down but feels rather satisfactory to remember the neat motions and start getting faster on them, and have them come from the backbone more often. Honestly I found everything about vim mind blowing after I learned how to quit vim. I actually was for real the guy who got stuck in vim back when I was on the introduction class inside unix and accidentally opened a file in vim. I'm so glad I got turned and decided to try and dive in, because even after a week it felt impossible to go back. Vscode felt so slow and mouse heavy.

  • @alexeiz
    @alexeiz ปีที่แล้ว +1

    Always learning something new with DT.

  • @khalilovitch_
    @khalilovitch_ ปีที่แล้ว +3

    Learning vim is the best thing that happened to me as a linux user !

  • @MsDuketown
    @MsDuketown ปีที่แล้ว

    I always confuse they VIM commands with the BSD commands.
    Thanks for the visuals along the cheatsheet. I like reading and listening at the same time.

  • @hectorrbv
    @hectorrbv ปีที่แล้ว

    I've been using vim somewhat regularly for several months now and I didn't know most of this stuff

  • @김담천
    @김담천 11 หลายเดือนก่อน +1

    Most of vim's functions appear to be possible in the IDE using keys such as home, end, ctrl, alt, and shift. Are there any use cases that would never be possible in an IDE, but would be very useful?

    • @lipfried
      @lipfried 9 หลายเดือนก่อน

      Yeah, like praising the possibility of deleting everything in the document as if this is unique to vim when you can do just ctrl+a+del in every other editor... kind of tells me that vim of overrated. Don't get me wrong, it may be the best editor ever... but if this is the kind of things people say that makes if better, then I might not believe them anymore...
      I don't know, swapping lines with alt+up/down, commenting lines with ctrl+;, deleting a line from a specific character is usually just shift+end+del... pretty easy to me, specially because shift, ctrl and alt are right at your little finger's reach, so you don't even have to go out of your way to reach them.

  • @AceofSpades5757
    @AceofSpades5757 ปีที่แล้ว +1

    VIM IS THE GREATEST EDITOR OF ALL TIME

  • @AliensInc.
    @AliensInc. ปีที่แล้ว +1

    Love this, more of this would be nice

  • @patrickprucha5522
    @patrickprucha5522 ปีที่แล้ว

    Excellent video. Thanks very much

  • @netstreamer1
    @netstreamer1 2 หลายเดือนก่อน

    My favorite and easiest ways to quit from vim are pressing ZZ (quit and save) or ZQ (quit without saving)

  • @improvisedchaos8904
    @improvisedchaos8904 ปีที่แล้ว +1

    Like most things in life; I picked my editor of choice based on the memes online. Gentoo btw

  • @keithmcgavin5396
    @keithmcgavin5396 ปีที่แล้ว +4

    To highlight and insert hash symbols to the beginning of consecutive lines (or the hash can be any word/letter)
    Ctrl + v , j , j, j, j, I, #, Esc
    Likewise to delete
    Ctrl + v , j, j, j, j, x

  • @adibhanna
    @adibhanna ปีที่แล้ว +1

    this is awesome! what tool do you use to show the key presses?

    • @DistroTube
      @DistroTube  ปีที่แล้ว

      'screenkey' It's in everybody's repos.

  • @anon_y_mousse
    @anon_y_mousse ปีที่แล้ว +2

    I like to use tabs and line numbers in vim, so in my ~/.vimrc I've got:
    set number relativenumber
    set showtabline=2
    " tabe for opening a file in a tab, just hit enter to make it unnamed
    nmap \t :tabe
    nmap :tabn
    nmap :tabp

  • @silicondecay
    @silicondecay ปีที่แล้ว

    Insert mode: C-e and C-y copy text from lines above and below

  • @gogma9967
    @gogma9967 ปีที่แล้ว

    I strongly suggest adding "map ; :" in vimrc, and of course not the other way around :)

  • @takennmc
    @takennmc ปีที่แล้ว

    Hey DT! Was wondering why you use fish over zsh especially when you talk about window managers and write all these config files to make a custom experience. I feel like you should try zsh.

  • @luigimirabelli5504
    @luigimirabelli5504 ปีที่แล้ว

    Thanks for the video! It's really useful.

  • @Pherecydes
    @Pherecydes ปีที่แล้ว +1

    Your ex() function is a brilliant idea, thanks :)

  • @danielcaland
    @danielcaland ปีที่แล้ว

    Very nice!
    Vim is my favorite editor!
    Question: When you are typing the commands, at the bottom it appears some vim tips/options in red color, how do you do that? Is It some config you did in the vimrc?
    I am not talking about the screenkey app, but the red text that shows some vim options when typing the commands.
    Again,very good video!

  • @sirrobertdowneysenior8080
    @sirrobertdowneysenior8080 ปีที่แล้ว

    @3:57 notepad++ has that feature without forcing you to learn new typing mode and programming language to run a text application.

    • @sudheerkmuhammed6363
      @sudheerkmuhammed6363 ปีที่แล้ว

      Geeks don't do different things they do things differently..

  • @fahimabrar2922
    @fahimabrar2922 ปีที่แล้ว

    I use ci to change stuff in between quotation marks & parenthesis, cw to directly change a word under cursor.

    • @jp62200
      @jp62200 ปีที่แล้ว

      You need to do ciw if you want to change the whole word if cursor is not at begining

  • @Good-and-Geeky
    @Good-and-Geeky ปีที่แล้ว

    I like using gcc to toggle a line comment or number gcc for multiple lines.

  • @streambarhoum4464
    @streambarhoum4464 ปีที่แล้ว

    Heyyyyyyyyyyy DT😂😂😂😂😅
    Is there a program in arch linux for screen annotation and magnifying at the same time?
    Unfortunately gromit-mpx does screen annotation only but not zooming!!!! ???

  • @Redyf
    @Redyf ปีที่แล้ว

    You should make a video about Lunarvim, it's amazing

  • @sandeepvk
    @sandeepvk ปีที่แล้ว

    *.* repeats the last commands. you can use it like a macro. so for example. go to end of line shift A and add ; Now to repeat this action in the next line just do *j.*

  • @BitJam
    @BitJam ปีที่แล้ว +1

    I switched from Emacs to Vim about 15 or more years ago. I love the search commands:
    * search for word under cursor
    # reverse search for word under cursor
    g, go to last change
    n go to next match
    / ? change search direction
    I love the powerful multi-line regular expressions. I like being able to format and indent paragraphs. The ability to record key sequences and then play them back multiple times saves me tons of work. I like having a bunch of buffers I can save boilerplate text in. I'm sure other editors can do all these things but Vim makes it so easy (for me).
    Edit: I love rectangular copy and paste!
    Bonus tip: command line calculator:
    x2 () {awk "BEGIN{ printf \"%4.2f
    \", $(echo "$@" | tr '[]x' '()*' ); }" ;}
    You can use "x" for multiplication (to avoid globbing) and use square brackets for parens.

    • @anon_y_mousse
      @anon_y_mousse ปีที่แล้ว

      I'm curious why you'd calculate that way as opposed to just echo $(( ... )) or echo '...' | bc -ql ?

    • @BitJam
      @BitJam ปีที่แล้ว

      @@anon_y_mousse "$(( ... ))" is very primitive, for example no fractions. I often work in stripped down busybox environments where bc is not available but awk is. The tr command lets me avoid using glob characters in my input which is very convenient. The fixed precision is also convenient for me. O/C I have an x4 version.
      Most of the characters in my function are for these convenience features that don't exist in the alternatives you suggest.
      Use whatever you are most comfortable with. Amazon built their first web sites with C. It's a terrible language for web work but the devs were comfortable with it.
      I've found that sticking with a smaller set of tools that I am very familiar with is better for me that always switching to the best tool for the job.
      BTW: the dc calculator has a built-in function for doing RSA encryption/decryption which is kind of cool.

  • @marshallhank891
    @marshallhank891 ปีที่แล้ว

    I always feel like Walter white is teaching me vim😂

  • @zenitsu2989
    @zenitsu2989 ปีที่แล้ว +2

    Always loved your content, very useful. Thank you :)

  • @mariorpn
    @mariorpn 10 หลายเดือนก่อน

    Amazing tips!

  • @guillaumef9313
    @guillaumef9313 ปีที่แล้ว +1

    q to register key pressed for example qa to register keys then @a to redo all keys pressed!

    • @jp62200
      @jp62200 ปีที่แล้ว

      And
      :normal @a
      To run it on all line of a visual block

  • @mystic_monk55
    @mystic_monk55 ปีที่แล้ว

    Which program is this which is used for keycasting?

  • @CLUBFOOTBALL18
    @CLUBFOOTBALL18 ปีที่แล้ว

    Hi can you pls do different ways to delete a line..

  • @AlbertXuY
    @AlbertXuY ปีที่แล้ว

    S for indent, Ctr-o mode, all others I know🎉

  • @IainNitro
    @IainNitro ปีที่แล้ว +1

    Hey DT. Great video (as always). Was wondering if these key bindings also work in neovim (nvim). Or was this just vanilla VIM? Thanks.

    • @Tile32684
      @Tile32684 ปีที่แล้ว +2

      NeoVim is just vim with some extra features. Everything you'd do in Vim should be the same in NeoVim.
      Keybindings certainly are the same.

    • @_lessthanzero_
      @_lessthanzero_ ปีที่แล้ว +1

      Yes everything will work. Neovim was created with main intention to support vast amount of plugins.

  • @jp62200
    @jp62200 ปีที่แล้ว

    10:26 when pasting from the Linux buffer using the mouse , I do a '':set noai '' so during the paste vim does not auto indent and doesn't add the tabs

  • @chuanqisun
    @chuanqisun ปีที่แล้ว

    Maybe a review on AstroVim?

  • @ShrekBytes
    @ShrekBytes ปีที่แล้ว

    Bro please make a video on how to install Hyprland on Arch using archinstall the minimal way.

  • @streambarhoum4464
    @streambarhoum4464 ปีที่แล้ว

    Hey DTPlease do vidéos for emacs using vim utilities also

  • @Codigger-br2rt
    @Codigger-br2rt 8 หลายเดือนก่อน

    How does Vim clear all tags?

  • @dominikpotulski576
    @dominikpotulski576 ปีที่แล้ว

    thank you

  • @dhavald4359
    @dhavald4359 ปีที่แล้ว

    also check "g;", "g,", "[]", "[[" etc movement keys

  • @wjorgegoszcz7220
    @wjorgegoszcz7220 ปีที่แล้ว +1

    ZQ quit without saving (normal mode)

  • @GabrielCriado
    @GabrielCriado ปีที่แล้ว +1

    My 2 cents: I use :x instead of :wq to write and quit vim

    • @jp62200
      @jp62200 ปีที่แล้ว

      ZZ is good too, if file not modified it will not rewrite it (and change modifications date of the file)

  • @Bogdanko93
    @Bogdanko93 9 หลายเดือนก่อน

    How do you display a cheat sheet after you hit "di"?

  • @TheGodzilla2201
    @TheGodzilla2201 ปีที่แล้ว

    Does anyone know to fix the audio issue that im having while running Zorin. That is the only issue im having

  • @PeIeus
    @PeIeus หลายเดือนก่อน

    16:59 lmaooooooooooooooooooooo

  • @zestynotions
    @zestynotions ปีที่แล้ว +2

    ZZ = exit vim

  • @rawdawg7995
    @rawdawg7995 6 หลายเดือนก่อน

    Great video my friend! Thank you much!

  • @marioschroers7318
    @marioschroers7318 ปีที่แล้ว +1

    Back to vim from Doom Emacs? 😆

    • @SisypheanRoller
      @SisypheanRoller ปีที่แล้ว +1

      You can use both.

    • @DistroTube
      @DistroTube  ปีที่แล้ว +4

      Actually, everything i showed in this video works in Doom Emacs. But I didn't want to demonstrate "Vim stuff" inside "Emacs". That would have been against the rules. ;)

  • @brandon_wallace
    @brandon_wallace ปีที่แล้ว

    Watching this on a smartphone totally rots. I cannot see anything.

  • @nnkbrain
    @nnkbrain ปีที่แล้ว +1

    Hey dt rebuild qtile . It crashed

    • @DistroTube
      @DistroTube  ปีที่แล้ว

      Actually, it is broken for me as well. I suspect I need to rebuild qtile-extras in the DTOS repo due to the recent Python update on Arch. I'll rebuild that and push it out.

    • @DistroTube
      @DistroTube  ปีที่แล้ว

      Fixed. Read this issue on GitLab for the commands. gitlab.com/dtos/dtos/-/issues/180

  • @LucasD.C.
    @LucasD.C. ปีที่แล้ว +2

    yoooo :D

  • @kebman
    @kebman 9 หลายเดือนก่อน

    Sublime Text can most likely do most of this. It's really good, but kinda costly if you want to avoid the nag.

  • @rotteegher39
    @rotteegher39 ปีที่แล้ว

    I put the 666 like just now

  • @fpgaguy
    @fpgaguy 4 หลายเดือนก่อน +1

    I can't take you seriously if you are editing your bashrc and your editor is set to emacsclient

  • @damian_madmansnest
    @damian_madmansnest ปีที่แล้ว

    2:30 cursor movement was so unvimlike 🙃

  • @spas_minkov
    @spas_minkov ปีที่แล้ว

    ...”Vim is great, you can just go to any character and push x and it deletes that character... wow...”And on the other stupid editors you have to to to the character and push "delete" button, how ridiculous that is... (Highly sarcastic)

  • @andrewe4240
    @andrewe4240 ปีที่แล้ว

    For me definitely macros, and the fact that you can make 'em recursive. E.g. to move all the lines containing something to another split I usually go with smth like `/something`, and then `ggqanddhpjl@a`. When there are no more search results, it terminates (same works with other errors).

    • @andrewe4240
      @andrewe4240 ปีที่แล้ว

      Also it can be achieved in a different way with :g and :norm. The former is like substitution, but instead executes some command, and the latter executes a normal mode command.
      With that the aforementioned thingy turns into more readable `:g/something/norm ddhpj`, if I typed that correctly.

  • @_jdfx
    @_jdfx ปีที่แล้ว +1

    basic but useful, to replace some text in the entire document:
    :%s/before/after/g

    • @anon_y_mousse
      @anon_y_mousse ปีที่แล้ว

      Add a c at the end to have it ask about each substitution as well.

  • @tobiadeniji6630
    @tobiadeniji6630 ปีที่แล้ว

    Search and replace example from line 1 to 5:
    :1,5s/word/replacement/g

    • @tobiadeniji6630
      @tobiadeniji6630 ปีที่แล้ว

      1 = first line
      5 = fifth line
      s = search
      g = global

  • @fluca1978
    @fluca1978 ปีที่แล้ว

    :wq! should be ZZ

  • @gingered
    @gingered ปีที่แล้ว

    I use .= to spell check the word I am on.

    • @theodorealenas3171
      @theodorealenas3171 ปีที่แล้ว

      Dot equals? I've heard of some old Vim functionality for spell checking, but there's no way it's the dot key right?

    • @gingered
      @gingered ปีที่แล้ว

      @@theodorealenas3171 pardon me- z= is what I was looking for. "." Repeats the last action, iirc

  • @ninah5603
    @ninah5603 ปีที่แล้ว

    :redir >> nmap.txt
    :silent nmap
    :silent imap
    :silent vmap
    :redir END

  • @theodorealenas3171
    @theodorealenas3171 ปีที่แล้ว

    This was an awesome video. It brings me back to when I didn't know what bashrc is but it sounded so cool that I wanted Linux. I should spend some time ricing my OS sometime.
    Here's something I've been up to in vim lately:
    :e /tmp/a
    insert mode:
    grep something -n -r . | sed 's/:\([^:]*\):/ \1G /'
    normal mode:
    !!sh
    This gives results that look like:
    src/file1 21G And there is something here
    file2 1G var something = 32;
    Then I record 2 macros. One macro goes to the file and line under cursor. The other macro goes back to /tmp/a and one line below and calls the first macro.
    qt0W"gye0gf@gq
    qn (control shift 6) j@tq
    This way, I can do some neat tricks. I needed it a whole bunch and I'll need it plenty more, so I better find a way to automate it more or less.
    Would you be interested to try it out? You do seem to be into that sort of thing.

  • @kebman
    @kebman 9 หลายเดือนก่อน

    Search And Replace from Normal Mode do: `:%s/oldworrd/newword/g`