Vim Tips And Tricks Some Of My Favorite Vim Commands

Sdílet
Vložit
  • čas přidán 5. 05. 2023
  • I often am asked about why I love Vim so much? In this video, I will discuss some of my favorite Vim commands. These are commands that I find very useful in my workflow, and they are a big reason why I fell in love with Vim.
    WANT TO SUPPORT THE CHANNEL?
    💰 Patreon: / distrotube
    💳 Paypal: czcams.com/users/redirect?even...
    🛍️ Amazon: amzn.to/2RotFFi
    👕 Teespring: teespring.com/stores/distrotube
    DONATE CRYPTO:
    💰 Bitcoin: 1Mp6ebz5bNcjNFW7XWHVht36SkiLoxPKoX
    🐶 Dogecoin: D5fpRD1JRoBFPDXSBocRTp8W9uKzfwLFAu
    📕 LBC: bMfA2c3zmcLxPCpyPcrykLvMhZ7A5mQuhJ
    DT ON THE WEB:
    🕸️ Website: distrotube.com/
    📁 GitLab: gitlab.com/dwt1
    🗨️ Mastodon: fosstodon.org/@distrotube
    👫 Reddit: / distrotube
    📽️ LBRY/Odysee: odysee.com/@DistroTube:2
    FREE AND OPEN SOURCE SOFTWARE THAT I USE:
    🌐 Brave Browser - brave.com/dis872
    📽️ Open Broadcaster Software: obsproject.com/
    🎬 Kdenlive: kdenlive.org
    🎨 GIMP: www.gimp.org/
    🎵 Tenacity: github.com/tenacityteam/tenacity
    💻 VirtualBox: www.virtualbox.org/
    🗒️ Doom Emacs: github.com/hlissner/doom-emacs
    Your support is very much appreciated. Thanks, guys!
  • Věda a technologie

