Questions tagged [argument-list]
Questions about the usage and the manipulation of the argument list. The argument list is the list of file names you give when starting Vim.
28
questions
3
votes
1
answer
382
views
navigating multiple files - arguments and buffers
I've been learning vi (as an autodidact) for some weeks. Actually I'm not yet sure about if I'm using vi or vim (does the command vi open vim if vim is installed?).
Now I'm trying to edit multiple ...
1
vote
2
answers
62
views
Disable E173: X more files to edit warning in neovim
How can I make :q and other standard ways of exiting quit immediately even if E173 would ordinarily have stopped me in my tracks?
Because this doesn't seem possible in regular VIM, how can I do it in ...
0
votes
0
answers
47
views
How do I pass multiple optional arguments from custom command to function?
Given a function with two optional arguments
fun s:foo(one = v:false, two = v:false)
echom '<' . a:one . ',' . a:two . '>'
endf
and a custom command calling it
command! -nargs=* Foo call s:...
1
vote
2
answers
61
views
Navigate arglist via filename?
I like doing things like :b css to jump to the single css file I'm working on.
But of course this only works if I only have 1 css file in a buffer.
I'm under the impression that it is not possible to ...
1
vote
2
answers
543
views
Why argdo applies changes only to the last file?
Given the following files with two trailing spaces at the end:
$ echo "test1 " > test1.txt; echo "test2 " > test2.txt; echo "test3 " > test3.txt
$ hexdump -C *.txt
00000000 74 65 73 74 ...
0
votes
0
answers
23
views
How to deal with the argument which contains whitespace in command?
A function and it's command format:
function! Rep(raw, dest, ...) range
echo a:firstline
echo a:lastline
echo a:raw
echo a:dest
endfunction
command! -range -nargs=+ Rep <line1>,&...
1
vote
0
answers
67
views
Macro doesn't run properly when executed with :bufdo or :argdo
I have a macro that looks like:
:reg a
Type Name Content
c "a /^where^MkV%yGo^M-- Some typing...:^[pVG:!/tmp/t.sh^M
It works fine from any starting position in the file when I replay it ...
1
vote
1
answer
282
views
argdo vs bufdo for project-wide search and replace in specific folders
I have the following structure:
myproject
----src
file1.cpp, ..., file10.cpp
----include
incl1.h, ..., incl10.h
----data
data1.txt, ..., data10.txt
I would like to ...
3
votes
1
answer
73
views
argument list shows wrong current file
The help for :args states:
*:ar* *:arg* *:args*
:ar[gs] Print the argument list, with the current file in
square brackets.
However, it looks like ...
2
votes
2
answers
100
views
Plugin to edit whole datasets/projects
I'm using vim all the time for text editing these days, and have a particular use case: editing a dataset using successive commands. The main problem, as often, is fixing things, ideally rather ...
2
votes
0
answers
28
views
Can I define window position/contents via command line arguments ? Maybe a sort of parameterised session file? [duplicate]
I would like to open, say, 4 files and then have windows arranged in a grid so that the first file was in top left, second bottom left, third top right and fourth bottom right.
So a command like this (...
3
votes
2
answers
94
views
How to pre-process command line arguments provided to vim?
I want to add support for various formats of filenename with linenumber for vim to understand. E.g. I get output from git grep <keyword> like this:
first/foo.py:123:
first/bar.py:333:
second/foo....
2
votes
1
answer
125
views
Use cases of ":rewind"? How does it differ from ":b1"?
After reading :help :rewind
:rew[ind] [++opt] [+cmd]
Start editing the first file in the argument list.
This fails when changes have been made and Vim does
not want to |abandon| the ...
2
votes
2
answers
2k
views
How to set read only for only one buffer
I'm using vim with some plugins, such as Nerdtree, YCM, to build an coding environment.
Now I want to achieve this:
When I execute the command vim, a file containing some ASCII image, will be loaded ...
3
votes
2
answers
462
views
How does double star work in vim?
When I run shopt -s globstar; ls -1 tests/**/Helpers/**/*.php in bash I get:
tests/Helpers/Layout.php
tests/Helpers/Link.php
tests/Helpers/LinksPage.php
tests/Helpers/LiqpayRedirect.php
tests/Helpers/...
1
vote
1
answer
334
views
Use the arglist without opening the files
When I use the args command it opens the files:
:args `find . -name \*.html`
I would like to do an operation on the arglist without opening the files at all in a buffer, or either opening them one ...
0
votes
0
answers
47
views
How can I see what arguments vim was invoked with?
Is it possible to see what arguments vim was invoked with when it was run?
vim -O foo bar
To show -O foo bar, but especially if there are configurations set like -Z?
2
votes
1
answer
235
views
How to add files to argument list without adding them to buffer list?
I would like to run some command on each .js file of project. Argument list seems like a perfect usecase for it.
:arga **/*.js
:argdo 'some_command'
The problem is that using :arga **/*.js adds all ....
1
vote
1
answer
770
views
How can i get the arglist count?
I am writing a bash script about session management and what I want is if there's something in the arglist not to source the session.
But I couldn't find a way to check the length of :args
First of ...
4
votes
1
answer
2k
views
How to call the fzf Ag command with multiple arguments?
The plugin fzf.vim defines the following vim command here:
command! -bang -nargs=* Ag call fzf#vim#ag(<q-args>, <bang>0)'
the fzt#vim#ag function seems to allow passing all the ag ...
3
votes
1
answer
51
views
how to use the number returned by arglistid()
In the doc little is said about this number. Can we retrieve the entire arglist using this number and get all the versions of arglist?
3
votes
2
answers
4k
views
Handling Complex Arguments in a Vim Command
I am working on a VIM plugin that will require a certain level of complexity for handling arguments passed to a command.
:MyCommand -item=banana -command=ls\-ltra -pattern=./*
However, I am not sure ...
0
votes
1
answer
2k
views
Exiting back to normal mode in terminal buffer from Vimscript
<C-\><C-n> is working as (I'd) exepected, but not from a Vimscript.
I am trying to make a script that will:
open Neovim's :terminal
run a python script
exit from the terminal input mode
...
3
votes
2
answers
570
views
Passing a # character to the shell in vimscript?
In my previous question, I passed an argument into a Vimscript function and concatenated it into the command line. This works great, but when you pass a string that contains the # character, it balks ...
4
votes
2
answers
230
views
Can I run -c in batch mode (without opening the curses display)?
I find myself performing a small shell loop (involving vim) to transform files into the correct line endings for my system. It looks as follows:
for i in *; do vim -c 'set ff=dos' -c 'wq' $i; done
...
0
votes
1
answer
217
views
How to remove lines matching pattern in all files changed in one editing session?
I'm trying to create function and a mapping to insert/remove breakpoints in python code.
So far I got this
function! AddBreakPoint()
let l:line = line('.')
let l:indentChar = ' '
call ...
3
votes
1
answer
178
views
Is is possible to change the order of the argument list?
When I have multiple files in the argument list, can I rearrange the order of the list?
For example
:args
[A.md] B.md C.md D.md E.md F.md
is there a command/series of commands that gives me
:args
...
3
votes
2
answers
160
views
Is it possible to add a file to the argument list with in netrw?
I am a heavy user of the argument list and I always have the files which are important for my current task in it.
Now I started to use netrw more often to search through the files system.
But I can't ...