home.social

#vimtips — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #vimtips, aggregated by home.social.

fetched live
  1. Stop editing at 10% of Vim's power. Master registers, :norm, fuzzy completion, linematch diff, and 16 more Vim tips and tricks. Tested on latest Vim 9.2.

    Full guide here: ostechnix.com/vim-tricks/

    #Vim #Vimtips #Vimtricks #Editor #Opensource #Linux

  2. Stop editing at 10% of Vim's power. Master registers, :norm, fuzzy completion, linematch diff, and 16 more Vim tips and tricks. Tested on latest Vim 9.2.

    Full guide here: ostechnix.com/vim-tricks/

    #Vim #Vimtips #Vimtricks #Editor #Opensource #Linux

  3. Oh, look! Another ✨exciting✨ #Neovim #cheatsheet for all two people still using #Vim. Because clearly, the biggest problem with Vim is *remembering the keys*, not *escaping the editor*. 🔑💥👨‍💻
    nvim-cheatsheet.vercel.app/ #Developer #Community #VimTips #HackerNews #ngated

  4. Oh, look! Another ✨exciting✨ #Neovim #cheatsheet for all two people still using #Vim. Because clearly, the biggest problem with Vim is *remembering the keys*, not *escaping the editor*. 🔑💥👨‍💻
    nvim-cheatsheet.vercel.app/ #Developer #Community #VimTips #HackerNews #ngated

  5. TIL about `<C-a>` and `<C-x>` in #vim for adding or subtracting.
    (`:h ctrl-a` , `:h ctrl-x` )

    Ctrl-a will add [count] to a number or alphabetic character at or after the cursor.
    And Ctrl-x will do subtraction in the same way.

    For example let's say I need to increment this 1 to be a 2.

    ```
    replicas: 1
    ```

    Normally I would type `f1` followed by `r2`
    Or maybe even just `A` <backspace> `2`

    But we can do better.

    In this particular scenario I need only be on that line and do `<C-a>`
    Since `<C-a>` will look ahead to find a digit on the current line and act upon it. Which means we can do this from the start of the line and it will turn into:

    ```
    replicas: 2
    ```

    And if I want to change it back to `1` I can use `<C-x>`

    These two commands will even take a `[count]`. This means that if the current value is `replicas: 1` we can do `10<C-a>` and it will now say `replicas: 11`

    #vim #vimtips #VimTip #TIL #vi

  6. TIL about `<C-a>` and `<C-x>` in #vim for adding or subtracting.
    (`:h ctrl-a` , `:h ctrl-x` )

    Ctrl-a will add [count] to a number or alphabetic character at or after the cursor.
    And Ctrl-x will do subtraction in the same way.

    For example let's say I need to increment this 1 to be a 2.

    ```
    replicas: 1
    ```

    Normally I would type `f1` followed by `r2`
    Or maybe even just `A` <backspace> `2`

    But we can do better.

    In this particular scenario I need only be on that line and do `<C-a>`
    Since `<C-a>` will look ahead to find a digit on the current line and act upon it. Which means we can do this from the start of the line and it will turn into:

    ```
    replicas: 2
    ```

    And if I want to change it back to `1` I can use `<C-x>`

    These two commands will even take a `[count]`. This means that if the current value is `replicas: 1` we can do `10<C-a>` and it will now say `replicas: 11`

    #vim #vimtips #VimTip #TIL #vi

  7. So I wanted to change syntax highlight in VIM from *txt to *md.

    Web search didn't really help (generic howto's typeOf: click here) and I was as usual quite lost in the manual itself. But here's where GVIM comes in handy, as it shows the command you chose in menu in the status bar.

    So to change syntax highlight of txt to say, markdown:

    :cal SetSyn("markdown")

    Note: why don't you's ain't helpful here, I just needed to do that because reasons...

    #vim #vimhelp #vimtips

  8. This fixes all my complaints wrt text search and a highlighting

    set nohlsearch
    set incsearch

    #vimtips #vim #neovim

  9. This fixes all my complaints wrt text search and a highlighting

    set nohlsearch
    set incsearch

    #vimtips #vim #neovim

  10. Nice. You can specify how large a new window in by adding numbers beforehand.

    So ctrl+w and 20v

    or

    :vertical 20 new

  11. Copy to system clipboard from #vim guide:

    1. In your ~/.vimrc set
    set clipboard=unnamed

    2. Open a file and yank whatever you want, in this example we yank lines 4 and 5 to system clipboard; in command mode, type 4,5y *
    set ts=2
    set sts=2
    set sw=2
    filetype off
    filetype plugin indent on
    syntax on
    set expandtab

    3. Profit
    Paste anywhere you want
    filetype off
    filetype plugin indent on

    #vimTricks #vimTips

  12. And when you need the full completion madness in the command line, for example when you're editing complex Regular Expression statements, simply type `q:` from normal mode and you get the full Vim editing power in an editable command history window.
    Simply type your command line statement (or select an older one) and press <CR> to execute the command line under the cursor. See :help q:

    #Vim #Vi #Editor #Programming #VimTips #VimTricks

  13. #Vim hint of the week (because I'm searching this regulary again):
    You can insert the word under the cursor while in command mode with:
    <CTRL-R><CTRL-W>
    This comes in handy when you want to [s]ubstitute a word, without having it to retype again.

    :%s/<CTRL-R><CTRL-W>/newWord/g

    #Vim #Vi #Editor #Programming #VimTips #VimTricks

  14. #Vim hint of the week (because I'm searching this regulary again):
    You can insert the word under the cursor while in command mode with:
    <CTRL-R><CTRL-W>
    This comes in handy when you want to [s]ubstitute a word, without having it to retype again.

    :%s/<CTRL-R><CTRL-W>/newWord/g

    #Vim #Vi #Editor #Programming #VimTips #VimTricks

  15. @rixx for really good #VimTips I'd recommend the book "practical vim". It is not just full of great Tips, but also explains why some things work differently in (neo)vim

  16. #VimTips got a healthy subconscious Ctrl+S reflex from other editor's? Use :up in vim for you for your file saving reflex. The :update command saves your file only if there are changes. Meaning: you can spam this command without causing unnecessary writes.

  17. @s0 @[email protected] one of my favorite recent discoveries ggg?G as mentioned above gg goes to the beginning, g? says to apply rot13, and G for the end of the document. So with that you can rot13 an entire file. #VimTips