Linked Questions

1
vote
1answer
35 views

Use variable in vim mapping async task [duplicate]

I am trying to use a variable in this mapping: let board_ip = "192.168.100.18" │ nnoremap <F6> :AsyncRun echo . ...
0
votes
2answers
21 views

How do you use a variable as argument to another vim command? [duplicate]

I have the following function: fu! EditFileInBrowser() let l:url = @+ let l:url = substitute(l:url, 'http:\/\/127\.0\.0\.1:4000\/', '', '') let l:url = substitute(l:url, '/$', '', 'g') let l:...
1
vote
0answers
17 views

Return value to custom function [duplicate]

I'm writting a function to integrates NERDTree with Ack. The goal is to create a "Find in Directory". I create this: function! Fif_NERDTreeGetPath() let nodePath = g:NERDTreeFileNode.GetSelected()....
23
votes
2answers
12k views

How to use a variable in the expression of a 'normal' command?

How can one use a variable when executing something via normal! in vimscript? Example: function! MyFunction(someArg) normal! (a:someArg)l endfunction This should move the cursor someArg steps ...
0
votes
1answer
457 views

how to use variables in vimscript shell commands

I have this code intended to: read current line extract variable from end of line, looking for text like #ad04e482 search for filename that begins with the string ad04e482 open that file to edit in ...
0
votes
2answers
269 views

Can I use a variable in autocmd pat?

I have 3 languages and any can be a source or target so I need some flexibility. I am successfully loading a language translation specific setup with this: let g:tr_source = 'dyu' let g:tr_target =...
1
vote
2answers
124 views

Insert output of function with variable into buffer

I'm trying to make a vim function that takes a variable and uses that as part of a shell command and buts it into the current buffer. I tried using read but that just interprets the var as a string. ...
1
vote
1answer
256 views

Custom key binding for project-wide search and replace using FZF.vim Rg function?

I know that one can do a project-wide search and replace using the results of an Rg search in FZF.vim by doing the following: Run :Rg SEARCH_TERM Use Alt + a (or in my case, Esc + a, since I'm using ...
0
votes
1answer
93 views

Use normal command output as variable

I want to be able to use some normal commands I tend to use in the day to day as an input for another function, for example 4X, I would like 4X to be expanded to XXXX and then use it in a function as :...
1
vote
1answer
72 views

vim expression unusual behavior

While playing with map() I get an error, which I cannot understand. In essense, pu=map(getcompletion('*','event'), '"h" . v:val') pu=map(getcompletion('*','event'), "'h' . v:val") pu=map(...
1
vote
1answer
74 views

switch current directory between a base directory and current file directory

Goal: To achieve filename/path completion relative to current file directory using omni completion CTRL-X CTRL-F. I open all my files contained in a base directory such that :pwd in some_file outputs ...
1
vote
1answer
33 views

How to invoke Linux shell env variable into vimrc?

How to invoke Linux shell env variable into vimrc ? I split vimrc configurations into multiple files and included these files in vimrc via :runtime [file]. This works well. :runtime vimrc.d/vimrc....
1
vote
1answer
32 views

How to create key-mapping for vimgrep with dynamic values for {file} argument

Problem I am trying to create a more dynamic mapping for vimgrep. Many project directories I work in don't have consistent names for directories in which source/test code lives (ie. test vs. tst). I ...
0
votes
1answer
40 views

Is it possible to call a shell command which includes default register contents inside a function?

I want to write a function which opens a vim plugin's Github page, eg calling the function while on this line: Plug 'tpope/vim-rhubarb' ... will do !open https://github.com/tpope/vim-rhubarb. Here's ...
0
votes
1answer
29 views

add python option in vimrc

For my fortran ft I use au BufWritePre <buffer> :silent %!fprettify --silent in my ftplugin. The fprettify is a python script with many command line options, using argparse. Now, my question is,...
0
votes
1answer
23 views

How to put sync region start=<this> into a variable?

I have the following code: com! -nargs=* ShFoldFunctions <args> fold ShFoldFunctions syn region shFunctionOne start="^\s*[A-Za-z_0-9:,][-a-zA-Z_0-9:]*\s*()\_s*{" end="}&...