vi is a text editor of the Unix operating system.

learn more… | top users | synonyms

1
vote
1answer
299 views

Vim: edit multiple lines

I was looking for a way to edit multiple line simultaneously. I found that Ctrl-V + selecting the lines + I should be the solution. The problem is that, for me, after pressing I (in fact Shift-i) I'm ...
0
votes
2answers
52 views

In vi, how can I navigate to the function declaration?

In Vi, if I am in the middle of a function, how can I navigate back to the function declaration?
5
votes
2answers
373 views

Edit text areas using vi key bindings, inside the textbox, in Firefox (without opening a separate window)

I'm using Firefox. Is there any way to edit the contents of a textbox using vi key bindings, inside the text area (not in a separate window)? For instance, is there a Firefox extension for that? I ...
0
votes
3answers
2k views

What is the keyboard shortcut to go to the end of the file in vi?

I'm using putty to view a 30+MB file in vi on a Linux server, and I have to use PgDn to scroll to the bottom of the page. I realize I can use tail but I want to be able to move up and down the file ...
1
vote
2answers
165 views

need to get rid of strange symbols in text

I need to process the following text to get rid of the strange symbols such as: â<80><99> â<80><9c> â<80>? Example text: With the mystery unexplained, the Hyatt ...
4
votes
2answers
109 views

Escape not idempotent in zsh's vi emulation?

I have zsh configured to use vi keybindings. I've noticed some unexpected behavior with "escape". In vim (I haven't tested vanilla vi) if I hit escape twice, I can hit 'i' once to return to insert ...
2
votes
2answers
157 views

In Vim, what are the differences between using :sus and :sh to access the shell without ending the Vim session?

I know that, while in Vim (and Vi, too, I think), if I want to temporarily access the shell I can do one of several things: Use :sh (a.k.a. :shell), then log out from the shell to return to Vim Use ...
2
votes
2answers
419 views

How can I remap CAPSLOCK key to ESC in Cygwin?

