Questions tagged [viml]

VimL, or VimScript, is the scripting language used to program (and configure) the Vim editor.

Both Vim plugins (scripts) and the Vim configuration-files (such as .vimrc) are written in VimL.

VimL, as a programming language, is a imperative language with support for (as of version 7) a simplified form of object-oriented programming. Scripts written in VimL can both invoke ‘normal-mode’ commands, as well as calling more complex ex commands or more complicated functions combining such functionality.

Vim can also be scripted with other programming languages (depending on which compile-time features a particular user has selected); but the vast majority of popular extensions and plugins are written in VimL.

VimL files are plain-text, and use .vim as a file-extension.

Vimscript : Offers most of the usual language features: variables, expressions, control structures, built-in functions, user-defined functions, first-class strings, high-level data structures (lists and dictionaries), terminal and file I/O, regex pattern matching, exceptions, and an integrated debugger.

Several, popular, tutorials, are available, although a comprehensive, centralized documentation exists only in the form of the Vim user-manual itself.

Note: There is some confusion about the official name of this language. ‘VimL’, while currently a little less common, is chosen as the name on sites like GitHub and Stack Overflow, as it is less ambiguous to search for.

Vim Documentation

41 questions
0
votes
1 answer

VimL: VSPLIT with width specified as a function of total width

I want to write a vim script that opens a new window with vsplit, where the width of the new window is equal to the total number of columns minus 90. The result would be, the current window would be 90 columns wide (to view 80 cols of code + gutter)…
justin cress
  • 1,745
  • 5
  • 24
  • 35
0
votes
0 answers

vim: execute normal search with highlight from vimrc

I am using the following to map * to search current selection with highlight set hlsearch vnoremap * :call VisualSelection('f') vnoremap # :call VisualSelection('b') function! VisualSelection(direction) range let l:saved_reg = @" execute…
dragonxlwang
  • 462
  • 5
  • 13
0
votes
1 answer

How to load a vimscript file after loading plugin utl.vim?

I need to source some configuration lines after loading a plugin called [utl.vim][1]. The documentation says, I need to put these configurations into after-directory: [23] NOte that you cannot include this line in your .vimrc because it is …
Mert Nuhoglu
  • 9,695
  • 16
  • 79
  • 117
0
votes
1 answer

Vim Function to Send Highlighted Text to a Git Commit

Problem: Suppose I have the following text in my vim buffer: This is a commit msg. Suppose further I have a git repo located at ~/my_repo. Goal: Make a vim script so that I can highlight the text above, and have it sent as a git commit message…
George
  • 6,927
  • 4
  • 34
  • 67
0
votes
0 answers

Escaping a character included in a conceal command vimscript

I'm playing with conceal in help files to highlight / colour specific text strings. This was working fine until I added the :print: example below. conceal example Using this concealed all the : as expected so I tried to escape the : around the word…
Steve
  • 388
  • 1
  • 3
  • 14
0
votes
1 answer

How to remove leading & trailing white spaces within a column range?

How to remove leading & trailing white spaces within a column range? This doesn't work: 9s/\%>11c\%<40c^\(\s\+\)//e 9s/\%>11c\%<40c\(\s\+\)$//e
Reman
  • 7,931
  • 11
  • 55
  • 97
0
votes
1 answer

How to return a space from function in vim?

example: function! MkStatusLine() let &stl='' let &stl.='%{abcd()}' endfunction function abcd() if this return ' myvalue' elseif this return ' ' endif endfunction How can I return a space? return ' ' is seen as return '' return '…
Reman
  • 7,931
  • 11
  • 55
  • 97
0
votes
1 answer

Send text from one vim buffer to another?

Setting: Vim session with multiple tabs, windows, and buffers. Goal: Make Ex command that sends selected text from active buffer to another buffer in the session (preferably with autocompletion). By this I mean the text is appended to the end of the…
George
  • 6,927
  • 4
  • 34
  • 67
0
votes
1 answer

Using Register Variables in VimScript

I have the following code in vim Script(File name: file): :execute "normal /\This\gg" :let i=1 :execute "normal nxxcwThat".@=i I am executing this code on the following file(File name: out): This is line 1 This is line 2 I am using the…
sarthak
  • 774
  • 1
  • 11
  • 27
0
votes
2 answers

Vim: Shortcut to toggle between NERDTreeCWD and NERDTreeClose

I'd like to be able to use the same shortcut to jump to a file in NERDTree and close NERDTree. I have no experience with VimL and could use some help.
domi91c
  • 1,962
  • 4
  • 23
  • 38
0
votes
1 answer

Exiting exe mode in a macro

I had a large file I was trying to reformat which involved removing the 2nd to nth repeating sets on 2 to 100 lines per duplicate. The data looked like element1.element2.element...field.comment I wanted to remove the repetition in elements after…
Steve
  • 388
  • 1
  • 3
  • 14
1 2
3