vim

how can i get the word under the cursor and the text of the current line in vim script?

hi everyone, i 'm new to vim. now i'm writing a vim script. how can i get the word under the cursor and the text of the current line? i want to use it in my script. great thanks. ...

Autocompletion in Vim

In a nutshell, I'm searching for a working autocompletion feature for the Vim editor. I've argued before that Vim completely replaces an IDE under Linux and while that's certainly true, it lacks one important feature: autocompletion. I know about Ctrl-N, Exuberant Ctags integration, Taglist, cppcomplete and OmniCppComplete. Alas, none o...

What is logical AND in Sed/Vim?

I would like to get an AND -operator to the following Vim command :command! -nargs=1 GrepSource :! grep <args> `sed -n 's/^source \(.*\)/\1/p' %` such that I can use the command to find sources at # source <path> # . <path> source <path> . <path> I am not sure whether it is possible or not to get AND -operator to SED or Vim. How ...

VIM Background

When I am trying to change background in vimrc or directly in vim using set background=dark it doesn't affect my background at all, same with light option, however it looks okay when I run gvim. Is there a way to change background in vim without changing my Konsole settings? Thanks. UPD: Okay there is a difference between guifg/guibg an...

How to make vi redraw screen?

When I use git commit --amend It will enter into a vi window to let me input comments for commit, the problem is the vi windows will show some dirty characters from former shell background. So I wonder how can I let vi to reload or redraw the screen to make the screen normal. So far, I try reset terminal and Ctrl+L, it works, but I ...

Vim customization -- .vimrc -- mapping of keys

Vim customization -- I have added these lines in my .vimrc inoremap /* /**/< Left > what i intend is, when in press open comments /* -- it should automically print the closing comment. when in comments, what do i add to .vimrc, so that when in comments block at each enter, an "*" is printed at the next line. / * * * ...

How can I convert a decimal number to hex in VIM?

I have this column in a file I'm editing in VIM: 16128 16132 16136 16140 # etc... And I want to convert it to this column: 0x3f00 0x3f04 0x3f08 0x3f0c # etc... How can I do this in VIM? ...

VIM: is there an easy way to manage Visual Studio solutions / makefile projects from Vim?

Hello, I tried using Visual Studio instead of VIM(+plugins), but to be honest - the only advantage of VS over VIM is it's ability to automatically manage my project. I know of existence of ViEmu for VS, but I would like to do the opposite - is there any way to manage projects from within VIM? I tried both c.vim plugin and Project pl...

Searching for backslash character in vim

How to search word start \word in vim. I can do it using the find menu. Is there any other short cut for this? ...

vim with ssh and putty ... broken syntax coloring after windows paste

Background: I was editing a file in vim using putty over ssh. In order to copy a huge section of text to the file from windows, I just used the standard putty paste command. Now, whenever I edit a file in vim using putty over ssh, the syntax coloring is gone, and it is all replaced with a single-color yellow. Question: Has anyone else...

To get a menu for a code-beautifier in Vim by a mouse click

I have never used a mouse click to get a hovering menu in Vim. The following manual suggests such a menu exists. Here are a few vimrc lines that can help. Put them in your vimrc - -, then you can beautify at least single lines using one mouse click. nmenu Misc.Beautify.For :s/for\s*(\s*/for ( /<CR>:s/\s*)\s*$/ )/<CR>:s/\(\i\+...

How do I paste from vim to other apps with linux?

I'm trying out vim after being a long term user of textmate, and while I can see the appeal of the app, even something as simple as selecting all on vim called on the a command line to paste into another app seems needlessly complex. How do you make whatever you yank into the buffer available to other apps? At present, I'm typing ggvG ...

%:s/\([0-9]*\)_\(*\)/\2 will not rename files

can someone please edit %:s/\([0-9]*\)_\(*\)/\2 so that i can rename files. for example, if file name is 5555_word_word.jpg, then I want the file name to be word_word.jpg. i feel like I am so close! ...

Free vim add-in for Visual Studio?

Is it any free Visual Studio addons that emulate vim text edit mode? For now I have found only ViEmu, but it's 100$ :(. ...

Can vim be made to only expand tabs to the left of text?

Using vim, I would like to effectively have expandtabs off if I'm to the left of any text on the line and on if I'm to the right of any non-whitespace character. (I would like to use tabs for indentation and spaces for alignment.) Can this be done? ...

How can I configure Vim to compile C code using Borland's compiler on Windows?

I am new to the text editor Vim. I want to use it for programming C. I am using Windows and the bcc32 compiler from Borland. I cannot seem to get my C code to compile. I think something is wrong with my setup. Can someone give step by step information on how to setup Vim for compiling using BCC? ...

How to automatically update tag file in vim?

I use vim C++ tag file for navigation using Ctrl-]. The problem is whenever some file gets modified, the links are no longer valid and I have to re-run ctags and update the tag file. Our code base is huge and it takes quite a while for generating tag file. Is there any tool which periodically updates the tag file in background? Can I c...

difference between vi/vim

Many a times i have seen that people are discussing about the VI/VIM editor,since i use Vi editor,but for the curiosity to know the major difference between two awesome editor i have started using it .but couldn't figure out the major difference between two seems almost same. ...

regex with negative matching (ie, find string that _doesn't_ match regex)

I have a log file with the string "ERROR" on some lines. I want to delete every line that doesn't have ERROR so that I can see just what needs fixing. I was going to do something like the following in vim: %s/!(ERROR)// to replace non-error lines with an empty string. I do not believe that standard regexes can do this, but maybe I'm w...

vim getting the current value of vim foldmarker

How do you find the value of vim variables that are set with one word commands such as :set foldmarker={,} I'm writing a simple custom function for foldtext() to set a custom one line summary of the folded region it works great but looks funny when I open a documents with any fold marker other than what I've hard coded into the funct...