vim

How do I create skeleton files, or templates, for MacVim

I have seen instructions about creating a "skeleton" file in vim. This involves creating the file, naming it "tmpl" plus the extension of the file type you are targeting (ex: tmpl.html), saving it to the "skeleton" directory, and then editing the vimrc file. But, in MacVim, I don't see a "skeleton" directory anywhere. Googling, etc., ha...

file encoding generating blank character in ruby -- why?

I'm using this little bit of ruby: File.open(ARGV[0], "r").each_line do |line| puts "encoding: #{line.encoding}" line.chomp.split(//).each do |char| puts "[#{char}]" end end And I have a sample file that I'm feeding in the file just contains three periods and a newline. When I save this file with a fileencoding of utf-8 ...

Vim: Replace selection with default buffer without overwriting the buffer.

Here is my problem: I am in visual mode. I select text and copy it to the buffer. ((y)ank) I select another text which I want to replace and paste the buffer. ((p)aste) Now the second selection has been replaced in the buffer, however I want the first one to still sit in there. Any ideas? ...

Autowrite when changing tab in vim

"autowrite" doesn't seem to work when switching tab in vim. Is there a way to enable it? (I could remap 'gt' and 'gT' but I'd like to find a cleaner way). ...

how to use pylint in vim

I do not want to install another plugin, like pylint.vim, And today, I decide to use vim edit python instead of pydev which is a eclipse plugin. But I got issues. I have add this in my vimrc autocmd BufWritePost *.py !pylint <afile> but pylint does not contains filename in output ************* Module mymodule E: 22: invalid syntax ...

VIM function to insert timestamp

Someone in a previous question suggested the following for adding timestamps to VIM: nmap <F3> a<C-R>=strftime("%Y-%m-%d %a %I:%M %p")<CR><Esc> imap <F3> <C-R>=strftime("%Y-%m-%d %a %I:%M %p")<CR> Instead of using F3, I'd like to insert the timestamp by executing a function instead. For example, typing :Now. Unfortunately, I don't gr...

VIM Auto Complete Navigation

I've disabled the arrow keys on my vimrc but... How do I navigate up and down on autocomplete popups? j and k doesn't work as I am on Insert mode. Tks! ...

Cannot jump to newer position in jump list

For some reason, I cannot jump forward with <C-I>; gives me the error beep. <C-O> works just fine. I don't see any remapping going on either. Any ideas what might be the problem? I'm using vim 7.3 on win7 EDIT: I just found out <C-I> does the same as %! I still can't figure out how to fix it though. ...

How do I replace or find non-printable characters in vim regex?

I have a file with some non-printable characters that come up as ^C or ^B, I want to find and replace those characters, how do I go about doing that? ...

how to use pythontidy in vim

what I am using now is , autocmd BufWritePost *.py !python PythonTidy.py % % It really call the tidy programe and change the file, but the vim does not reload the new file. And I do not want to install another plugin for it. ======================= note: I found it's dangerous about this feature, PythonTidy will will output a empty ...

vim replace only for whole-word match

code sameple: for file in files: do_something(root+file) "file" is warned as "redefined symbol", so now I want to replace file to f but I must keep files usually I use below command: :%s/file/f/gcI but it will match files, is there any way to match only whole word, and notice the (root+file) syntax. ...

Search and replace in a range of line and column

I want to apply a search and replace regular expression pattern that work only in a given range of line and column on a text file like this : AAABBBFFFFBBBAAABBB AAABBBFFFFBBBAAABBB GGGBBBFFFFBHHAAABBB For example i want to replace BBB with YYY in line range 1 to 2 and from column 4 to 6, then obtaining this output : AAAYYYFFFFBBB...

Documentation for vim help file markup

Is there a complete source of documentation on the markup format used in vim help files? :help write-local-help provides some info but does not, for example, document the markup used to indicate quoted sections. update: I've also discovered this post on the vim-use mailing list which provides slightly more info than the afore-mentioned...

Change working directory to currently opened file

How can I change my working directory to the path of the file that I currently have open? Example current working directory is $HOME vim /tmp/test.log ??? CWD is now /tmp/ ...

do ruby plugins make starting vim very slow?

Lately vim takes a long time to start up when I'm running it to edit a ruby file or a rails project. But it starts up fast when invoked on a plain text file. Is there any way to find out which ruby vim plugins are most responsible for prolonging the startup? ...

how to make vim show ^M and substitute it

my vim show tab as --->, but does not show windows ^M character. And , how substitute it in vim. renew ============ I check my vimrc it is set fileformat=unix but when I open a dos file set ff is dos ...

how to force vim to syntax-highlight a file as html?

I'm just beginning to get my way around vim. This is my doubt. How do i set vim's syntax highlighting to treat a file as a html file? I'm using ez template, so the file's extension is .ezt. But a lot of it is normal html code. ...

Toggling the concealed attribute for a syntax highlight in VIM

Hi, I currently have a syntax file that parses a log file, very similar to the following [this is for syslog]: syn match syslogText /.*$/ syn match syslogFacility /.\{-1,}:/ nextgroup=syslogText skipwhite syn match syslogHost /\S\+/ nextgroup=syslogFacility,syslogText skipwhite syn match syslogDate /^.\{-}\d\d:\d\d:\d\d/ ...

Vim auto-indentation: Align an array initialization which extends over multiple lines

Sometimes an array initialization in C extends over several lines, especially if the array is multidimensional. In Emacs the result of auto-indentation looks like this: int a[N][N] = {{0, 0, 6, 7, 0, 4, 0, 2, 0}, {0, 5, 0, 6, 0, 0, 0, 0, 1}, {2, 0, 0, 0, 0, 8, 0, 0, 4}, {4, 0, 9, 5, 0, 7, 0, ...

vim regex replace multiple consecutive spaces with only one space

I often work with text files which have a variable amount of whitespaces as word separators (text processors like Word do this, to distribute fairly the whitespace amount due to different sizes of letters in certain fonts and they put this annoying variable amount of spaces even when saving as plain text). I would like to automate the p...