New answers tagged functions
0
votes
How make this function work as intended/more simple?
I failed to get the desired output via visual selection calling function directly without mapping beginning with :<C-u> to cancel visual selection.
From :h :call
When a range is given ...
0
votes
How make this function work as intended/more simple?
You could use a range function:
function DashTable() range
for line in range(a:firstline, a:lastline)
execute 'silent! ' . line . 's/\t/ /ge'
" Replace two or more spaces with tabs
...
3
votes
How to load a function from a Vim9 script and call it?
vim9script functions are script local by default unless you prepend func name with the g: -- def g:Hi().
Instead of global, you can mark functions as exported and access them from another vim9script ...
3
votes
Accepted
How to load a function from a Vim9 script and call it?
You just prefix the function name with g: -- for example:
vim9script
def g:Hi()
echo "Hello"
enddef
Then your :call Hi() will work.
Note that the g: is not necessary for calling within ...
Top 50 recent answers are included
Related Tags
functions × 291vimscript × 115
key-bindings × 38
vimrc × 29
neovim × 23
autocmd × 12
user-commands × 12
regular-expression × 11
visual-mode × 11
variables × 11
command-line × 10
buffers × 10
search × 9
macro × 7
syntax-highlighting × 6
error × 6
range × 6
plugin-system × 5
register × 5
quickfix × 5
gvim × 4
cut-copy-paste × 4
substitute × 4
vim-windows × 4
normal-mode × 4