Tag Info

New answers tagged

1

ctrl+L will get back to normal vim mode. You can then use the usual :q


0

The ANSI Escape sequences that are used by the terminal all start with Escape (^[), and as Vim is using those to communicate with the terminal, it gets confused when you map <Esc>. That's also why there are no problems in MacVim (and GVIM); those do not use the terminal and have different I/O channels. Mapping <Esc> in terminal Vim is just ...


0

You actually can open new tabs and keep your current tabs without writing new functions. See this answer on Stack Overflow: http://stackoverflow.com/a/11430615/200234 :args file1 file2 | argdo tabe You may want to open a new empty tab (:tabe) before doing that, because the first file will open in the current tab. Also, an extra empty tab will be left open ...


0

I would suggest to use the map <C-c> <C-v><C-c> noremap <C-v> <C-v><C-v> Because if you have opened a external text editor, a simple C-c at FF window will end the external editor and you will lose everything. BR


2

It looks like the register contents you've yanked originate from a blockwise selection. Then, on paste, Vim will indeed insert the contents inline, making space for the amount of text in the register, instead of inserting brand new lines. You should use the V command for linewise visual selection. Then, the correct expected paste behavior will happen on ...


1

Since this question not specifically about configuring paths in order to have plugins work, an alternative to mucking around with all the path stuff is to just source the specific plugins you want in vim from your .vimrc (assuming it's working) by adding the line :source PATH/TO/FILE.vim. Vim generally checks for .vimrc right in the home directory ~/. If it ...


1

Per Egmont Koblinger's helpful input on the bugtracker (https://bugs.launchpad.net/ubuntu/+source/gnome-terminal/+bug/1435905), it appears that this bug has been fixed upstream. The bug appears to have been caused by libvte's lack of support for OSC 112, the "reset cursor color" escape character. This is probably why Jeff noticed the bug after installing ...


0

Thanks to pope's answer, I tried the tmux -C hint. You don't have to install anything, because the current tmux version supports the -C flag. Use -CC, because -C isn't always working. So with tmux -CC (or tmux -CC attach) tmux is even better than it already is.


0

Based on the characteristic default color (and some experiments), this is the Title highlight group. Note that this is also used in several Ex commands (e.g. :changes). If you don't want that color, you can also define your own, custom tabline. See :help setting-tabline for an example that emulates the default one.


1

Vim in Ex mode (also known as ex) is useful when: You're in need of editing (multiple) files non-interactively (as part of the script). Your connection is very slow or screen is not updated after your actions. Mappings and abbreviations are disabled. Common keys such as Escape or Control doesn't work properly. Editing files non-interactively is the most ...


2

You can accomplish this by combining the tab command with the sb[uffer] command. First you'll need to know the buffer id of the buffer you wish to open in a new tab. You can find this out with the ls command: :ls 1 %a "foo" line 1 2 "bar" line 0 Once you have the id, you can easily open it in a ...


0

You can use, rm -f .<filename>.<ext>.swp Example: rm -f .rc.local.swp


2

I think there is no default join operator. But you can use this code, from a old vim thread on the same subject: nnoremap J :set operatorfunc=Joinoperator<CR>g@ nnoremap gJ :set operatorfunc=GJoinoperator<CR>g@ onoremap J j func! Joinoperator(submode) '[,']join endfunc func! GJoinoperator(submode) '[,']join! endfunc Notice ...


0

This was something that I was missing from Vim, and zap-to-char didn't seem to cut it right. Here is my humble attempt to recreate "ci" and "ca": (defun change-outer (str) (interactive "sChange outer: ") (condition-case nil (search-backward str (line-beginning-position)) (error (search-forward str (line-end-position)) (forward-char ...


0

In gvim, as you say you're using, if you :set winaltkeys=yes then alt key combinations are not mappable. If a menu with a given shortcut key exists it will activate the menu instead. Otherwise it will do nothing. You may need "m" in your guioptions option for this to work.


1

Try something like this: :imap <M-j> <nop> See: :help <nop>


3

You can do something like: :.,/pattern/join Essentially you're telling Vim to join a range of lines, . being the current line the cursor is on, and the last line being the first match of pattern.


2

This is caused by the following line from $VIMRUNTIME/syntax/gitcommit.vim: syn match gitcommitSummary "^.\{0,50\}" contained containedin=gitcommitFirstLine nextgroup=gitcommitOverflow contains=@Spell You could just copy that syntax script to ~/.vim/syntax/ and modify it, but that drags you into maintaining your clone. I prefer to selectively change ...


