Quantcast
Channel: Active questions tagged user-commands - Vi and Vim Stack Exchange
Browsing all 60 articles
Browse latest View live
↧

How to get timezone using strftime command?

I have a custom command for stamping time in my log files. However, I would like that format to match the one of bash command date.For example, I use this command::command InLog pu=strftime(\"\n*****...

View Article


How can I create a command alias for :Ex /path/to/directory

I'm trying to make my life easier by making a shortcut for the following command:Ex /path/to/directoryI need to to be able to press :akeyword and execute the command above.The directory needs to be...

View Article


set a default value to a command that acccepts two arguments?

I often need to delineate "sections" of source code files using a comment character to create horizontal lines. For example if I wanted to draw such a line in a python file I could do:Hline # 79where...

View Article

deleting a plugin (not a user defined) command?

I am using the fzf plugin which has a command called :Windows. Very often I type :W instead of :w when trying to write and it is very annoying. I would like to remove the command, since I do not use it...

View Article

Search for a pattern, copy the line with the matching pattern, copy the next...

I have a file with data that goes like this.Engine1Temp:10Humidity:23 Engine1Temp:13Humidity:21 Engine2Temp:10Humidity:23This pattern repeats throughout the file.I want to do the following in a single...

View Article


Define w< command

I often type :w< instead of :wq, so I wanted to redefine it (in order to avoid the creation of a < file) as following:command! w< wBut it seems to not be allowed:Error detected while...

View Article

Making custom command behave like ":echo" with respect to quotes

This command works without errors::echo v:oldfiles->copy()->filter('v:val =~# "txt$"')(see :h method, :h v:oldfiles, :h v:val and :h =~#)I want to create a custom command / function combination...

View Article

How to identify the script that's calling a user command?

I have a problem: I need to pass « any » caller-session trace into a user command… Was trying with:command WantToKnowWhosCalling call Impl("\<SID>", \ expand("<SID>"),...

View Article


Why does `` behave like `|` in the `:command` command in Vim?

Here is the list of experiments I performed that shows that <Bar> is treated as literal <Bar> in some commands but it is treated as | in the :command command.I am trying to understand why...

View Article


Passing a pattern as argument without extra escaping

so I want to pass a pattern to a command. command! -nargs=1 -buffer Vim silent exec "vim! /" . <args> . "/ ./*" | copen | redraw!But there is a problem. If I want to match /foo i would use the...

View Article

What does the command option '-range=N' do?

I can't understand the vim help for :command-range, it states -range=N A count (default N) which is specified in the line number position (like :split); allows for zero line number.The documentation...

View Article

How to add modifier to user defined command?

I'd like to write commands that work with :tab and :vert. Say I have a command that opens a new split window as shown belowfunction! FooSplit() let l:message="hello world" new put!...

View Article

How to create ctrl map in command directly?

I'm trying to toggle some ctrl maps in command directly, it didn't work as expected:com Test0 nnoremap <c-j> :echo "c-j"<cr>com Test1 nnoremap <c-h> :echo "c-h"<cr>com Test2 exe...

View Article


How to define a command if the function needs to take an argument from the...

Suppose I am defining a few commands that are similar in functionality. In this particular case, I am defining a few commands that each echoes a particular message: function! EchoMessage(text) echom...

View Article

How can I alias a command with arguments?

All I want to do is to change :vertical resize+ arguments into :vr+ arguments.for example change::vertical resize +60 <CR>into::vr +60 <CR>From other answers Aliasing a command in vim, I...

View Article


How to pass everything from a command into a function with escaped characters

These are my scenarios and expected outputfunction! s:Foo(text) echoerr "'" . a:text . "'"endfunctioncommand ... FooCommand ... (not sure what to write here)FooCommand text'text'FooCommand text...

View Article

creating a ":KeepCursor" command

I'd like to make a command that works like this: :KeepCursor {cmd} will the given execute ex command string, then restore the cursor's position. A primary example is::KeepCursor normal! *which would...

View Article


Stop flushing the last command when hitting enter

Suppose I wrote this command:command! -nargs=1 E echo ' -> <args>'and when user feeds an argument,:E abcI intend to see the following effect as they hit Enter::E abc -> abcOf course that's...

View Article

How to find out where a function or command was defined?

I'd like to know if there is an analogue to verbose map <key> (which shows the location where the map was assigned) for functions and commands. For example, I have a few Git plugins and I'd like...

View Article

Run vimscript+python user commands sequentually?

I am running vim 8.2.2121.I am trying to open 3 tabsOne tab has instructions in it and is opened read only.Both tabs 2 and 3 create :new files and read template files into them on separate tabs.There...

View Article
Browsing all 60 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>