Skip to main content

All Questions

Filter by
Sorted by
Tagged with
0 votes
1 answer
29 views

How to automate console.log random string with word (or selection) under cursor?

I am using this code snippet for adding console.log: imap cll console.log()<Esc><S-f>(a " Console log from visual mode on next line, puts visual selection inside parentheses vmap cll ...
illdo's user avatar
  • 1
12 votes
1 answer
3k views

How do I use a variable or return value in option, command, or mapping?

I have a variable foo with let foo='value', and a function F like function F() return 'value' endfunction and I want to use them in an option: :set option=foo, :set option=F(); or in a command: :...
D. Ben Knoble's user avatar
  • 27.7k
2 votes
1 answer
69 views

Running find-and-replace in Visual Mode :'<,'>s/^/string/g inserts "string" at 0 position instead of ^ (first non-whitespace) position

I have some visual-mode commenting macros that should place a comment character g:CommentChar before the first non-whitespace character of each line in the selection. However, it places it right of ...
Luke Davis's user avatar
  • 1,407