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...
Is there a way to easily create a text header in VI? I would like to create a header such as the one below without having to count characters for the purpose of centering.
# ********** a centered title **********
Any vi voodoo to be had? A better method?
...
vim's :vsp command opens a window on right. Is there a way to open it on the left side of the screen?
...
Say I have 10 lines and I want to prepend text to some word that occurs in those lines? It does not have to be at the beginning of the line.
sdfsd foo sdfsd
sfsd foo fsdf
sdfsdf foo sdfsdf
to
sdfsd bar(foo sdfsd
sfsd bar(foo fsdf
sdfsdf bar(foo sdfsdf
Is it also possible to not only prepend the "bar(" but actually su...
I would like to use spaces instead of tabs when editing Perl scripts with the native vi found on Solaris systems.
I know this can be done with the vim clone, but I don't have access to install vim on these systems as they are vendor locked.
Firstly, is there a way to configure vi to emit spaces when I press TAB?
And secondly, I am al...
I've heard a lot about Vim, both pros and cons.
It really seems you should be (as a developer) faster with Vim than with any other editor.
I'm using Vim to do some basic stuff and I'm at best 10 times less productive with Vim.
The only two things you should care about when you talk about speed (you may not care enough about them, but yo...
I am using gvim in Windows and novice to it.
I want to have a transparent background for my VI (in Windows) , like console which creates a transparent command prompt.
...
This may sound strange, but I need a better way to build python scripts than opening a file with nano/vi, change something, quit the editor, and type in python script.py, over and over again.
I need to build the script on a webserver without any gui. Any ideas how can I improve my workflow?
...
I recently started picking up vi, going through some tutorials and trying to get used to it. But I still have some questions about it.
It seems to be nice for small one file changes, but as soon as I start to try doing bigger things it seems to be lacking. For example I'm used to have code formatting, import organizing, simple overview ...
One thing that's bothered me with vi is that paste (p) inserts lines after the line I'm on, which makes it impossible for me to insert things at the top of a file.
For instance, say I'm going through and adding a UTF-8 declaration to the top of a few files:
# -*- coding: utf-8 -*-
yy and it's yanked. Good.
I switch over to another ...
Say I have multiple blocks of the following code in a file (spaces is irrelavent):
sdgfsdg dfg
dfgdfgf ddfg
dfgdfgdfg dfgfdg
How do you find/highlight all the occurrences?
What I ideally want to do is to visually select the code block and then press search to find all occurrences.
...
Is there an easy way to flip code around an equal sign in vi/vim?
Eg: I want to turn this:
value._1 = return_val.delta_clear_flags;
value._2._1 = return_val.delta_inactive_time_ts.tv_sec;
value._2._2 = return_val.delta_inactive_time_ts.tv_nsec;
value._3 = return_val.delta_inactive_distance_km;
(...)
into this:
return_val.delta_c...
When I try to search a string starting with the slash / character in vi, the cursor jumps to the next search result from the previous search. However, I'd like to find the literal slash character. How can this be done?
...
Sometimes, I want to see how many times a certain function is called in a file or a code block. How do you do that? I am using vi 7.2.
I presume you have to use !wc or some such.
Thanks
...
I'm learning vi, as I appreciate the vast possibilities of the editor, and have to use a plain-text editor for my current project. In many tutorials I have read that it is recommended to use the keys "h", "j", "k" and "l" instead of the arrow keys, for the sake of speed.
However, as a touch typist, my fingers are normally in the default...
Sometimes I work with a file that contains source code, columns, plain text, sometimes all 3. It looks great on the screen. However, when I send it to a printer, it comes out a mess: columns/tables are misalignment, code looks like a spaghetti, etc.
I use vim editor (7.2). How do I reformat the file to please the printer?
Perhaps I sh...
Ok, so I am trying to type the following in .cshrc file: alias ls 'ls --color=auto'. I type one character at a tiem.
However, when I reach --color= i type a and cursor goes to the next line.
I checked the .vimrc file and didn't fine anything out of whack. I am using vim7.2
EDIT
I noticed it is only happens in the .cshrc file, and c...
Hi,
I was wondering if this common IDE feature is available.
Suppose i open many files using VIM, using vsplit and split. Then , I close everthing.
The next day, i want to recover those files. That is, recover the way they were opened, not having to open each one (using split and vsplit) again.
Is that possible?
UPDATE:
Using :mkse...
How can two developers work on a same C++ code base such that they can work transparently ?
Is there any common indentation style for C++ code such that once it is established, the two developers can produce code with the same indentation level.
I have found Emacs very aggressive for Indentation, it tries to force its way, while Vi is...
I'm trying to change <Leader> in MacVim to be something less carpal-tunnel inducing. I have added this line
let mapleader=","
to my .gvimrc, but "\" is still the only key that works. Am I missing something?
...