Komentáře • 145

  • @_lessthanzero_
    @_lessthanzero_ Před rokem +57

    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

  • @user-bl8yh5qu1u
    @user-bl8yh5qu1u Před rokem +21

    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 Před 22 dny

      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)?

  • @codyhen8710
    @codyhen8710 Před rokem +19

    “I love vim!”
    Sets EDITOR to eMacs 😂

  • @im_sreyas
    @im_sreyas Před 11 měsíci +32

    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 Před 5 měsíci +1

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

    • @daveqr
      @daveqr Před 3 měsíci +1

      Insanely useful comment.

    • @im_sreyas
      @im_sreyas Před 3 měsíci

      @@daveqr Thanks ....❤️

  • @MasterHigure
    @MasterHigure Před rokem +38

    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".

  • @paskuini
    @paskuini Před rokem +12

    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

  • @terry1311
    @terry1311 Před 2 měsíci +1

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

  • @JorgeDB
    @JorgeDB Před rokem +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 Před rokem

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

    • @IreizD
      @IreizD Před 9 měsíci

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

    • @fincali197
      @fincali197 Před 9 měsíci

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

  • @ringo8410
    @ringo8410 Před rokem +18

    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 Před rokem +10

      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 Před rokem +2

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

    • @gungun974
      @gungun974 Před rokem +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 Před rokem +1

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

  • @dereklomax161
    @dereklomax161 Před rokem +7

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

  • @zerotheory941
    @zerotheory941 Před rokem +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.

  • @krzysztofwaleska
    @krzysztofwaleska Před rokem

    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.

  • @dragonsage6909
    @dragonsage6909 Před rokem +8

    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.

  • @zenitsu2989
    @zenitsu2989 Před rokem +2

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

  • @matk2283
    @matk2283 Před 6 měsíci +1

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

  • @alexeiz
    @alexeiz Před rokem +1

    Always learning something new with DT.

  • @balmar3
    @balmar3 Před rokem +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).

  • @steeeeeeeeeeep2189
    @steeeeeeeeeeep2189 Před rokem +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

  • @nicholek11
    @nicholek11 Před rokem +4

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

    • @jpp62200
      @jpp62200 Před 9 měsíci

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

  • @keithmcgavin5396
    @keithmcgavin5396 Před rokem +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

  • @AliensInc.
    @AliensInc. Před rokem +1

    Love this, more of this would be nice

  • @jed_hed2474
    @jed_hed2474 Před rokem +19

    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

    • @Yoolayn
      @Yoolayn Před rokem +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 Před rokem +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 Před rokem +5

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

    • @gnuemacs1166
      @gnuemacs1166 Před rokem

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

    • @Yoolayn
      @Yoolayn Před rokem

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

  • @teksaucee
    @teksaucee Před rokem +3

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

  • @luigimirabelli5504
    @luigimirabelli5504 Před rokem

    Thanks for the video! It's really useful.

  • @johansmolinski
    @johansmolinski Před rokem +1

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

  • @MakingStuffWithEvan
    @MakingStuffWithEvan Před 9 měsíci +1

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

  • @johansmolinski
    @johansmolinski Před rokem +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.

  • @richardgill7781
    @richardgill7781 Před rokem +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)

  • @mariorpn
    @mariorpn Před 5 měsíci

    Amazing tips!

  • @patrickprucha5522
    @patrickprucha5522 Před 7 měsíci

    Excellent video. Thanks very much

  • @programmingloop7
    @programmingloop7 Před měsícem

    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

  • @oalfodr
    @oalfodr Před rokem +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

  • @fred5459
    @fred5459 Před rokem +2

    7:09 Wow, that was new to me. That's a nice shortcut.

  • @Nicfallenangel
    @Nicfallenangel Před rokem +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 Před rokem +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 Před 10 měsíci

      can you do a video where you explain that please

  • @boyscout399
    @boyscout399 Před rokem +2

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

  • @chaitanyashahare2734
    @chaitanyashahare2734 Před rokem

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

  • @benj6964
    @benj6964 Před rokem +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 Před rokem +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 Před rokem +3

      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 Před rokem

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

    • @jeromegay9865
      @jeromegay9865 Před rokem

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

    • @jpp62200
      @jpp62200 Před 9 měsíci +1

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

  • @danielcaland
    @danielcaland Před rokem

    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!

  • @adibhanna
    @adibhanna Před rokem +1

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

    • @DistroTube
      @DistroTube  Před rokem

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

  • @Yupppi
    @Yupppi Před 5 měsíci

    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.

  • @takennmc
    @takennmc Před rokem

    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.

  • @khalilovitch_
    @khalilovitch_ Před rokem +3

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

  • @MsDuketown
    @MsDuketown Před 7 měsíci

    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.

  • @AceofSpades5757
    @AceofSpades5757 Před rokem +1

    VIM IS THE GREATEST EDITOR OF ALL TIME

  • @streambarhoum4464
    @streambarhoum4464 Před rokem

    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 Před rokem

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

  • @hectorrbv
    @hectorrbv Před rokem

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

  • @dominikpotulski576
    @dominikpotulski576 Před rokem

    thank you

  • @fahimabrar2922
    @fahimabrar2922 Před rokem

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

    • @jpp62200
      @jpp62200 Před 9 měsíci

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

  • @rawdawg7995
    @rawdawg7995 Před měsícem

    Great video my friend! Thank you much!

  • @Pherecydes
    @Pherecydes Před 10 měsíci +1

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

  • @gogma9967
    @gogma9967 Před rokem

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

  • @kebman
    @kebman Před 4 měsíci

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

  • @mystic_monk55
    @mystic_monk55 Před 8 měsíci

    Which program is this which is used for keycasting?

  • @user-fc4qr6xz7o
    @user-fc4qr6xz7o Před 6 měsíci +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?

    • @felipepiaceski5921
      @felipepiaceski5921 Před 4 měsíci

      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.

  • @Good-and-Geeky
    @Good-and-Geeky Před 8 měsíci

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

  • @jpp62200
    @jpp62200 Před 9 měsíci

    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

  • @streambarhoum4464
    @streambarhoum4464 Před rokem

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

  • @chuanqisun
    @chuanqisun Před rokem

    Maybe a review on AstroVim?

  • @RadioTeal
    @RadioTeal Před rokem +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 Před rokem +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_ Před rokem +1

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

  • @CLUBFOOTBALL18
    @CLUBFOOTBALL18 Před 9 měsíci

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

  • @improvisedchaos8904
    @improvisedchaos8904 Před rokem +1

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

  • @TheGodzilla2201
    @TheGodzilla2201 Před rokem

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

  • @guillaumef9313
    @guillaumef9313 Před rokem +1

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

    • @jpp62200
      @jpp62200 Před 9 měsíci

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

  • @eterpaykugml4751
    @eterpaykugml4751 Před 11 měsíci

    Despite all the features and clever scripts, I stick with the default key bindings and settings in order to keep system-hopping less frustrating.

  • @sirrobertdowneysenior8080

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

  • @sandeepvk
    @sandeepvk Před rokem

    *.* 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.*

  • @ShrekBytes
    @ShrekBytes Před rokem

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

  • @Codigger-br2rt
    @Codigger-br2rt Před 3 měsíci

    How does Vim clear all tags?

  • @silicondecay
    @silicondecay Před rokem

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

  • @AlbertXuY
    @AlbertXuY Před rokem

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

  • @dhavald4359
    @dhavald4359 Před 9 měsíci

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

  • @marshallhank891
    @marshallhank891 Před 9 měsíci

    I always feel like Walter white is teaching me vim😂

  • @Bogdanko93
    @Bogdanko93 Před 4 měsíci

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

  • @wjorgegoszcz7220
    @wjorgegoszcz7220 Před rokem +1

    ZQ quit without saving (normal mode)

  • @marioschroers7318
    @marioschroers7318 Před rokem +1

    Back to vim from Doom Emacs? 😆

    • @SisypheanRoller
      @SisypheanRoller Před rokem +1

      You can use both.

    • @DistroTube
      @DistroTube  Před rokem +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. ;)

  • @LucasD.C.
    @LucasD.C. Před rokem +2

    yoooo :D

  • @nnkbrain
    @nnkbrain Před rokem +1

    Hey dt rebuild qtile . It crashed

    • @DistroTube
      @DistroTube  Před rokem

      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  Před rokem

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

  • @GabrielCriado
    @GabrielCriado Před rokem +1

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

    • @jpp62200
      @jpp62200 Před 9 měsíci

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

  • @zestynotions
    @zestynotions Před rokem +2

    ZZ = exit vim

  • @brandon_wallace
    @brandon_wallace Před rokem

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

  • @rotteegher39
    @rotteegher39 Před rokem

    I put the 666 like just now

  • @damian_madmansnest
    @damian_madmansnest Před 7 měsíci

    2:30 cursor movement was so unvimlike 🙃

  • @spas_minkov
    @spas_minkov Před rokem

    ...”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)

  • @anon_y_mousse
    @anon_y_mousse Před rokem +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

  • @BitJam
    @BitJam Před rokem +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 Před rokem

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

    • @BitJam
      @BitJam Před rokem

      @@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.

  • @andrewe4240
    @andrewe4240 Před rokem

    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 Před rokem

      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 Před rokem +1

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

    • @anon_y_mousse
      @anon_y_mousse Před rokem

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

  • @tobiadeniji6630
    @tobiadeniji6630 Před 8 měsíci

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

    • @tobiadeniji6630
      @tobiadeniji6630 Před 8 měsíci

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

  • @fluca1978
    @fluca1978 Před rokem

    :wq! should be ZZ

  • @gingered
    @gingered Před rokem

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

    • @theodorealenas3171
      @theodorealenas3171 Před rokem

      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 Před rokem

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

  • @theodorealenas3171
    @theodorealenas3171 Před rokem

    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.

  • @ninah5603
    @ninah5603 Před rokem

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

  • @kebman
    @kebman Před 4 měsíci

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