Tag Info

New answers tagged

1

There's no way, unless you switch the complete UI to right-left mode via :set rightleft or $ vim -H. Even common workarounds such as using the signs column (which a plugin used to implement 'relativenumber' before that was built-in) won't do, as those appear on the left as well. The only, very clumsy hack would be a thin scratch buffer in a vertical split on ...


1

VIM's Hebrew Mode will put the line numbers on the right, with set nu To start VIM in Hebrew Mode use vim -H Documentation here Warning: It does reverse your text to rightleft as well


0

You can add the following code to your vimrc, When you comeback to your file, vim back automatically to old position: if has("autocmd") au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif endif


2

just for fun there is -c 'normal 14j24l' which will put you on line 15 character 25


1

Worth noting: -c command Run the given ex command upon startup. Only one -c option is permitted for vi; Vim accepts up to 10. An older form of this option, +command, is still supported. The +command has the same single ex command limitation when using vi. The +/pattern is also limited to one command with vi. ( taken from vim and ex editor )


4

With the file-line plugin, you can simply append line and column to the file name, both when invoking Vim and inside with commands like :edit: vim myfile.xml:15:25


9

You can use: vi '+normal 15G25|' myfile.xml


2

I don't know about the -c option, but you should be able to do: vi '+cal cursor(15,25)' myfile.xml (make sure you quote because of the parenthesis () )


0

Using gvim fixes the <S-CR> issue, but other mappings still aren't working, like ,ev (mentioned in the comments).


0

Also check out vim-airline. Note that you still have to use "set laststatus=2" show the status line.


2

If you let g:ycm_always_populate_location_list = 1, YouCompleteMe will populate vims location list with new diagnostic data. You can jump through the entries in that list with :lnext and :lprevious. You can read more about the location list in the documentation of the quickfix feature (:h location-list or use the online version).


0

Its 'NO EOL' - no end of line indicator. Very helpful if you end up opening a very large file (>1GB). Vim tries to pull all that in 1 line. This indicator helps me quickly close the file before it screws up my OS.


0

I actually use CtrlP C matching extension ctrlp-cmatcher Its quite a bit faster, and results are what one would expect (without having to use regex).


1

You basically already know the answer from here. It's quite easy to put this all together like this: function insert_files() { vifm -f < /dev/tty > /dev/tty while read l; do LBUFFER+="'$l' " done < ~/.vifm/vimfiles zle reset-prompt } zle -N insert_files bindkey '^t' insert_files I'm not a zsh-user, so I stole structure ...


1

The shell options don't inherit to forked shells, but that's what Vim does when you use the :! command: it launches a new shell. You can influence those forked shells in Vim via the 'shell' option: :set shell+=\ -O\ globstar or :set shell=/bin/bash\ -O\ globstar


3

Zsh allows you to bind a shell function to a key and also has a builtin to put text into your command line. So you can do something like this (in zsh): # define a function that does the work function my_browser_function () { local result result=$( some command that returns the filename ) # print -z $result (see comments) LBUFFER+=$result } # turn ...


1

You can use the built-in quickfix list to collect all matching lines, with :vimgrep. For example: :vimgrep /^rsync: / % :copen Plugin alternative My ExtractMatches plugin provides (among others) a :GrepToReg command. With it, you can collect the matching lines in a register and then paste that into a new scratch buffer: :GrepToReg /^rsync:/ :new | put! ...


1

Use redir to redirect to a new file: :redir > rsync.log :g/^rsync/ :redir > file_vanished.log :g/^file/ :redir END :q cat rsync.log rsync: send_files failed to open "/cygdrive/E/Users/SharedFiles/3DS SALES/3DS MARKETING/PORTFOLIOS/2012 - Portfolios/Signage"XXXXXXXX Full Res photos/xxxxx xx sky/.DS_Store": Permission denied (13) rsync: opendir ...


2

You can use :redir for this: *:redi* *:redir* :redi[r][!] > {file} Redirect messages to file {file}. The messages which are the output of commands are written to that file, until redirection ends. The messages are also still ...


2

You are looking for ftplugins. This is their purpose. And don't forget to define your mappings, setting, abbreviation, commands, ... as local. Otherwise they'll parasite other buffers once loaded. Here are some more complete answers: http://stackoverflow.com/questions/1413285/multiple-autocommands-in-vim/1414845#1414845 ...


1

