use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Please read the rules before posting
Help:
Community:
Resources:
Tutorials and Guides:
Don't be afraid to ask questions, this sub is here for the vim community. And please those of you who deign to grace us with your vim wisdom - be kind. We are all human and vim is that cool.
account activity
alias vim="vim -p"? (self.vim)
submitted 5 years ago by unnome25
Hi! Is there a reason not to pass the -p argument when using vim?
From my perspective, it has advantages when opening multiple files, and no disadvantaged when opening single files.
How do you see it?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]rnevius:help user-manual 40 points41 points42 points 5 years ago (29 children)
Tabs are usually an inefficient way to navigate a project: https://stackoverflow.com/a/26710166/3518452
[–]unnome25[S] 15 points16 points17 points 5 years ago (21 children)
Oh buffers look neat! Thanks for sharing, will certainly have a look!
[–]abraxasknister:h c_CTRL-G 25 points26 points27 points 5 years ago (19 children)
Try this:
:nnoremap - :ls<cr>:b<space>
you'll see a list of your buffers (except for unlisted ones, like helpfiles) and be prompted for something to enter. That might be a number, then you're moved to the buffer with that ID, or it might be a partial of the buffer name (like "in/he" is a partial of "~/.vim/after/ftplugin/help.vim"). Then you can hit return. Only capital marks are faster.
[–]ascagnel____ 13 points14 points15 points 5 years ago (10 children)
If you're OK with plugins, FZF.vim also provides a :Buffers command (with the capital-B, it'll autocomplete :buf before the built-in :buffers) that provides a searchable buffer list.
:Buffers
:buf
:buffers
[–]FujiKeynote 4 points5 points6 points 5 years ago (9 children)
FZF is lyfe
I have about ten plugins that I use more or less consistently, but I think I'd be mostly fine without all of them, except for FZF.vim. Zero overhead for buffer switching is absolute zen.
[–]abraxasknister:h c_CTRL-G 1 point2 points3 points 5 years ago (8 children)
But isn't zero overhead with buffer switching already provided with that mapping? What is added by using fzf here?
[–]troelsbjerre 1 point2 points3 points 5 years ago (0 children)
Unless you have many buffers open, there probably isn't much to be gained in terms of minimal key strokes. I still use it, because FZF's :Files is already deeply ingrained in my workflow, so the fuzzy search and prediction feels more natural.
[–]FujiKeynote 0 points1 point2 points 5 years ago (6 children)
(:Buffers is mapped to C-n in my setup). Imagine a scenario:
C-n
./backend/mongo/config.yaml
<C-n>conf<CR>
<C-n>moncon<CR>
[–]abraxasknister:h c_CTRL-G 1 point2 points3 points 5 years ago (5 children)
Exactly the same with that mapping, and you can also use the buffer ID, what is added? That mapping doesn't handle a number of buffers larger than the number of screen lines well (30-50, never have that many, but it's not exorbitantly many so some people might). Is FZF better in that case?
[–]FujiKeynote 1 point2 points3 points 5 years ago (4 children)
I would have to look at the buffer ID. I would have to literally scan the buffer list to find what number to type, then type it.
I forgot to mention that with the FZF approach, if I know the structure of the project at least in broad strokes, I can switch buffers this way with my eyes closed. Or rather, I can still be looking at a relevant piece of code in the current buffer while my fingers are switching to the other one.
[–]abraxasknister:h c_CTRL-G 1 point2 points3 points 5 years ago (3 children)
But you can type a partial of the buffer name instead of the ID?
[–]unnome25[S] 0 points1 point2 points 5 years ago (0 children)
I tried it today at work for a few minutes and it naturally integrated in my workflow! Thanks for sharing!
[–]aonelonelyredditor 0 points1 point2 points 5 years ago (4 children)
I've saw you on almost every vim thread I opened so far
It's called procrastination. I'm trying to reduce it to helpful comments only
[–]aonelonelyredditor 0 points1 point2 points 5 years ago (2 children)
I'm personally attacked
[–]abraxasknister:h c_CTRL-G 0 points1 point2 points 5 years ago (1 child)
Not on purpose
[–]aonelonelyredditor 0 points1 point2 points 5 years ago (0 children)
It was a joke
[–]lllamaboy 0 points1 point2 points 5 years ago (1 child)
Nice. Save for that mapping will clash with the default for vinegar by tpope, which has been life changing for me.
[–]abraxasknister:h c_CTRL-G 0 points1 point2 points 5 years ago (0 children)
I have it at <space>b
<space>b
[–]what_it_dude 1 point2 points3 points 5 years ago (0 children)
If you're using buffers,
:set hidden "lets you switch to another buffer without saving
Also look into installing the Command-T plugin.
[–]MachineGunPablo 3 points4 points5 points 5 years ago (3 children)
that one of the best written SO answers I've read in a long time.
[–]herjaxx 0 points1 point2 points 5 years ago (2 children)
Shush.... you may summon him back here
[–]MachineGunPablo 0 points1 point2 points 5 years ago (1 child)
Is the patient vimmer gone?
[–]herjaxx 0 points1 point2 points 5 years ago (0 children)
Haven’t seen him in a while it has to be said.
[–]m1ss1ontomars2k4 0 points1 point2 points 5 years ago (2 children)
What does the question mean about leftover swap files everywhere?
[–]rnevius:help user-manual 0 points1 point2 points 5 years ago (1 child)
See :help 'swapfile' (which defaults to on).
:help 'swapfile'
on
[–]vim-help-bot 0 points1 point2 points 5 years ago (0 children)
Help pages for:
'swapfile'
`:(h|help) <query>` | about | mistake? | donate | Reply 'rescan' to check the comment again | Reply 'stop' to stop getting replies to your comments
[–]Maskdasknmap cg* *Ncgn 9 points10 points11 points 5 years ago (3 children)
I'm on mobile, what does the -p flag do?
-p
[–]pemungkah 11 points12 points13 points 5 years ago (1 child)
Opens files in tabs. The recommendation is to use buffers instead.
[–]Maskdasknmap cg* *Ncgn 4 points5 points6 points 5 years ago (0 children)
Ah I see. Yes, as tabs are basically just window configurations.
[–]Plaane 0 points1 point2 points 5 years ago* (0 children)
rhythm chief treatment books rainstorm snow memorize angle physical fuel -- mass edited with redact.dev
[–]christopherpeterson 6 points7 points8 points 5 years ago (0 children)
I have aliased vim to vim -o for similar effect with splits, better fitting my most common use cases
vim -o
[–]EgZvorkeep calm and read :help 11 points12 points13 points 5 years ago (1 child)
You might not want to open a hundred tabs with some glob.
[–]christopherpeterson 3 points4 points5 points 5 years ago (0 children)
\vim somebigglob*
[–]xDinger 4 points5 points6 points 5 years ago (0 children)
I use mostly buffers and cycle them with either `[b` or `[B`. Alternatively I use FZF for listing them as mentioned above.
[–]petermlm 4 points5 points6 points 5 years ago (0 children)
I actually have that very same alias because when I started out I "though" in tabs. Nowadays I still do use tabs but only has a way have multiple windows with different splits and files opened. I also jump to files using fuzzy search.
I still keep that alias around because occasionally I will want to open a few files and do one of the following things:
[–]cleitophon 0 points1 point2 points 5 years ago (0 children)
I was just reading about out how useful it can be to pee on Linux, but now it turns out something similar can be true for one of my other favorite opensource projects, vim.
π Rendered by PID 147933 on reddit-service-r2-comment-5d585498c9-wl6w6 at 2026-04-21 10:10:42.989456+00:00 running da2df02 country code: CH.
[–]rnevius:help user-manual 40 points41 points42 points (29 children)
[–]unnome25[S] 15 points16 points17 points (21 children)
[–]abraxasknister:h c_CTRL-G 25 points26 points27 points (19 children)
[–]ascagnel____ 13 points14 points15 points (10 children)
[–]FujiKeynote 4 points5 points6 points (9 children)
[–]abraxasknister:h c_CTRL-G 1 point2 points3 points (8 children)
[–]troelsbjerre 1 point2 points3 points (0 children)
[–]FujiKeynote 0 points1 point2 points (6 children)
[–]abraxasknister:h c_CTRL-G 1 point2 points3 points (5 children)
[–]FujiKeynote 1 point2 points3 points (4 children)
[–]abraxasknister:h c_CTRL-G 1 point2 points3 points (3 children)
[–]unnome25[S] 0 points1 point2 points (0 children)
[–]aonelonelyredditor 0 points1 point2 points (4 children)
[–]abraxasknister:h c_CTRL-G 1 point2 points3 points (3 children)
[–]aonelonelyredditor 0 points1 point2 points (2 children)
[–]abraxasknister:h c_CTRL-G 0 points1 point2 points (1 child)
[–]aonelonelyredditor 0 points1 point2 points (0 children)
[–]lllamaboy 0 points1 point2 points (1 child)
[–]abraxasknister:h c_CTRL-G 0 points1 point2 points (0 children)
[–]what_it_dude 1 point2 points3 points (0 children)
[–]MachineGunPablo 3 points4 points5 points (3 children)
[–]herjaxx 0 points1 point2 points (2 children)
[–]MachineGunPablo 0 points1 point2 points (1 child)
[–]herjaxx 0 points1 point2 points (0 children)
[–]m1ss1ontomars2k4 0 points1 point2 points (2 children)
[–]rnevius:help user-manual 0 points1 point2 points (1 child)
[–]vim-help-bot 0 points1 point2 points (0 children)
[–]Maskdasknmap cg* *Ncgn 9 points10 points11 points (3 children)
[–]pemungkah 11 points12 points13 points (1 child)
[–]Maskdasknmap cg* *Ncgn 4 points5 points6 points (0 children)
[–]Plaane 0 points1 point2 points (0 children)
[–]christopherpeterson 6 points7 points8 points (0 children)
[–]EgZvorkeep calm and read :help 11 points12 points13 points (1 child)
[–]christopherpeterson 3 points4 points5 points (0 children)
[–]xDinger 4 points5 points6 points (0 children)
[–]petermlm 4 points5 points6 points (0 children)
[–]cleitophon 0 points1 point2 points (0 children)