The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [vimscript]

A scripting language embedded into Vim. It can be used to customize Vim to suit your needs and to create plugins. Also called VimL.

85 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
1
vote
0answers
120 views

How can I view all of the vimscript run by a command? (neovim)

I want something similar to what I get when I enter debug mode and type "step", then enter and up, enter and up, ten thousand times... But without having to do all that work, allows it to be done ...
1
vote
0answers
67 views

Get rid of meta characters in vim's perldoc viewer

If I do :Perldoc version for documents longer than one page, I see output like this: ESC[1mNAMEESC[0m version - Perl extension for Version Objects ESC[1mSYNOPSISESC[0m # Parsing version strings (...
1
vote
0answers
70 views

How to avoid canceling command that waits for user input

This function function! Gf() execute "normal \<Plug>(easymotion-s2)ab" echo "done" endfunction just prints EasyMotion: Cancelled done when called, but that's not what I want. EasyMotion ...
1
vote
0answers
85 views

How to display a fake text instead of what is being written on the keyboard

Say I am writing confidential document on vim. I want another text to appear instead of the real document. Each time a key of the real confidential text is pressed, the next letter of the fake text ...
1
vote
0answers
636 views

Enter insert to insert mode from function

I want to create function that search for selection and then automatically replace selection with given text. Something like *Ncgn but with custom movement (not exactly word only). My current ...
1
vote
0answers
105 views

syntax highlighting for indentation sensitive multiline comment

I want to create syntax highlighting for indentation sensitive language that I'm designing, my question is how to highlight multiline comment that begins with #! something like this #! xxxxxxxxxxx ...
1
vote
0answers
98 views

How to compare two positions in a buffer?

Suppose i've got two different positions in a buffer returned by getpos() function: p1 = getpos("v") p2 = getpos(".") Is there a simple or elegant way to find out which one is before the other in ...
1
vote
0answers
279 views

NERDTree file extension highlighting issue: c files not highlighted

function! NERDTreeHighlightFile(extension, fg, bg) exec 'autocmd filetype nerdtree syn match ' . a:extension .' #^\s\+.*'. a:extension .'$#' exec 'autocmd filetype nerdtree highlight ' . a:...
1
vote
0answers
110 views

How to undojoin changes made from neovim remote plugin on TextChanged

I'm writing a remote neovim plugin that automatically inserts parens into the buffer based on http://shaunlebron.github.io/parinfer/ What I'm struggling to figure out is how can I get :undojoin like ...
1
vote
0answers
243 views

Writing a command-line tool in VimScript

I am going to write a program which can be run from the command line, at least on *nix systems. I considered using Python or Perl, but why not Vimscript? Has anybody done this? What is the best ...
0
votes
0answers
8 views

What happens when error occurs during cdo?

:h :cdo says: When an error is detected execution stops. The last buffer (or where an error occurred) becomes the current buffer. Let's see what really happens: ...
0
votes
0answers
21 views

Neovim highlight syntax region inside typescript tagged template literal

I am having trouble fixing a syntax plugin for Vim. I've found a bug in a plugin that has not been touched in a fair amount of time. I want to address it myself but I believe I am lacking in a lot of ...
0
votes
0answers
15 views

Spell check operator

Is there a way to run the spell checking for a single text object instead of the entire file? I would like to do something like: gsip (go spell in paragraph) I've found a gammar check operator: ...
0
votes
0answers
32 views

Is it possible to replace tildes representing empty lines with another character?

I'm writing a plugin which needs to replace the empty line tildes with with a '.' character in a single window split. Is this possible to do with Vimscript?
0
votes
1answer
44 views

Ultisnips Sinppets in current scope on blank line

Background I'm using UltiSnips in conjunction with some autocomplete plugins. I have this line controlling the behavior of enter inoremap <expr> <cr> \ !empty(UltiSnips#...
0
votes
0answers
21 views

Running a command after makeprg successfully runs

I have a workflow where I build on one machine and copy the result to a different machine for testing. Currently I use vim-dispatch for running make in the background. What I would like to be able to ...
0
votes
0answers
35 views

Is there a particular name for when you pre-set a bunch of registers used for a specific task at hand?

For example one could have many of these for different tasks (with different values for different registers based on the task): function !RegisterTemplateTest() # Set contents of said register ...
0
votes
0answers
39 views

How to stop a function when <esc> is pressed? OR how to catch a <esc> signal in vimscript?

I have a function which calls another function that reads user input from input(). function! fun1() call fun2() endfunction function! fun2() let temp = input("Please input:") endfunction What I ...
0
votes
0answers
46 views

Can I script VIM to process a list of diffs?

I often need to keep several directories synchronized across two or three machines. I will periodically run diff -qr local/path mounted/remote/path > diff-list.txt to get a list of what is ...
0
votes
1answer
71 views

How to create new operator by using existing operator with current motion?

function! OperatorFunc(type, ...) " how to call another operator with current motion? " do other stuff endfunction Is it possible to get motion text? such as get iw from yiw
0
votes
1answer
482 views

Integrating autocomplete and snippets

I'm trying to set up an autocompletion/snippet workflow that's a bit complicated. This is stemming from needing a better workflow for latex. Right now I'm using coc.nvim and UltiSnippets but I am ...
0
votes
0answers
34 views

highlight link with condition file does not exist

For a wiki syntax plugin, i'd like to have two highlighting colors for links. Links already having a destination file should be green and links with no destination yet should be red. [[This file ...
0
votes
0answers
63 views

how does t_AB and t_Sb option difference in vim?

I see three sets of options for terminal colors on the vim documentation. The first set of options: t_AB set background color (ANSI) *t_AB* *'t_AB'* t_AF set foreground color (ANSI) ...
0
votes
0answers
32 views

How to pass '\v\C[pattern]' into the built-in match() VimScript function

I am attempting custom fold logic as my first VimScript. What works for me: USING VERY MAGIC (\v) and explicit CASE SENSITIVE (\C), find python comments in foo.py that begin with hash, then Roman ...
0
votes
2answers
153 views

Set cursor in quickfix on autocmd event

I need to set cursor position when opening quickfix window. I have tried autocmd BufEnter * call cursor(2, 2) It doesn't set cursor for quickfix buffer immediately after I have opened it. UPD: I am ...
0
votes
0answers
136 views

How to get the current word starting from the cursor?

In vimscript expand('<cword>') gives me the word under the cursor. How can I get the word under the cursor starting at he current cursor location (skipping the word start).
0
votes
0answers
42 views

Fuzzy / smart / intellisense completion in input mode

Standard Vim completion supposes that you type in the beginning of the word, then press CTRL-N, and get all the words that begin with the prefix you typed in. In my situation, prefixes are mostly the ...
0
votes
0answers
45 views

How to get the same message and error behavior as normal `n` when calling `normal n` in function

I wrote a vimscript function that prevents the cursor from changing its location on the screen when I press n: function! my_n() let l:start=line("w0") let end = line("w$") let cursor = ...
0
votes
1answer
60 views

Using %:p when path has space in it

I have this bit of vim script: nmap <F9> :w<cr> \:execute 'silent !tmux new -ds blah'<cr> \:execute "silent !tmux send-keys -t blah '%:p' Enter"<cr> \:execute 'silent !...
0
votes
0answers
39 views

Is there a C++ format plugin just like Visual Studio

Coding C++ in Visual Studio, if you type ;, this line will be formatted. For example, typing a ; after int i= 1+ 2 will make this line as int i = 1 + 2;, which means that each operator is surrounded ...
0
votes
0answers
111 views

command: how to avoid “Press ENTER or type command to continue”

In my .vimrc, I set a shortcut: command Q call delete('.ycm_extra_conf.py')|call delete('.tags')|qa Now I can type :Q + [enter] to delete the two files and quit all plugins and vim. However, if I ...
0
votes
1answer
49 views

[no]foldenable / foldmethod for each buffer but keep those settings persist for each buffer

I have two opening buffers and one has foldenable and foldmethod=indent, other has nofoldenable and foldmethod=syntax. I need that when I move between buffers, each buffer has it own fold settings ...
0
votes
0answers
34 views

`vim.eval('a:items')` fails if 'a:items' contain `BOM HEADERs`

I am using a pluging ctrlp-py-matcher, which is using the python interface to vim. My VIM is compiled with python3 support VIM - Vi IMproved 8.1 (2018 May 17, compiled Jul 1 2018 10:45:10) Included ...
0
votes
0answers
119 views

How to fold lines above the current unless it has less indentation than the current

My intention is to facilitate investigation of deeply buried code. For example, an error is thrown with message "ABC Error" and if | is where the cursor is: function handleRequest(req) { let param ...
0
votes
0answers
211 views

Window close event

For my vim plugin I try to catch an event when quickfix window is closed. I did it with BufWinLeave event. But it does not work when I have quickfix open on multiple tabs, because of 'Not when it's ...