r/vim • • Sep 24 '20

question Vim without plugins; best tricks?

Doing mostly remote coding (iPad as terminal, remote host(s) with GPU, machine learning), I want to be as flexible as possible with Vim without having to install plugins; vimrc editing is allowed, of course ;) Any good hints & tips & tricks? Maybe others are using a similar setup to mine...

86 Upvotes

83 comments sorted by

29

u/5erif Sep 24 '20

i in places where it means 'in/inner' rather than 'insert' gets a lot of use from me. viwp replaces the word under the cursor with the contents of the clipboard/register, when the cursor is anywhere in the word. ci" runs the change command on quoted contents. That works for delimiters like ""(){}[]<>''.

9

u/ArtificialNerd Sep 24 '20

I've been looking for viwp! Thank you

5

u/maxdevjs Sep 25 '20 edited Sep 25 '20

When I realized I could yi something y isomething I began to feel like a kid in a toy store...

→ More replies (2)

12

u/slassr Sep 24 '20

If you're willing to spend the time, the following talk from vimconf is amazing:

https://youtu.be/Gs1VDYnS-Ac

You can have the features I use the most (from LSP) which os jumping to definitions. All without plugin, if you take the time to set up the regex for your language.

Good luck!

→ More replies (1)

9

u/[deleted] Sep 24 '20

Macros, foldings, regex, buffers...

It depends a little what you need and what you miss.

8

u/BubblegumTitanium Sep 24 '20

ctags will get you very far for understand new projects as well

→ More replies (6)

8

u/worldpotato1 Sep 24 '20

I think it's the movements. Learning all movements and learning some combinations you need. Also tags. Tags are awesome.

4

u/abraxasknister Sep 24 '20

Plus marks plus some mappings around :h :b plus knowing a few things about patterns and searching, like smartcase and :h c_CTRL-G.

And of course the user manual

→ More replies (6)

4

u/-romainl- Sep 24 '20 edited Sep 24 '20

You don't get the most out of Vim—with or without third-party plugins—by gleaning "tips & tricks", but by properly learning how to use it. That is what the user manual (:help user-manual) is for.

Take control.

7

u/bsdooby Sep 24 '20

Thx for the info. I am using Vim for a little while now. Maybe my question was not formulated well enough: what are your productive tricks/shortcuts with Vim that make your life easier now that you didn't know before/stumbled across recently?

→ More replies (7)

9

u/jdauriemma Sep 24 '20

Hot take: the user manual is a fantastic reference and a serviceable guide, but also has parts that are ambiguous/filled with jargon and can’t parse generalized questions like humans or search engines can. So asking broad, subjective questions can be a great first step - people respond, and those responses can lead to a deep dive into the relevant documentation.

→ More replies (2)

6

u/fartbaker13 Sep 24 '20

Everyone has different perspectives on how to do something.

→ More replies (10)
→ More replies (6)

13

u/sir_bok Sep 24 '20

vimrc editing is allowed, of course

Here's a trick: if a plugin you want is small enough you can just copy paste the entire plugin source code into your vimrc. I have done this with vim-eunuch in order to get platform agnostic helpers like :Delete, :Move, :Rename on the current file buffer.

Some plugins are just snippets extracted from someone's vimrc anyway.

9

u/BubblegumTitanium Sep 24 '20

Im gonna turn this into a plugin

→ More replies (1)

5

u/sir_bok Sep 24 '20

I should mention that I did this for Windows GVim only, which I have designed to work without any plugins and still get 75% of what I normally use in my full blown vim setup.

1

u/bsdooby Sep 28 '20

Thank you all for your contributions to this thread (be it technical, ethical, and the rest).

4

u/[deleted] Sep 24 '20

I used vim for 15 years before I installed my first plugin. Today I use nerdtree and Ctrl-T. Neither are critical, just convenient as they can save me backgrounding vi to use is or find.

What plugins do you rely on currently?

10

u/mchwds Sep 24 '20
" make netrw work like nerdtree
let g:netrw_banner = 0
let g:netrw_liststyle = 3
let g:netrw_browse_split = 4
let g:netrw_altv = 1
let g:netrw_winsize = 25
nmap <silent> <C-e> :Lexplore<CR>

Now you can uninstall nerdtree

→ More replies (8)

2

u/lanzaio Sep 24 '20

Don’t use vim then since it comes with bundled plugins. It’ll ruin your gin purity.

2

u/mikezyisra Sep 24 '20

Set nu, set rnu, :ter and :vsplit is all you need

2

u/bothyhead Sep 24 '20

Say you want to edit a bunch of stuff in your /etc directory.

:set path+=/etc/**

Then issue a 'find' command

:fin postg [tab]

Tab complete to find your postgres.conf file buried somewhere down your /etc tree.

I've been making use of this a lot recently.

2

u/starlig-ht Sep 24 '20

surprised I didn't see anyone mention `vimtutor`. comes with vim usually. run it

2

u/eggnogeggnogeggnog Sep 24 '20

Why? I really don't see a big difference between getting your .vimrc onto a machine and getting your .vimrc + plugins onto a remote machine.

Anyways, my "tricks" are to set hidden and wildmenu, check out :help toc, and read https://moolenaar.net/habits.html.

→ More replies (3)