Commands with the word Plugin should be preferred. In past plugins used to be called "bundles", therefore all associated commands had "bundle" in the name. In the beginning of 2014 there was a global rename (see this commit). The old "bundle" commands were left only for compatibility reasons.


2

This can be configured via a buffer-local b:browsefilter variable, which is set in filetype plugins; for C/C++, $VIMRUNTIME/ftplugin/c.vim. To change / override this, just put the following into ~/.vim/after/ftplugin/cpp.vim: let b:browsefilter = "C++ Source Files (*.cpp *.c++)\t*.cpp;*.c++\n" . \ "C Header Files (*.hpp, *.h++)\t*.hpp;*.h++\n" . \ "C ...


4

Yes, the vim command you're looking for is :source or :runtime to pull them from runtimepath. For example, you could do this in your .vimrc: runtime custom/java.vim runtime custom/haskell.vim presuming ~/.vim is in your runtimepath (which it is by default). You could also drop your scripts in the ~/.vim/plugin directory; see write-plugin in the docs. ...


5

Vim is acting as if you had typed all of your pasted code by hand, so Vim will add additional indentation and otherwise change whitespace as it normally would, such as with your autoindent setting. To paste code in Vim: :set paste to enable paste mode. Paste your code. :set nopaste to disable paste mode so your normal typing will work as expected again. ...


1

Do :set paste Above code solves your problem.


2

When gvim starts, it sources a file called mswin.vim via the _vimrc file. In the mswin.vim file the keys are remapped. You can undo this two ways. One is edit the mswin.vim file and remove the mapping (not recommended). A second easier potentially less invasive way is to edit the _vimrc file. 1. Start gvim as Administrator. 2. Click ...


0

As I've found myself frequently doing this I mashed up an (improvable) script. You or someone else might find it useful. Short explanation: Basically it searches buffer list and show result in quickfix-window. Two basic commands is added. Search <pattern> : Search all buffers for <pattern>. Search1 <pattern> : Search all buffers ...


0

For now I've started a GitHub project for anyone interested.


2

Vim can get close(r) to an IDE in terms of features via various plugins, but it will always remain a powerful text editor with great extension capabilities. So for anything larger than a hobby project, you'll certainly miss IDE features like debugging, variable inspection, refactoring, find usages, etc. But why not have both? It's easy to set up a command ...


2

There is a plugin called CodeOverview that can be used on windows (and Mac?): http://www.vim.org/scripts/script.php?script_id=2888?


0

I usually do this. sudo chmod 000 file && sudo chflags uchg file Technically it won't "hide" the contents but its a good way to keep it out of public access. Might wan't to chflags hidden file on it too, which will hide it.


4

You can use the vim command :X to encrypt the file. It will prompt you for an encryption key, twice. Then save the file as normal. If someone tries to read the file (including root user), it will be gibberish: Mark@MarkBeast ~ $ vim test.txt Mark@MarkBeast ~ $ cat test.txt VimCrypt~01!o▒rl▒_▒Ĩ7vE=▒g Mark@MarkBeast ~ $ When you vim the file later, it ...


1

You can change the permissions on the file to 000. $ chmod 000 somefile Example Initially we have this file: $ cat afile secret Change the permissions, and confirm: $ chmod 000 afile $ ls -l afile ----------. 1 slm slm 7 Nov 26 13:07 afile Now we can't see it: $ cat afile cat: afile: Permission denied Caveats with this This is easy to ...


1

This is a buffer flush-to-disk problem. Vim tries to keep your work safe and doesn't assume you can type several thousand characters per second. Read :help swap-file for some details on the buffering. The solution to your problem is this: Turn off vim's swapfile either with: vim -n <your file> or from within vim before the paste: :set noswapfile ...


0

You can simply open the editor by typing vi This will open the default page that shows the version number.


0

Vim can be used to compile using gnu make on the current file - even if there's no Makefile for the file (for more details see here): :make %:r This way vim provides you with access to the quickfix error feedback from the compiler (:help quickfix) list - :cn Next error, :cp Previous error, :cw New window listing errors. If you've not got gnu make then ...


0

Rename the current buffer with :file <new-name> (or :f <new-name>): :f[ile][!] {name} Sets the current file name to {name}. The optional ! avoids truncating the message, as with :file. If the buffer did have a name, that name becomes the alternate-file name. An unlisted buffer is created to hold the old name.



Top 50 recent answers are included