vi is a text editor of the Unix operating system.

learn more… | top users | synonyms

-1
votes
1answer
224 views

Cannot use vi editor

When I try to launch vi using vi or vim, it fails to start. ozzesh:~ # clear ozzesh:~ # vi ozzesh:~ # echo $? 0 ozzesh:~ # The above vi / vim command can't launch vi.
5
votes
2answers
787 views

vi/vim alternative to sublimetext's “Expand selection to scope”

Sublime text has a cool feature called "Expand selection to scope" SHIFT+CMD+SPACE which selects the everything within the scope. It select everything in scope, works perfectly ( ) or [ ] or { } ...
3
votes
2answers
131 views

vi swap file is empty

If vim crashes and leaves me with a .swp file that is empty (i.e., file size = 0), does that mean I didn't make any changes to the file during the session in which my computer crashed? If so, then is ...
3
votes
2answers
244 views

Why provide vi and vim?

I think I'm right in saying RedHat and other distributions provide both vi and Vim. Does anyone know what the rationale is behind providing both when presumably if Vim is provided it covers the ...
1
vote
1answer
119 views

Bash readline move cursor to previous forward slash

In bash , we can move back or forward by 1 word or character. Is there any option where i can move the cursor to the previous character that i specify, for example Forward Slash. ? Something like the ...
2
votes
4answers
215 views

In vim, what keystrokes (did I accidentally hit to) bring up :'<,'> and how do you set those marks?

I fumbled in vi and briefly saw this at the bottom of the screen, just as I was hitting ESC: :'<,'> Like it was ready for me to type an arbitrary ed command over a range spanned by the marks ...
1
vote
2answers
33 views

how to match string in “sk_term(” in vi

I have a sql file where I want to match the string "sk_term(" in the file when I am using :/sk_term( it giving the following error E486: Pattern not found: sk_term(
4
votes
2answers
2k views

Error location navigation in Vim Syntastic

I've got Syntastic installed in Vim and it is finding errors perfectly (mostly in Python code I'm working on). If I jump around normally in the file I see the errors in the status bar when the cursor ...
1
vote
1answer
509 views

Is it possible to launch MacVim NOT in full screen mode?

Whenever I Launch MacVim it takes up the whole screen. I don't want this. Is there any way to prevent it from happening? I run OS X 10.8.
1
vote
1answer
407 views

Vim has unexpected key presses on startup, what could be causing this?

Whenever I open a file with vim, the vim session starts with 2c having been automatically/programmatically 'pressed'. This means that if I start off trying to move down the file by pressing j, then ...
1
vote
2answers
74 views

Why am I not able to go to the next matching entry in vim by just pressing n?

vimtutor says this in lesson 4.2 : The search command In Normal mode type the / character. Notice that it and the cursor appear at the bottom of the screen as with the : command. ...
1
vote
1answer
465 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
53 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
3answers
505 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
3k 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
220 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
130 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
165 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
508 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
2k 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.
7
votes
4answers
7k 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
56 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
1k 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 ...
1
vote
1answer
3k 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
134 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
328 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
78 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
104 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
96 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
182 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
493 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
459 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
655 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
154 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
416 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
92 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" ...
3
votes
4answers
4k 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
99 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
431 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, ...
1
vote
1answer
397 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 ...
3
votes
2answers
626 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
521 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
978 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 ...
1
vote
1answer
504 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
126 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
671 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
321 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
623 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
855 views

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

I don't want to always type the word. it's annoying.