# Your Vim Tips!

**URL:** <https://forum.devtalk.com/t/your-vim-tips/4748>\
**Category:** Code Editors\
**Tags:** vim, community, onivim\
**Created:** [6 December 2020 01:43 UTC](https://forum.devtalk.com/t/your-vim-tips/4748 "2020-12-06T01:43:33Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![AstonJ](https://forum.devtalk.com/user_avatar/forum.devtalk.com/astonj/32/7_2.png) [@AstonJ](https://forum.devtalk.com/u/AstonJ)\
**Post date:** [6 December 2020 01:43 UTC](https://forum.devtalk.com/t/your-vim-tips/4748/1 "2020-12-06T01:43:34Z")

</div>

Please share your favourite Vim tips here 🤓

---

<div class="post-metadata">

**Author:** ![AstonJ](https://forum.devtalk.com/user_avatar/forum.devtalk.com/astonj/32/7_2.png) [@AstonJ](https://forum.devtalk.com/u/AstonJ)\
**Post date:** [6 December 2020 01:47 UTC](https://forum.devtalk.com/t/your-vim-tips/4748/2 "2020-12-06T01:47:32Z")

</div>

## Vim search from bottom

I use Vim when remotely connected to servers - I often need to look through the log files and a great way to search from the bottom up is:

`G` (Shift + g) to go to the bottom  
`$` to go to the end of the line  
`?` to start a search from the bottom up  
`search_term` - whatever you want to search for  
`n` for next item  
`N` for previous

For example:

`G` `$` `tag`

👍

---

<div class="post-metadata">

**Author:** ![tebeka](https://forum.devtalk.com/user_avatar/forum.devtalk.com/tebeka/32/806_2.png) [@tebeka](https://forum.devtalk.com/u/tebeka)\
**Post date:** [9 December 2020 19:44 UTC](https://forum.devtalk.com/t/your-vim-tips/4748/4 "2020-12-09T19:44:20Z")

</div>

`*` search for word under the cursor.

Follow [https://www.vimgolf.com/](https://www.vimgolf.com/) 🙂

---

<div class="post-metadata">

**Author:** ![AstonJ](https://forum.devtalk.com/user_avatar/forum.devtalk.com/astonj/32/7_2.png) [@AstonJ](https://forum.devtalk.com/u/AstonJ)\
**Post date:** [9 December 2020 20:05 UTC](https://forum.devtalk.com/t/your-vim-tips/4748/5 "2020-12-09T20:05:07Z")

</div>

Nice one Miki that’s new to me!

Here’s another:

To **go to a specific line** simply type `:` the line number, then enter. EG:

: 10 Enter

---

<div class="post-metadata">

**Author:** ![SmithyTT](https://forum.devtalk.com/user_avatar/forum.devtalk.com/smithytt/32/1117_2.png) [@SmithyTT](https://forum.devtalk.com/u/SmithyTT)\
**Post date:** [10 December 2020 04:05 UTC](https://forum.devtalk.com/t/your-vim-tips/4748/6 "2020-12-10T04:05:36Z")

</div>

My tip is to actually use HJKL. No end of people I know continue to use arrow keys!!! Vim puts them on your home row for very good reason—so that you don’t have to keep moving away from your home ro.w

---

<div class="post-metadata">

**Author:** ![AstonJ](https://forum.devtalk.com/user_avatar/forum.devtalk.com/astonj/32/7_2.png) [@AstonJ](https://forum.devtalk.com/u/AstonJ)\
**Post date:** [10 December 2020 19:01 UTC](https://forum.devtalk.com/t/your-vim-tips/4748/7 "2020-12-10T19:01:50Z")

</div>

I am guilty of not using them 🙊 but this is part of the reason I want to get a 40% Ortho - because it will force me to use things like that (and also to fully embrace touch typing).

---

<div class="post-metadata">

**Author:** ![DevotionGeo](https://forum.devtalk.com/user_avatar/forum.devtalk.com/devotiongeo/32/1140_2.png) [@DevotionGeo](https://forum.devtalk.com/u/DevotionGeo)\
**Post date:** [11 December 2020 10:19 UTC](https://forum.devtalk.com/t/your-vim-tips/4748/8 "2020-12-11T10:19:45Z")

</div>

- `%` for jumping from an opening round, curly or angular bracket to the corresponding closing bracket and vice versa. Sadly, it doesn’t work with `do`s and `end`s.

- Turning relative line numbers on, makes jumping to a specific line easier.  
_For Vim read [this post](https://jeffkreeftmeijer.com/vim-number/)._  
_For setting relative line numbers inside VSCode, add the following to your `settings.json`,_  
`"editor.lineNumbers": "relative",`

---

<div class="post-metadata">

**Author:** ![AstonJ](https://forum.devtalk.com/user_avatar/forum.devtalk.com/astonj/32/7_2.png) [@AstonJ](https://forum.devtalk.com/u/AstonJ)\
**Post date:** [11 December 2020 22:32 UTC](https://forum.devtalk.com/t/your-vim-tips/4748/9 "2020-12-11T22:32:06Z")

</div>

> [@DevotionGeo](#):
>
> Sadly, it doesn’t work with `do`s and `end`s.

Could this Ruby plugin be used for that?

[https://www.vim.org/scripts/script.php?script\_id=290](https://www.vim.org/scripts/script.php?script_id=290)

---

<div class="post-metadata">

**Author:** ![devbay](https://forum.devtalk.com/letter_avatar_proxy/v4/letter/d/5f9b8f/32.png) [@devbay](https://forum.devtalk.com/u/devbay)\
**Post date:** [11 December 2020 23:07 UTC](https://forum.devtalk.com/t/your-vim-tips/4748/10 "2020-12-11T23:07:40Z")

</div>

:set number (Show line numbers)  
number , Shift +G (Jump to specific line)  
dd delete line  
dw delete word  
yy - yank line , to insert while in insert mode (i), use Ctrl +R When you see " hit 0.  
yaw - yank word…

oh and

:colorscheme {tab} available color schemes, you can download or make your own as well.

---

<div class="post-metadata">

**Author:** ![AstonJ](https://forum.devtalk.com/user_avatar/forum.devtalk.com/astonj/32/7_2.png) [@AstonJ](https://forum.devtalk.com/u/AstonJ)\
**Post date:** [11 December 2020 23:32 UTC](https://forum.devtalk.com/t/your-vim-tips/4748/11 "2020-12-11T23:32:54Z")

</div>

> [@devbay](#):
>
> number , Shift +G (Jump to specific line)

That doesn’t work for me 🤔 I usually just do this to jump to a specific line:

> [@Your Vim Tips!](https://forum.devtalk.com/t/your-vim-tips/4748/5):
>
> Nice one Miki that’s new to me! Here’s another: To go to a specific line simply type : the line number, then enter. EG: : 10 Enter

> [@devbay](#):
>
> to insert while in insert mode (i), use Ctrl +R When you see " hit 0.

Nice!

---

<div class="post-metadata">

**Author:** ![devbay](https://forum.devtalk.com/letter_avatar_proxy/v4/letter/d/5f9b8f/32.png) [@devbay](https://forum.devtalk.com/u/devbay)\
**Post date:** [11 December 2020 23:48 UTC](https://forum.devtalk.com/t/your-vim-tips/4748/12 "2020-12-11T23:48:32Z")

</div>

if you go into vim, and hit 5 for example and then shift+g it should go to line 5 😉 … Should do the same thing as :5 which I didn’t know about! Thanks.

---

<div class="post-metadata">

**Author:** ![AstonJ](https://forum.devtalk.com/user_avatar/forum.devtalk.com/astonj/32/7_2.png) [@AstonJ](https://forum.devtalk.com/u/AstonJ)\
**Post date:** [12 December 2020 00:01 UTC](https://forum.devtalk.com/t/your-vim-tips/4748/13 "2020-12-12T00:01:20Z")

</div>

Oh it works now - wonder what I was doing last time 🙈 🤣 Thanks 😊

---

<div class="post-metadata">

**Author:** ![DevotionGeo](https://forum.devtalk.com/user_avatar/forum.devtalk.com/devotiongeo/32/1140_2.png) [@DevotionGeo](https://forum.devtalk.com/u/DevotionGeo)\
**Post date:** [12 December 2020 01:25 UTC](https://forum.devtalk.com/t/your-vim-tips/4748/14 "2020-12-12T01:25:03Z")

</div>

> [@AstonJ](#):
>
> Could this Ruby plugin be used for that?

It will work in Vim, but won’t work in VSCode with the [most famous Vim emulation plugin](https://marketplace.visualstudio.com/items?itemName=vscodevim.vim).  
There is another Vim emulation plugin called [Neo Vim](https://marketplace.visualstudio.com/items?itemName=asvetliakov.vscode-neovim) which embeds Neovim’s instance as backend, so anything which works with Vim may work inside VSCode if Neo Vim plugin is installed and configured correctly.

---

<div class="post-metadata">

**Author:** ![AstonJ](https://forum.devtalk.com/user_avatar/forum.devtalk.com/astonj/32/7_2.png) [@AstonJ](https://forum.devtalk.com/u/AstonJ)\
**Post date:** [12 December 2020 20:43 UTC](https://forum.devtalk.com/t/your-vim-tips/4748/15 "2020-12-12T20:43:18Z")

</div>

Split this topic on 12 December 2020 20:43 UTC

6 posts were split to a new topic: [Off-topic posts from the Vim Tips thread](https://forum.devtalk.com/t/off-topic-posts-from-the-vim-tips-thread/4995)

---

<div class="post-metadata">

**Author:** ![mafinar](https://forum.devtalk.com/user_avatar/forum.devtalk.com/mafinar/32/723_2.png) [@mafinar](https://forum.devtalk.com/u/mafinar)\
**Post date:** [12 December 2020 19:51 UTC](https://forum.devtalk.com/t/your-vim-tips/4748/19 "2020-12-12T19:51:59Z")

</div>

Insert mode: `jj` for `escape`  
Normal mode: `;` for `:`

Knowing text objects is \<3

---

<div class="post-metadata">

**Author:** ![AstonJ](https://forum.devtalk.com/user_avatar/forum.devtalk.com/astonj/32/7_2.png) [@AstonJ](https://forum.devtalk.com/u/AstonJ)\
**Post date:** [12 December 2020 20:06 UTC](https://forum.devtalk.com/t/your-vim-tips/4748/20 "2020-12-12T20:06:09Z")

</div>

> [@On another topic](https://forum.devtalk.com/t/4995/4):
>
> …but I’m so much used to the ease of setup and use of VSCode that I may not go to any other editor soon.

That’s some good reasons for ‘Why VSCode’ and sounds like it would make a great blog post! I’m not sure if you do already, but if you don’t you should definitely consider blogging! 😃

> [@mafinar](#):
>
> Insert mode: `jj` for `escape`  
> Normal mode: `;` for `:`

Do you have to set anything up for those Mafinar? They don’t do anything for me other than output `jj` or `;` 🤔

---

<div class="post-metadata">

**Author:** ![Hallski](https://forum.devtalk.com/user_avatar/forum.devtalk.com/hallski/32/610_2.png) [@Hallski](https://forum.devtalk.com/u/Hallski)\
**Post date:** [12 December 2020 21:05 UTC](https://forum.devtalk.com/t/your-vim-tips/4748/21 "2020-12-12T21:05:27Z")

</div>

Yeah, you need to set it up yourself. I’m using `jk` instead but you set it up like:

```auto
inoremap jk <esc>

```

---

<div class="post-metadata">

**Author:** ![AstonJ](https://forum.devtalk.com/user_avatar/forum.devtalk.com/astonj/32/7_2.png) [@AstonJ](https://forum.devtalk.com/u/AstonJ)\
**Post date:** [12 December 2020 21:16 UTC](https://forum.devtalk.com/t/your-vim-tips/4748/22 "2020-12-12T21:16:19Z")

</div>

Ah yeah thanks @Hallski! It’s been a while since I edited my `vimrc` 🙈

Actually you’ve given me an idea for a new thread 🤓

---

<div class="post-metadata">

**Author:** ![mafinar](https://forum.devtalk.com/user_avatar/forum.devtalk.com/mafinar/32/723_2.png) [@mafinar](https://forum.devtalk.com/u/mafinar)\
**Post date:** [13 December 2020 03:40 UTC](https://forum.devtalk.com/t/your-vim-tips/4748/23 "2020-12-13T03:40:36Z")

</div>

I used to have it too, but I have type issues typing `lol jk` in my code comments.

---

<div class="post-metadata">

**Author:** ![DevotionGeo](https://forum.devtalk.com/user_avatar/forum.devtalk.com/devotiongeo/32/1140_2.png) [@DevotionGeo](https://forum.devtalk.com/u/DevotionGeo)\
**Post date:** [13 December 2020 06:02 UTC](https://forum.devtalk.com/t/your-vim-tips/4748/24 "2020-12-13T06:02:18Z")

</div>

> [@mafinar](#):
>
> Insert mode: `jj` for `escape`

`^[` is also a good alternative to escape key. I use it even on keyboards which have an escape key, because it’s nearer, and is available by default in Vim and Vim emulators.

**Edit:** I just practiced for a minute and `jj`/`jk` are more pleasant than `^[`. I added settings for it to my vimrc as well as VSCode and I’m planning to use it instead of `^[` in future.

Thank you for this tip!

[Next page](https://forum.devtalk.com/t/your-vim-tips/4748.md?page=2)
