vim

indenting a bunch of lines in VIM

Is there a way to indent a selection of lines in vim, like we have in text editors where we select a bunch of lines and press tab (or shift tab) to indent/unindent the selected lines? I am talking about general indentation and not related to code indentation. ...

vim: select to character, non-inclusive

Hi, Suppose I'm in a certain line position in vim and I want to delete up to a certain character, say a semicolon. I would do df; except it would also delete the semicolon. Is there a command that will do the same thing but will not include the character I'm searching for? ...

How can I quickly close multiple VI instances in different GNU-Screen tabs?

I often have around 10 tabs in GNU-Screen open with all of them having vim open to a different file. If I just kill the Screen session, then VIM doesn't cleanup (.swp files are still there), so I usually have to go to each tab individually and type ":wq" and the "exit" to kill the screen tab. Any faster ways to do this? ...

Decrypt VIM encrypted file in Python

In my Python web app, I would need to decrypt a file that was encrypted using VIM. Assuming the web app knows the password used to encrypt the file in VIM, how do I write code to decrypt ? ...

How do I select a chunk of text and paste it to the current cursor position w/o using mouse in vim?

I want to give up using mouse for selecting and pasting chunks of text within a buffer. Whats the most efficient way to do this with just kb? I mean navigate to arbitrary line, copy the substring, return to the previous position and paste. ...

Is it possible to object-select a heredoc or "here document" with vim?

One of Vim's great strengths is object-select, offering quick manipulation of content inside words, paragraphs and assorted delimiters. For example, vi{ will select everything inside a pair of {} braces. Is there any equivalent functionality for selecting a here document or heredoc: <<<HTML .... .... HTML; ...

How can I script vim to run perltidy on a buffer?

At my current job, we have coding-style standards that are different from the ones I normally follow. Fortunately, we have a canned RC file for perltidy that I can apply to reformat files before I submit them to our review process. I have code for emacs that I use to run a command over a buffer and replace the buffer with the output, wh...

Vim autocmd based on file contents

I'm trying to set up Vim to detect when a .tex file contains the command '\usepackage{sagemath}', and run a command accordingly. I've gotten to :au BufReadPost,BufWritePost *.tex TTarget sagepdf but that will fire for all .tex files, which isn't what I want. ...

Auto format c file in vim

Hi all SOmetimes, I may copy some code from other file, the format is mess, like fun() { for(...) { for(...) { if(...) { } } } } Is there any possible way to auto format it in the vim? Best Regards, ...

What is the most elegant way to deal with sourced files that themselves source (relative) source files in VIM?

I am editing a file like /path/to/file.txt with vim, hence the current directory is /path/to. Now, I have a directory /other/path/to/vim/files that contains sourceA.vim. Also, there is a sourceB.vim file in /other/path/to/vim/files/lib/sourceB.vim In sourceA.vim, I want to source sourceB.vim, so I put a so lib/sourceB.vim into it. Now...

vim syntax highlighting of ColdFusion hash marks

I'm trying to create a patch for cf.vim to resolve an issue with hashes. In ColdFusion, # signs are used to enclose an expression inside a cfoutput block. <cfset x = 1 /> <cfoutput> x is now #x# </cfoutput> <!--- outputs "x is now 1" ---> The problem comes into play when there is a lone #, not inside a cfoutput block: <a href="#x">a...

Vim automatically removes indentation on Python comments

I'm using Vim and editing Python scripts. Autoindent works pretty well in general, but when I start a new line and type '#' to type a comment, Vim unindents that line for me. For example, if have def foo(): and I press enter, Vim will indent properly def foo(): pass but, if instead of typing pass, I type '#', it unindents au...

Fold function in vim

Hi all Is there any way or tools to fold function in vim,like Visual Studio or Eclipse? Best Regards, ...

after quitting VIM editor I am not able to see the original screen contents that were present before entering vim

I want to see the original contents of screen after quitting vim as they were before opening a file , as of not my file quits but the original display is not there THanks ...

Great tools to find and replace in files?

I'm switching from a Windows PHP-specific editor to VIM, on the philosophy of "use one editor for everything and learn it really well." However, one feature I liked in my PHP editor was its "find and replace" capability. I could approach things two ways: Just find. Search all files in a project for a string, see all the occurrences li...

I need to test something by changing vimrc

However already opened mvim windows do not load changed done to vimrc until I close all mvim windows and start fresh. Is there a way I can tell existing mvim windows to load new vimrc file without closing and opening all windows every time. ...

vim indenting a block of code inward and outward

I am using mvim . I am trying to map keys so that I could visually select elements then I could indent the code inward or outward. However while doing outward work after every keystroke one more line at the bottom get selected. What is the fix. " Ctrl-x - move the block of visually selected code one tab right and keep visual mode alive ...

Syntastic for Vim: What are the required lines in ~/.vimrc? (PHP error checking)

I find the documents frustrating. What are the basic lines I need to add to my config file to get it working? ...

Opening files in Vim using Fuzzy Search

I'm looking for a way to make Vim have the ability to open a file by fuzzy-searching its name. Basically, I want to be able to define a project once, and then have a shortcut which will give me a place to type a file name, and will match if any letters match up. This kind of functionality exists in most editors I've seen, but for the l...

Auto 'zz' in vim after a jump

After I make a jump to anywhere in the world, whether in the current file or a different file, is it possible to make vim automatically run zz (re-center on current line)? I want this after things like search, ctrl-o and ctrl-i ... and pretty much any movement other than hjkl. Thanks. ...