Naumann
  • Member for 4 years, 11 months
  • Last seen more than 2 years ago
Combining shell commands with :terminal
Accepted answer
2 votes

you need a shell to parse &&. try :terminal bash -c "ls && ls" without a shell ls will see all the arguments, including && and ls and will hence fail

View answer
What is the difference between normal mode and command mode in vim?
Accepted answer
2 votes

command mode and command-line mode must not be confused. command-line mode is also called ex-mode. You are in command-line mode when you press : or Q

View answer
Execute() is not returning a value
2 votes

this is because call Example() alone wouldn't print anything. You need :echo execute("echo Example()") for execute() to print anything.

View answer
What is the relationship between command line Ex and Vim?
Accepted answer
2 votes

ex is completely part of vim, it is just a special mode. On Unix-systems there is a program called ex which is in fact a simple symlink to vim (just like gvim, evim, rvim, vimdiff et. al). Vim acts ...

View answer
How can I match the shortest string including new lines?
2 votes

try /begin\_.\{-}end \_. Matches any single character or end-of-line.

View answer
How to split the page adding a page from buffer (combining :sp/vs with :b)
2 votes

two steps: :sp newfile and then press <c-w>J rsp <c-w>L

View answer
How do I make :make run on a buffer write if I'm inside my project directory?
Accepted answer
2 votes

Another (untested) approach : :autocmd BufWritePost <buffer> make and :let &makeprg="if ! myscript >/dev/null 2>&1 ; then make ; fi" I use let &makeprg="..." instead of set ...

View answer
How to print only pattern, not a line?
Accepted answer
2 votes

try : ex +'s/.*>\(\w\+\)<.*/\1/|p' -scq! /dev/stdin <<<$"foo>bar<buzz"

View answer
Move line include indent
2 votes

Vim already has ]p and [p for this ]p : like p, but adjust indent to current line [p : adjust indent to current line Read :help ]p and :help [p for more information.

View answer
Viminfo truncates named registers. Setting to increase limit?
Accepted answer
2 votes

it can be configured with the " character of the viminfo option From :help 'viminfo: " Maximum number of lines saved for each register. Old name of the '<' item, with the disadvantage that ...

View answer
When to use the after/ directory?
2 votes

if vanilla vim recognizes a certain filetype and you want to modify the shipped behavior then your own settings go into ~/.vim/after/ftplugin/

View answer
How to tell vim to behave the same for file extension .in and .mako
2 votes

You can use autocommands in your .vimrc like au BufNewFile,BufRead ?\+.c.mako setf c This will make all *.c.mako files behave like *.c files. Make an analogous for *.pl.mako If you genenerally ...

View answer
How to suppress the error {Error detected while processing BufRead Auto commands for "*"}
1 votes

First: you don't need exec here. Use the /e flag to avoid error messages, as in autocmd BufRead * %s/\t/ /ge This flag is described in :help :s_e

View answer
How to go to different matching entry in vim's help
1 votes

you can use :help 'foldclose to get the help for the option foldclose. Find details about possible contexts in :help help-context

View answer
How do I split a vim Window using python?
1 votes

:py vim.command("sp") did it for me.

View answer
regex vim multiple characters in search, multiple characters in replace
Accepted answer
1 votes

This can be done with :%s/a\{100}/\=repeat('b',100)/

View answer
Swap grid[X][Y] to grid[Y][X] in full file
Accepted answer
1 votes

This should do what you want :%s/\[\(.\+\)\]\[\(.\+\)\]/[\2][\1] And yes, I guess all these toothpicks are really needed.

View answer
Vim can't detect if a file is vim file type by commenting a file with vim:ft=vim
1 votes

You need to have :set modeline (e.g. in your ~/.vimrc).

View answer
Loading source file with :tabe
1 votes

the statements in .vimrc are executed only once. You could create an autocommand for this matter. Find details in :help autocommand

View answer
How to redirect terminal output to vim or get `vim like` behaviour in terminal output
1 votes

one way is to simply issue terminal ifconfig (vim8 or vim7 with a lot of patches). This will open a vim-buffer with the result.

View answer
How can I get ‘n’ to go forward even if I started searching with ‘?’ or ‘#’?
1 votes

Based on Christian Brabandt's solution I came up with nnoremap <expr> n 'Nn'[v:searchforward].(&fdo=~'search\\|all'?'zv':'') nnoremap <expr> N 'nN'[v:searchforward].(&fdo=~'search\...

View answer
How to map a function key in (console) vim
Accepted answer
1 votes

simply put map <f7> gggqG into your .vimrc. It works out of the box for most terminals, including xterm and xterm-256color

View answer
Make backspace delete character and enter insert mode when in normal mode
Accepted answer
1 votes

try :nnoremap <bs> Xi together with :set bs=2

View answer
What is the meaning of "#" in ":g/pattern/z#.5"
Accepted answer
1 votes

in this context z.5 and z#.5 are identical. You find the help under :help :#

View answer
Vim is in read-only mode
1 votes

you could reset the readonly option with :set noro But the underlying problem in your case is access-right. As a normal user you (and vim) cannot write a root-file. To save your changes with root-...

View answer
Duplicate indentation of current line
1 votes

If you set ai, then <c-j> (in insert mode) will do what you want. If you want the Enter-Key to behave differently then you also can :inoremap <cr> <cr>0<c-d>

View answer
How to combine reading from stdin (- invocation argument) with ++opt
Accepted answer
1 votes

This should solve part of the problem. Try printf 'a\xC0b'| vim - --cmd "set fencs=utf8" -c "set fenc=utf8" It reads the file as utf-8 as you wanted, but the ++bad=keep thing is not included.

View answer
Triggering automatic replacements of certain strings
Accepted answer
1 votes

you can do something like :iab \mu µ Note however that this requires :set isk+=\ which may not always be desirable. Another approach is :imap \mu µ . But this has the drawback that things starting ...

View answer
How can I add a visual margin on the right of my window?
1 votes

I would simply just :rightbelow vnew together with :set wrap and adjust the windows at will

View answer
Vim's remote-send, without intermediate redraws?
Accepted answer
1 votes

one workaround is to write an tempfile with the command(s) in them. Then send a command to source this file. like in > vim --server "<servername>" --remote-send "so /path/to/tempfile"

View answer