Vimscript is the scripting language built into the text editor Vim. It can also be referred to as "Vim Language" or "VimL".
0
votes
0answers
3 views
Variable Interpolation in Vimscript catch clause
I'm working on a small testing framework for vim plugins and am trying to implement a function that calls a user-specified function and checks if the function calls exceptions when needed. The problem ...
1
vote
1answer
31 views
how to check &somesettingname return a true value or boolean in vim script?
I get how to check a setting exists in vimrc or not here Vimscript: use vim settings as variables / How to check if specific guioption is set or not
But I also get a question: if I set something like ...
0
votes
1answer
29 views
Format HTML into a JavaScript concatenated string
I ran into the following vimscript snippet in a book this afternoon and it seems like it'd be really useful. Unfortunately I haven't quite gotten it to work and I'm hoping somebody can tell me what ...
2
votes
2answers
22 views
How to get 'filetype' of a buffer specified by a number?
I'm writing plugin for VIM and i need to know a filetype of buffer specified by a number. But filetype is an option - how can i get specified buffer option programmatically? I can get buffer name via ...
0
votes
1answer
14 views
vimscript: how delete a variable number of lines
In a vimscript I need to delete lines from the buffer, but the number of lines will vary with each iteration of the loop. :d is the only command I know of that will remove entire lines, but how can I ...
1
vote
2answers
44 views
Using Vim as a Javascript Sandbox: How do I write a buffer to node and read the result in another buffer?
I'm attempting to utilise vim as a complex javascript sandbox editor.
The end goal is to have a left window with my code, and a right window with dynamically updating output from the node.js ...
0
votes
1answer
24 views
vim scripting: how to make a variable to host command
I have the following code to copy the file I am editing to another folder, but when execute the command by press F5, it tries to do command "copy path newpath" literally without replace the variables ...
0
votes
1answer
52 views
vim, How do I get matching word in parenthesis from regex
with vim script,
Let me say that I want to find word "This" from the following expression
match("testingThis", '\ving(.*)')
I tried with some different options, getmatches(), substitute(), not luck ...
0
votes
1answer
22 views
Vim custom command doesn't work but it works when run manually line by line
I am trying to write a simple vim command that will get some texts and clean everything else.
The following Vim script does it:
:let @a=""|%s//\=setreg('A', submatch(0), 'l')/g|%d _|pu a|0d _
I ...
0
votes
1answer
38 views
Vim shortcut to build out proper html
I'm trying to write my own function to convert a string like this:
div.class1.class2#id
into an HTML element like this
<div class="class1 class2" id="id">|</div>
with | representing ...
0
votes
1answer
15 views
vim match errors out with regular expression (?:([^f])fe|([lr])f)$
Trying to build pluralize function with vim script
I have this regular expression copied from php script to make plural words
/(?:([^f])fe|([lr])f)$/i \1\2ves
However this does not work with vim
...
1
vote
1answer
36 views
Check whether pathogen is installed in vimrc
I would like to check in .vimrc whether pathogen is present, and call pathogen#infect if it is.
This obviously works:
call pathogen#infect()
So I'm confident pathogen is properly installed.
But ...
0
votes
2answers
40 views
Vim iabbrev in my vimrc does not work
I am adding abbreviations in autocmds to my vimrc. They are as follows:
augroup caucmds
autocmd!
autocmd FileType c :iabbrev iff if ()<left>
autocmd FileType c :iabbrev elseif else ...
2
votes
2answers
122 views
What is the best way to distinguish the current buffer is location list or quickfix list?
I have an autocmd, if ft is qf, it is gonna call some functions to modify the quickfix list by get/setqflist()
I know there are another pair of functions get/setloclist(), to handle the location ...
1
vote
2answers
41 views
Can I pass a string as stdin to a system call from vim?
I want to run a system command from vim (:help :!), and I want to pass the contents of a string variable as stdin for that command.
I already know I can pass lines from the current buffer as stdin ...