0

You could use the remote vim to make a ssh back to the local machine. You can setup the public key (this guide is specific for windows/cygwin) so you wouldn't be prompt to enter the password. Clearly it won't run on the original terminal, but for your example case it doesn't seems to be a problem. As you are running in windows you would probably need to ...


3

This appearance, with every other indent level dropped, is usually (and seems to be the case in your code) a symptom of looking at code which has 4 spaces per indent, but 8-space tabs tabs on every other line (e.g. 4s, 1t, 1t4s, 2t), with a tabstop setting of 4. For Python code, you should simply replace all tabs in the code with eight spaces, since that ...


1

@romainl is right, but I want to give his answer a different spin. Vim supports editing a vast set of different file types. Though it can open binary files (which most images are encoded in), it is predominantly used to edit text files. That's where Vim's editing capabilities shine and enable very efficient editing. So, though many file formats are edited ...


1

No. Vim is a text editor; as such it only deals with raw text and is not capable of embedding images or sound files or whatever. You should try something like EverNote or OneNote instead.


0

Another way to do this is to do 'g Ctrl-G', which prints the current position of the cursor in five ways: Column, Line, Word, Character and Byte. (from http://vimdoc.sourceforge.net/htmldoc/editing.html#CTRL-G)


0

Anyone with this issue might want to consider wemux: https://github.com/zolrath/wemux From the README: If you have Homebrew installed you can install wemux with a fairly simple: brew install https://github.com/downloads/zolrath/wemux/wemux.rb The user that installed wemux will automatically be added to the wemux host list. To change the host or add more ...


0

If your motivation is writing text lists you should check vimwiki plugin, saving vim format options for other uses, as coding.


0

Instead of 'smartindent', I'd rather set 'autoindent', 'formatlistpat', and 'formatoptions' appropriately. For example: " set up pattern to match list bullets and numbers let &l:formatlistpat='^\s*\%(\d\+[\]:.)}\t ]\d\@!\|[*-]\)\s*' " automatically format numbered or bulleted lists setlocal formatoptions+=n setlocal autoindent In the first command, ...


0

This is the easiest way that I found, to switch between tabs faster and simple. Add next lines to your .vimrc and enjoy it, more tricks about vim tabs here. nnoremap <C-Left> :tabprevious<CR> nnoremap <C-Right> :tabnext<CR>


0

I have below map set in vim: set mouse=inv noremap <MiddleMouse> :set paste<CR>"*p:set nopaste<CR> You can add this line in your ~/.vimrc or ~/.exrc. I think, this is pretty straightforward & would not require much explanation. (Re)map middlemouse to set paste mode, then paste contents of * register & then unset paste mode. You ...


0

In Vi/Vim you can do something like this: :g/./j! Which basically means, do (:g/) for every non-empty line (.) and join it with the next without adding trailing spaces (j!) Read more at the help :h :g :h :j :h /.


0

Given the gvim tag, I’ll assume you're using the gvim or vim editor. Try the macro: :map q Jxjq The J joins the two lines, leaving a space; the x removes that space, and the j moves to the next line. The q at the end repeats the process; it matches the q after the :map command. That’s an old-school vi macro; I haven’t needed to learn the more extensive ...


0

Why do you expect the editor to always choose the right indent? By configuring a particular indent setting (like the good and universal :set smartindent), you get something that works most of the time. For those other cases, you can always indent manually (with <Tab>, assuming you've properly :set tabstop=... expandtab etc.), or change the indent after ...


1

If you have sed you can do it this way: sed 'N;s/\r\?\n//' myfile.txt Explanation: sed reads in the file line by line. 'N' adds the next line (i.e. line 2 if we are currently on line 1) to the buffer, then we need to remove the 'newline' that is between the 2 lines we now have in the buffer. The 's' command replaces some text on the line (as specified ...


0

For some reason Vim on Mavericks did not come configured with a color scheme. After I added some lines to the vimrc file (copy & paste from a site) it started behaving like you describe, in my case, deleting extra whitespace after each statement fixed it.


0

A quick fix is to run the following in the terminal. export TERM=xterm-color You could add it to your ~/.bash_profile or other profile to always be set on start.



Top 50 recent answers are included