3

You could do this: let @b=system("time.bash " . @a) The @a is register a and @b is register b. The system(...) runs a command and returns the output. The result is a line, so when you paste it, you get a new line. See :help system(). Another way is: call setreg("b", system("time.bash " . @a), "v") Here you can set the mode for the register. The lower ...


2

There are a couple ways that come to mind. Here's one... let g:inactivity_limit = 20 " max Insert mode inactivity before fail, in seconds let g:check_frequency = 10 " seconds between checks augroup monitor au! " when vim starts kick off the infinitely repeating calls to the monitor function au VimEnter * call timer_start(g:check_frequency * ...


2

The OP's question is whether there is a good omnifunc for Vimscript itself, such as offering semantically or syntactically are completion suggestions for vimscript functions, variables, etc. A number of answers just note general autocompletion plugins like YCM and snippet plugins like UltiSnips. So to answer the original question: Yes, there's vim-verdin: ...


2

Do the :execute inside your mapping instead. You don't need to use <Space> in mappings, you can just use an actual space instead. You probably want to include a <cr> at the end, to actually execute the :Files command and not leave it pending on the command line waiting for you to press enter (but, again, maybe that's what you want?) Putting it ...


2

The most general improvements I can give are to avoid the long ?: and to make use of the get function on dictionaries. For example, I would write return get(g:, 'git_branch', '') For the if, use a plain if let l:is_git_dir = trim(system('git rev-parse --in-inside-work-tree')) if l:is_git_dir is# 'true' let g:git_branch = trim(system('git rev-parse --...


1

Consider using the vim-indent-object plug-in, which allows you to select or delete blocks based on indentation. As long as your indentation is correct (and that should be easy, since Vim has good Fortran plug-ins to indent your code correctly and the built-in Fortran indentation plugin works well enough), the vim-indent-object motions can accomplish what ...


1

DBK already show you how to fix it, so i explain only why your approach doesn't work here. From :h feedkeys() : The function does not wait for processing of keys contained in {string}. To show you that: nnoremap ,t :call <sid>foo()<cr>:echom 2<cr> function! s:foo() echom 1 call feedkeys(":echom 3\<cr>") echom 4 endfunction ...


1

There are two <para> because you apply v:count1 to every tag you render. Try this: function s:DocbkPrintTag(tag) " apply v:count1 to the outside tag put =repeat(s:DocbkRenderTag(a:tag), v:count1) endfunction function s:DocbkRenderTag(tag) ... " render single tag here if !empty(include) for incl_tag in include let incl_result .= ...


1

After following dedowsdi's instructions, it turns out you just need to do: let dir = finddir('.git/..', expand('%:p:h').';') expand(%) expands into the path of the current file (excluding the filename).


1

You can use the writefile() function to write to an external file from a Vimscript function or mapping. (Using external shell commands through ! or the system() function would be another possibility, but sticking to a native feature of Vim is probably better.) Consider that you'll need to have permissions to write to the aforementioned file from Vim under ...


1

0- +1 to D. Ben Knoble suggestions. Regarding pure vim-scripting 1- Never define autocommands globally. Prefer to define them in their own group, and when filling the group, start by clearing it. This way, the related snippet of code can be re-executed, which you'll will want when you'll be working of your script aug MyGitBranch au! au BufEnter * call ...


1

The highlight * is actually just a search for word nearest to current cursor. So they are available in ‘last search pattern register’ / (that is slash register). If you don’t want the word boundary \< and \>, use g* instead. In case you highlighting (selecting) using Vim visual-mode or mouse selection, you can press y afterward. This will make it ...


1

With Vim 8+ on Linux or Mac, you can now simply use the terminal's native paste (e.g. middle mouse button, ctrl+shift+V in Gnome, cmd+V on Mac) if the terminal supports bracketed paste. Do not press i for Insert Mode. It will paste the contents of your OS clipboard, preserving the spaces and tabs without adding autoindenting. It's equivalent to the old :set ...


1

:h xterm-function-keys An xterm can send function keys F1 to F4 in two modes: vt100 compatible or not. Because Vim may not know what the xterm is sending, both types of keys are recognized. The same happens for the <Home> and <End> keys. normal vt100 ~ <F1> t_k1 <Esc>[11~ <xF1> &...


1

There is another way that doesn't move the cursor nor requires :exe, but uses other tricks. Here I count by using a function that modifies and returns something (if += was an expression like in C, it would have been simpler) command! -nargs=1 -range Count call s:Count2(<f-args>, <line1>,<line2>) " Not using the usual :function-range to ...


1

Warning: The accepted answer does not return a number or number-like object. This does. function! Count( word ) redir => cnt silent exe '%s/' . a:word . '//n' redir END return matchstr( cnt, '\d\+' ) endfunction With the same instructions as the accepted answer, except you can actually perform further calculations with the result, e.g.: echo ...


Only top voted, non community-wiki answers of a minimum length are eligible