How can I remap the Capslock key to ESC in a Windows Cygwin shell? Ideally I would only remap the value in Cygwin shells instead of everywhere, preserving behavior in other apps (although admittedly ...
2
votes
3answers
1k views

Vim is not reading gzipped files automatically

I want to see some zipped log files .gz in unix through putty. When I open them in vim the contents are not readable. I think vim is not able to unzip them.
5
votes
4answers
4k views

How to get vim color mode to work in vim under cygwin

I have installed vim 7.3 under cygwin. And I have this in my ~/.vimrc $ cat .vimrc colorscheme wombat And then I have this file wombat.vim under '.vim/colors'. $ ls -la .vim/colors/ total 8.0K ...
0
votes
1answer
52 views

How to add a shell output content to vim?

When using vim, we can use :!ls to execute shell command, but how can we import the ls output into vim for editing?
1
vote
2answers
745 views

Copy visual mode selection below selection in vi

In vim, I often find myself repeating the same steps to copy a section before making changes to it: V to start Visual mode linewise j until I have selected the section I want to copy y to yank the ...
0
votes
1answer
2k views

Why does VIM say there are trailing characters on this command?

I am trying to write a beautify CSS command in vim that sorts and alphabetizes all of the CSS properties as well as checks to see if there is not a space after the colon and inserts one. Here is my ...
0
votes
3answers
120 views

how do i turn a whole file into uppercase?

I have a file on a server on another campus that's all in lowercase that i need to changed to all uppercase. Is there any simple unix command that will do this? [i'm using PuTTy on a PC if that makes ...
0
votes
1answer
46 views

When I try to change mode in VI it prompts ^[ char

I am using FreeBsd 9 and I need to use Vi. My problem related with the changing mode (command to insert or insert to command) in VI. I know that I need to use ESC key to change mode. But in Insert ...
6
votes
2answers
250 views

Is it possible to control the whole Gnome desktop with vi-like commands?

I know with readline you can use emacs or vi commands to edit the input of several interactive text programs. I wonder if there exists such a similar facility to control the whole desktop in Gnome or ...
2
votes
1answer
75 views

Is there a single key in vim that both cancels the command I've just entered and takes me back to normal mode?

Because I'm still learning vim, I quite often find myself mistakenly entering the wrong command (for example, let's say I entered ci{, when I meant ca{). When I do this, vi enters insert mode and (in ...
1
vote
1answer
87 views

“autocmd FileType” doesn't work the same way in Mac and Linux

Here is a small vimrc snippet that I was trying to use on my Mac function SetCommonDefaults() " Set line numbers set nu endfunction autocmd FileType cpp call SetCommonDefaults() What I expect ...
0
votes
1answer
90 views

How can I switch vim mode quickly?

This question is not the same as In vim, how can I quickly switch between tabs?, but what I want is a bit similar to it, since we are all trying to find shortcuts when editing with vim:) Now I am in ...
2
votes
1answer
146 views

vi insert text for specific line ranges

Seeking help in vi editor. I want to insert in the begin of line. I wanted it to be insserted for specific line ranges. for eg, line number 1 to line number 20. Any idea
2
votes
4answers
409 views

Syntax highlighting in vi

I use vi in Linux to edit e.g. JSP files. The code is not syntax highlighted. I think this should be possible to enable, but I haven't found out how. Is this possible to do in vi? update1: # vi ...
1
vote
0answers
356 views

bash vi key bindings: Can I map keys? Display mode (insert vs command)?

I am a long time vi(m) user and recently made the switch to using vi key binding in bash. I can already tell that this will be an improvement, but I would like to customize a few things to really ...
2
votes
1answer
456 views

VIM: how to select a line, up to the cursor, including the char under the cursor?

From normal mode I select what's before the cursor with: v<Home> Is adding to the selection what's under the cursor possible? Thanks!!
4
votes
1answer
138 views

Abort a vim paste

Sometimes I paste a lot of data into vim (>5000 rows) and forget to enable paste mode. In that case, vim is busy for several minutes, trying to correctly indent all the text (which gets REALLY bad ...
1
vote
2answers
334 views

How to get vim to retain cursor position when opening a split

When I open a vertical split in vim, it takes my current line and bumps it to the top of the buffer (scrolling the entire file up). How do I get vim to retain its current position?
0
votes
1answer
90 views

Using regular expressions in vi

When I write a blog entry in Google blogger then a lot of entries like shown as below are getting inserted in HTML (not sure why). <span id="textmarked_8" name="textmarker_9" ...
2
votes
3answers
641 views

vi editor text is flashing and unusable

I'm using vi on linux - vi --version gives: VIM - Vi IMproved 7.2 (2008 Aug 9, compiled Apr 16 2010 12:47:47) A few weeks ago, for no apparent reason, every time I use vi the entire text is flashing, ...
2
votes
4answers
3k views

Always use :set paste, Is it a good idea?

In a terminal vim, pasting clipboard data often messes up the code indent. I just knew if I uses :set paste the indent is not broken. Though, after pasting data, should I do :set nopaste again? What ...
0
votes
3answers
92 views

Insert text with vi editor

I was using nano before. I'm a bit confused on how to start inserting text, sometimes I just start typing and on the bottom I see -- insert -- and I can edit and save fine. But sometimes I just skip ...
0
votes
1answer
393 views

Replace text with text from another file in a script?

I want to replace 5 rows of text in a file with the text of another file in my script, I know that running vim I can do :45,50d :r replacement.txt to delete 5 rows and then insert the entire file, ...
0
votes
1answer
313 views

How do I type numbers in vi?

Sometimes when I have to do basic editing of a file or write a basic script when I'm working in Terminal, I use vi. The problem is that when I type numbers, it goes to that line. Is there a way to ...
2
votes
2answers
523 views

Exclude dash (-) from word separators in vi

vi uses dash and space as word separators. is there any way to exclude dash from word separators ? This is required to work with the symbols generated by ctags exe. when symbol contain a "-" ,vi tags ...
0
votes
1answer
465 views

Remap shift-tab to tab in bash/screen/putty in Linux?

Well I use vi-mode in bash via the set -o vi command. What's annoying is when I'm typing words in capital then try to complete using tab but don't release the shift-key fast enough, it brings me out ...
1
vote
4answers
829 views

How do I edit a file currently being used by vi?

I am new to Linux and trying out Ubuntu 11.10. I am setting up a SSH server and one of the instructions asks me to edit sshd_config file using vi. In vi, I can't remember what happen (it's all a ...
0
votes
1answer
389 views

Copy vertical text block in Vim on Mac

How do I copy a vertical text block in vim on a Mac? On a PC on would just do ctrl-c at starting point and ctrl-c at the end point and it would copy between these two coordinates. How do I do that on ...
0
votes
1answer
122 views

vi substitution matching

I am able to pattern match a regex in vi, but when I add the replacement string, vi thinks that is part of the regex match. This occurs despite use of various different delimiters. Is there some way ...
0
votes
2answers
557 views

VI make every first letter that comes after a underscore uppercase

Found this site: http://unix.t-a-y-l-o-r.com/VMswitch.html And it works for the first character but my lines are line this this_is_a_string And I would like this This_Is_A_String Any ...
0
votes
1answer
295 views

iTerm2 Terminal Too Wide Error

I am using iTerm2 to ssh to various servers. When i use VI to edit a file i get an error that reads 'Terminal Too Wide.' To fix this I use the following command 'stty columns 120.' Is there a ...
0
votes
2answers
470 views

How to make VI use spaces instead of tab even when I press backspace key?

When I tried to use yml, it requires NO TAB, ONLY SPACE policy. I realized I need a special setting for this. Anyway, I can't live without tabs. So I want to make my VI behave like this. When I ...
4
votes
5answers
683 views

In Vi, how do I map “:t” equal to “:tabnew”?

I don't want to always type the word. it's annoying.
7
votes
2answers
389 views

Readline in vi mode: how can I enable up/down arrows?

When bash has vi bindings available (set -o vi), up/down arrows work in both command and insertion mode. When I setup readline's ~/.inputrc to use vi mode (set editing-mode vi), applications like ...
10
votes
2answers
106 views

vi / vim abrumpt buffer movements within window

When using :set wrap in vi/vim, the contents of an entire wrapped line are placed in the display buffer upon moving the cursor into a new line, even when navigating through a file by display line ...
2
votes
1answer
1k views

how to block select, move, copy, paste in vi?

I am trying to migrate from Notepad++ to vi. In N++, I constantly rely on block edit (or "column mode"), as it is a great increase in productivity: I can select a rectangular area of text by pressing ...
4
votes
2answers
751 views

Whats the difference between vi editor in Red Hat linux and Ubuntu?

I realize a difference in vi editor of ReD Hat and Ubuntu. In my company, I'm working in Red Hat. In that, the vi editing commands working as usual. Say, 'dd' to delete,'p' to paste, 'yy' to yank, ...
0
votes
1answer
442 views

Mac OS X. Vi - E185 cannot find color scheme

Editing with vi in terminal gives the following error. E185: Cannot find color scheme metacosm. I think the problem is not im my .vimrc (no strange carrage returns). I strongly suspect this problem ...
4
votes
1answer
5k views

Vi on Linux: show ^M line endings for DOS-format files

On Solaris, if you open a file in vi that has Windows line endings, this shows up as ^M at the end of every line. On Linux, vi is cleverer and understands the Windows file format, and does not ...
0
votes
2answers
739 views

mingw/msys with vi, ctags support?

I'm trying to run vim on win7 inside msys (which isnt entirely necessary, i know i can run gvim in windows, but i'd like to be able to use vi inside terminal) everything installs fine with mingw-get ...
11
votes
1answer
3k views

How to switch comfortably to vi command mode on the zsh command line?

In vi, I have mapped 'jj' to escape to be able to switch to command mode without using the annoying escape key. Now I want to have the same for command line editing for which I use vi-mode. I already ...
2
votes
2answers
149 views

Can I display emacs buffer modification history?

I've used vi for decades, but I'm trying to improve my emacs skills. In vi, I often check the status of my buffer by issuing this command: :w !diff - % Is there a command in emacs that I can use ...
5
votes
8answers
382 views

vi / vim tutorial recommendations

Being a common tool for *nix System Administrators, I'm looking for recommendations for vi/vim tutorials. After seeing this 'how do I do [this] in vim' question in Stack Overflow, I realize that I ...