Sort by block in vim

I'm looking for a way to sort in selected block in Vim. The scenario is I have something like this {:a :c :b} # after sort, it should be {:a :b :c} How I do it now is I have to enter :a and :c to new lines, running sort on selected block and then put

Is it possible to display tabs as tabs in list mode?

I am trying to show trailing spaces as periods but tabs as tabs in Vim. Here is the help document I am looking at. 'listchars' 'lcs' string (default "eol:$") global {not in Vi} Strings to use in 'list' mode and for the |:list| command. It is a c

A better way to write int main () {}

I recently started to use vim. When I start coding, I usually start with following format. ('_' denotes the location of a cursor.) int main(){ _ } Here is what I have done 1. type int main(){} 2. ctrl-o h (move left) 3. enter twice 4. ctrl-o k (move

vim without an editor command. : SyntasticInfo

Trying to customise a JavaScript dev environment with these instructions. I can build the Plugins with vim +PluginInstall +qall, I'm using Vundle, but I get a Not an editor command: SyntasticInfofrom vim. I have the same problem with :Helptags. How c

Syntastic installation issue: ^ M file endings

I'm trying to install Syntastic for Vim using Cygwin. After completing step 2.1 and the cloning part of step 2.2 in the installation guide of Syntastic, I find that now when I run vim I get the following errors: Error detected while processing /home/

Vim & amp; Mac: How to copy to the clipboard without pbcopy

I have a version of vim with both clipboard and xterm_clipboard support. However, "*y or "+y don't copy to the system clipboard. I know I can use :w !pbcopy (and even create a shortcut for it), but I really want the standard way. I saw fakeclip

Make two windows with separate files (?) In gvim

I'm a beginner vi user. I don't know the terminology, but I want to split my gvim terminal(screen?) into 2 windows which each have 5 different files(buffers?). I can open the first 5 files in one window, then split to a second window, but I don't kno

Automate the execution of several commands and vim strikes

I want to automate running several commands in vim, i.e. by typing :repl. The commands are: :ConqueTerm lein repl <Esc> :set syntax=clojure <i> How do I define a custom vim function (command) that executes the above? About the above: clojure -

Problem when running vim as root

If this question is not considered to have this place in this forum, tell me I will remove it instantly ! I have installed on my ubuntu a vim plugin (called NERDTree). It works well when I open a file with a non-root status. When I run vim as a root

vim (gvim) very slow boot with latex-suite

I'm experiencing a very slow startup of gvim with tex files and the latex-suite plugin. For example, opening this tex file takes 7 seconds. A minimal .vimrc file only contains the following line: filetype plugin on My .vim folder only contains the la

vi editor, copy a block (no usual action)

a lot time again I once used the set of commands, but forgot it. I want to to this, (not yy or 10yy), In vi editor, I need to copy a block. There are many ways, but one way is very quick. 1, label the first line by some way, 2, then label the end lin

convert var (a, b) to var (b, a) to VI

Is it possible with any command to convert this flux(1,i) flux(2,i) flux(3,i) flux(4,i) flux(5,i) to this in VI? flux(i,1) flux(i,2) flux(i,3) flux(i,4) flux(i,5) In general i want to convert flux(a,b) to flux(b,a)Do a replace regex, swapping the two

How to customize plugins in janus, a vim distribution?

Janus is good piece of pre-configured ViM [and its plugins]. There are two different hooks .vimrc.before which runs before Janus is loaded, and .vimrc.after which runs after Janus is loaded but before any plugins are loaded. All seems fine, but I cou

Unicode printing in vim

I am working with text files that contain a lot of unicode characters (≼, ⊓, ⊔, ...). Vim displays them fine, but when I print they are replaced by a generic character. Gedit prints them without problem, but it's a bit of a pain to launch another edi

How can I solve these problems with numbers?

I still have troubles with numbers in Vim: p.e. let a = 1.02 | let b = '10000000' | let total = a*b | echo total --> 1.02e7 I would like to avoid Exponentials. How can I have the output 10200000 ? let a = 4000000000 | let b = '1' | let total = a+b |

Completion of the file when mapping commands in VIM

I often create a temporary mapping to do something on a particular file. Typical example is this: :map <leader>f :w<cr>:! bundle exec cucumber features/account/sign_in.feature:41<cr> I want the file features/account/sign_in.feature to be

What is Vim like Lisps are at Emacs?

I have about 15 Emacs years behind me and picked up Vim about a year ago. Currently I am more or less equally efficient in both (as far as editing is concerned) and love both. Now the lisp hacking experience in Emacs is something extraordinary; every

Change the default location of vimrc

In Vim, is it possible to change the default location of the user vimrc file, i.e., from $HOME/.vimrc to some other location ?You must start vim with the command vim -u ./path/to/your/vimrcfile vim -u NONE is a good way to start Vim without any plugi

Prevents file saving during BufWritePre

I have a function which performs validity checking on the current file (so as to conform to my employer's coding standards). I would like to call this function before saving, i.e. using BufWritePre. However, I would to prevent saving the file if it f

Vim: Slow update of the TagList plugin

I am using Vim with TagList in development. TagList seems to be very nice, but one problem with that is that it takes a long time to refreshe, so if for example I mean from the function A to the function B in the same file, it takes around 5 seconds

How to map the CAPS LOCK key in VIM?

I'm using GVIM under Windows. And want to map CAPSLOCK to Ctrl+^ Any way to do this? Btw, I see tons of samples over the web how to swap CAPS and Esc using registry hack, but none of them use VIM map command, instead external tools and registry chang

Which Vim order (s) can / can be used to quote / quote words?

How can I quickly quote/unquote words and change quoting (e.g. from ' to ") in Vim? I know about the surround.vim plugin, but I would like to use just Vim.surround.vim is going to be your easiest answer. If you are truly set against using it, here ar

Deleting duplicate rows in vi?

I have a text file that contains a long list of entries (one on each line). Some of these are duplicates, and I would like to know if it is possible (and if so, how) to remove any duplicates. I am interested in doing this from within vi/vim, if possi