Questions tagged [functions]

Question about the use of functions in Vimscript defined in the `.vimrc` or a script file.

Filter by
Sorted by
Tagged with
5
votes
3answers
241 views

Way to get content of Visual Selection?

Now if I select something in visual mode, is there some way to get the selected area without having to yank it to some register? I looked through :h functions but didn't find anything.
3
votes
1answer
937 views

Change command depending on file extension/type

I usually work with php projects and phpunit. I've mapped <leader>T thus I can run tests. # my .vimrc file portion nnoremap <Leader>T :!vendor/bin/phpunit --filter function! ...
1
vote
1answer
119 views

Visual mode toggle block commenting with vimrc command

I am trying to get vim to do block commenting and uncommenting of highlighted lines while keeping the correct indentation level. I am so frustratingly close. let b:commentChar='//' autocmd ...
5
votes
3answers
422 views

Making a custom function to comment out a range of lines

I want to make block commenting easy. To comment out a range of lines, what I can do is something like: :17,21s/^/# This will comment lines 17 to 21 in Python. But I don't want to write the whole ...
4
votes
1answer
648 views

Call function from string name

I am trying to achieve the following : Having a set of predefined functions in my script Having a map of relation between the functions and their argument Calling the functions with their argument ...
1
vote
1answer
98 views

function: sort output alphabetically

This function outputs data between braces as joined lines in a quickfix window. The output is sorted based on line numbers. I'm searching for a method to sort the data alphabetically. I tried to ...