New answers tagged

1

Turns out that removing all ~/.zcompdump files solved it: rm -r ~/.zcompdump*


1

T$c, Or if you want to create a text object: onoremap i$ :normal! T$v,<cr> vnoremap i$ <esc>T$v,


1

If you need to delete text with d without altering your yank register (say, you've already yanked text in it that you're not ready to paste before your delete some other text for instance), you can use the black hole register _. If you do "_dd for example, the current line will be immediately deleted and forgotten. Actually, I don't use this register very ...


0

1Gyy7Gp #use 7 if you wish to paste the line at 8 3Gyy8Gp #use 8 if you wish to paste the line at 9


1

You can use the :copy command, which can be abbreviated as :t: :1t8 :3t8 If you want to copy a range of lines (e.g. all lines from 1 to 3) you can do it like this: :1,3t8


28

You can append to a register instead of erasing it by using the upper-case letter instead of the lower-case one. For example: :1y a # copy line 1 into register a (erases it beforehand) :3y A # copy line 3 into register a (after its current content) 8G # go to line 8 "ap # print register a


1

A solution from the StackOverflow: :help 'viminfo' ... < Maximum number of lines saved for each register. ... :set viminfo? :set viminfo='100,<100,s10,h


1

sed 's/abcd\(X[0-9][a-z]ad\)45das/\1/g' your_file_name should do it.


5

sed does not understand \d. You can use [0-9] or, more generally, [[:digit:]] in its place: $ sed -r 's/.*(X[[:digit:]])(.*)45.*/\1\2/' test.txt X1yad X2fad X3had X4wad X5mad


0

You sed does not understand the special sequence \d. Replace \d with [0-9] or character class [:digit:]: $ cat file.txt abcdX1yad45das abcdX2fad45das abcdX3had45das abcdX4wad45das abcdX5mad45das $ sed -nr 's/.*(X\d)(.*)45.*/\1\2/p' file.txt $ sed -nr 's/.*(X[0-9])(.*)45.*/\1\2/p' file.txt X1yad X2fad X3had X4wad X5mad


2

Go into paste mode: :set paste after pasting, you want to end paste mode: :set nopaste


2

One option may be to remove the "r" formatoption, with: :set formatoptions-=r and also possibly other options, all of which I found at: http://vi.stackexchange.com/questions/1983/how-can-i-get-vim-to-stop-putting-comments-in-front-of-new-lines


1

If that is a static file, most likely your browser doesn't really retrieve the new file, you can check that by pressing Shift while clicking refresh (at least in Firefox). If that doesn't work, it is probably your webserver doesn't notice the change in that case reloading the webserver is normally enough. E.g for apache2 service apache2 reload or ...


0

You want to move through each cell. So, in normal mode, w or b command will help you to move forward or backwards through every word. To get the same facility in insert mode, you can use map. :imap <Tab> <Esc>wi Put this in command line. When you are editing, you can press tab to move to next cell. The mapping I have done will come out ...


4

The best approach is to first modify Vim configuration files to automatically load your configurations. It can be done by writing the following lines to either ~/.vimrc if you want just to your user or /etc/vim/vimrc if you wish it applied to every user. syntax on set autoindent set smartindent set tabstop=4 set shiftwidth=4 set expandtab set ...


1

This came to me after I asked the question in another forum AskUbuntu: vim.desktop - changes lost when terminal exits and a lot of experimental *.desktop files demonstrating that gnome-terminal would allow vim to be killed without warning even if it was running in an shell & even if there were other commands before or after it for bash or gnome-terminal ...


0

You can use Vim in Ex mode: ex -bsc '%s/\r//|x' file -b binary mode % select all lines s substitute \r carriage return x save and close


2

I cannot provide proof of any kind, but Ctrl-P and Ctrl-N belong to the emacs key bindings, in contrast to vi bindings (bindkey -e vs. bindkey -v). Under this premise, you should look for an explanation in emacs itself. emacs' tutorial tells There are several ways you can do this. You can use the arrow keys, but it's more efficient to keep your ...


1

I had this hack in my vimrc: set shellcmdflag=-ic to get bash aliases to work in vim. This caused the described behaviour. By piping ack to another process ack will be runned non-interactive. Solution, delete the hack.


0

The value of TERM is irrelevant. As I pointed out in tmux doesn't passes correctly ctrl-shift-arrow sequences, tmux has a table of xterm-style special keys which it knows about. For this case, the table xterm_keys_table has an entry for insert: { KEYC_IC, "\033[2;_~" }, which means that it normally converts any of the variations with a ...


1

It turns out, that the terminal locales were setup somehow wrong. My .bashrc had a export LC_ALL=C. > locale LANG=en_US.UTF-8 LANGUAGE= LC_CTYPE="C" LC_NUMERIC="C" LC_TIME="C" ... LC_IDENTIFICATION="C" LC_ALL=C After removing LC_ALL=C I get this: > locale LANG=en_US.UTF-8 LANGUAGE= LC_CTYPE="en_US.UTF-8" LC_NUMERIC=en_US.UTF-8 LC_TIME=en_GB.UTF-8 ...


0

The problem is solved by changing double quotes to single ones: :shell vim --remote-send '<C-\><C-n>:vsp %d/%f<CR>'


0

Remove your ~/.viminfo file and start again.


3

The vicmd mode, despite the name, is for Vi's normal-mode commands. The prompt started by : isn't for Vi's ex-mode commands, but for running ZLE (Zsh's line editor) commands: $ echo foo execute: e_ edit-command-line emacs-forward-word end-of-history end-of-line-hist exchange-point-and-mark execute-named-cmd ...


0

Define a function: fun! App(filename) exec "w !cat - >> " . shellescape(a:filename) endfunc Call a function: call App('/foo/samples')


19

From :h :w: :w_a :write_a E494 :[range]w[rite][!] [++opt] >> Append the specified lines to the current file. :[range]w[rite][!] [++opt] >> {file} Append the specified lines to {file}. '!' forces the write even if file does ...



Top 50 recent answers are included