vim (Vi IMproved) is a text editor supporting different editing modes.

learn more… | top users | synonyms

0
votes
0answers
26 views

Nano: Rember cursor position at start

Can Nano save the current position of the cursor at exit and, when you reopen the file, restore the old cursor position, like vim does?
2
votes
2answers
55 views

Vim: copy from file to clipboard [duplicate]

I ask a simple question: how to copy from a text file using vim,and paste to clipboard? If i use yY I can paste,but only on vim file(using p),on clipboard i can't paste content. If i use "+Y paste ...
2
votes
0answers
112 views

tmux causing bold fonts in vim

I have installed tmux with vim, using the solarized colorscheme and airline plugin. All is good until I start tmux, where all the font turns bold and the airline status bar is looking weird. I have ...
15
votes
4answers
2k views

How do I insert the current filename into the contents in Vim?

After some searching, I got to know :echo @% displays the current filename in the bottom line of vim-screen. I would like to dump the filename (with and without full path) into the contents of the ...
0
votes
1answer
15 views

Is there another brief way to detect if an item is in a vim list other than `index(L, item)`?

In python, there is a syntax i in L to detect if a value is in a list. Is there a similar syntax in vim other than index() function?
2
votes
1answer
34 views

vim how to unabbreviate

I have abbreviated main to '#include.....', I was looking to unabbreviate it for one vim session, and tried the following :una main I get error 'E24: No such abbreviation'. The problem is, it's ...
2
votes
0answers
39 views

System clipboard is flushed out, once I exit vim

I use yy to access the system clipboard always. yy is mapped to a function as, function! Copy_ToSystemClip() .w !xsel -ob end function inoremap yy Copy_ToSystemClip()<CR> It copies to the ...
1
vote
1answer
582 views

How can I compile a C program that I've edited in Vi or Vim?

I'm trying to compile and run a c project from vim and vi #include<stdio.h> int main(void) { printf("Hello! This is a test prgoram.\n"); return 0; } and I get this output ...
1
vote
1answer
93 views

vim issue with tab/space in multi-line abbreviations in vimrc

i am trying to write a vim abbreviation to create a template program in c I have given the abbreviation as below in the .vimrc abbr main #include<stdio.h> \^M#include<string.h> ...
1
vote
0answers
22 views

How to save/reload split windows in vim?

How do I get the same split-settings back if I exited vim with :qa?
2
votes
1answer
35 views

Setting up a secondary Vim environment

I've setup the YADR dotfile repo on one of my machines, and find it very powerful/useful. Though it's definitely slower than my present Vim setup with all its plugins, I'd still like to be able to ...
15
votes
8answers
3k views

Open a file given by the result of a command in vim

I find myself doing the following almost every day Run a find (find -name somefile.txt) Open the result in vim The problem is I have to copy and paste the result of the find into the vim command. ...
59
votes
6answers
51k views

vim - better colors so comments aren't dark blue?

Mostly I edit ruby files, although shell script file comments are also # Currently my comments show as dark blue on black which is really hard to read. See screenshot. How can I change their color? ...
0
votes
1answer
49 views

executable bit on files created by vim

Is there any setting for vim create new files with full permissions? that is falling just under the umask restrictions, and only on files created by vim. It shouldn't modify the bits of an already ...
1
vote
3answers
1k views

“E488:Trailing Characters” error in Vim after typing :<F7>

I have written the following in vimrc.vim :filetype plugin on :let s:save_cpo = &cpo :set cpo&vim :let &cpo = s:save_cpo :set runtimepath = ~/home/nikcha/.vim/plugin :set fileformat = ...
1
vote
1answer
54 views

Vim how to reset the screen before editing?

On Linux, if I do a command with long output, for example dmesg and then edit a file with vim the screen is like after reset command. On HP-UX, if I do a command with long output, for example dmesg ...
1
vote
1answer
43 views

vim: multiple substitutions like sed

Simply question,with sed is possible to do a multiple substitution sed -e s/uno/due/ -e s/uno/due/ Is possible something similar with VIM internal substitution? :'<,'>s/445/53/a/444/53/g ...
4
votes
1answer
1k views

ls and vim color on SunOS 5.8/Solaris 8

I want to use ls and vim with color on Sunos 5.8 SunOS 5.8 Generic_117350-11 sun4u sparc SUNW,Sun-Blade-2500 I have installed ls (GNU coreutils) 6.9 and vim 7.2 In ~/.cshrc: setenv TERM sun-color ...
14
votes
2answers
4k views

Make sed ask for confirmation before each replacement?

Is there a way to make sed ask me for confirmation before each replace? Something similar to 'c' when using replace inside vim. Does sed do this at all?
0
votes
0answers
11 views

Periodic problems with openssl.vim with correct password

For those who doesn't know, there is a great script for vim that allows to store encrypted by openssl passwords using vim to acceses and edit them. About a year ago I've started to observe problems: ...
10
votes
2answers
2k views

screen + vim — Any way to automatically set screen window name to open vim filename?

I have a pretty nice screen rc file that shows me the open screen windows almost like tabs at the bottom of the terminal. Currently the windows are named according to my prompt which is not so useful. ...
12
votes
2answers
785 views

vim: use string from search in replace command

I often use vim / search command to verify my regular expressions (just to see what it matches). After that i usually use the :%s replace command, where i use that regexp from search as a string to be ...
20
votes
7answers
16k views

Are cygwin vim commands different than normal vim?

I am unable to edit text files using vim in cygwin. I have to press i many times to insert text. Sometimes it works and sometimes doesn't. Whenever I move cursor up down I have to press I many times. ...
2
votes
2answers
80 views

How to replace each occurrence of a string with an incrementing counter in vim?

I have 203 instances of the word ubuntu in a file, and I want to replace each one with UBUNTU_X, where "X" is an incrementing counter. In other words, the original file is: ubuntu xxxxxxxx ubuntu ...
0
votes
3answers
58 views

VIM: What's the quickest way to return from typing :w<enter> in insert mode?

Sometimes I forgot to press ESC to return to command mode and enter :w<enter> in some line I was editing. So I get the following: some line of code:w I was typing ^ cursor position So ...
2
votes
2answers
187 views

How to effectively add a file to the args list for vim from within vim?

Really I just have a confusion between a few terms, some of which may be synonymous: buffers tabs files windows I want to understand these terms fully and any pointers in that direction would be ...
0
votes
2answers
59 views

Adjust pane size in vim

I know I can use :sp or :vsp to open files in vim in splitted panes. But how can I increase/decrease the size of each pane?
1
vote
1answer
164 views

How can I enable mouse in Vim?

How can I use mouse with panes in vim? I tried :set mouse=a but it does not seem to work when doing :sp or :vsp or vim -O
28
votes
6answers
5k views

How to yank a particular line without moving the cursor in vim?

For example How can I yank and paste Line 4 only to Line 12 without having to move the cursor to Line 4?
1
vote
2answers
42 views

Moving by page without chords in Vim

Often I want to skim through a document or piece of code, which I do with page down (Ctrl-D) and page up (Ctrl-U), but it feels like I am violating the spirit of Vim using emacs-like chords/control ...
3
votes
3answers
4k views

In Vim, how can I delete all text from the current cursor position until the next space?

In Vim, I know d$, that deletes everything to the end of line. But how can I delete all text from the current cursor position until the next space? dw doesn't work, since it treats symbols like colon ...
0
votes
2answers
60 views

Vim capitalize only first letter of first word

On Vim i have this txt file stringa1 minuscolo stringa2 minuscolo stringa33 minuscolo stringa44 minuscolo I want become Stringa1 minuscolo Stringa2 minuscolo Stringa33 minuscolo How to do in ...
4
votes
2answers
29 views

Interactive, tabbed live tail of multiple files?

I'm often tailing multiple files, and even with a terminal multiplexer (ie tmux or screen) it's still annoying to have multiple windows/shell sessions dedicated to watching multiple files. Is there ...
3
votes
1answer
44 views

Vim - navigate between paragraphs (by blank lines)

Are there built-in commands in VIM that navigate to the next/previous blank lines?
0
votes
1answer
278 views

Trying to use portsnap to install vim in FreeNAS

I am trying to install vim in FreeNAS but when I try to use portsnap, I get "command not found". When I tried using pck_add -r portmaster I get the following: pkg_add -r portmaster Error: Unable ...
3
votes
2answers
500 views

Vim - Bind a key to a bash command

In VIM, is there a way to bind a key to a shell command? For example when F3 is pressed git commit -a -m "test" should be executed.
0
votes
1answer
39 views

How to change the word to be inclined in vim? [closed]

Is it possible to write a word in italic format in Vim?
1
vote
1answer
66 views

Why is vi (but not cat) showing ^[[31m[^[[m^[[31m" after I use sed and output to a file I then edit? [closed]

When I use cat Variables/user-extensions.js | sed -e 's/css/XXX/' on an input file of the form storedVars["css_body"] = "css=body"; storedVars["css_main"] = "css=main"; I see output such as ...
1
vote
1answer
33 views

Different behavior of `vim -R` and `view`

Manual page on vim ($ man vim) states: view Start in read-only mode. You will be protected from writing the files. Can also be done with the "-R" argument. But, they have major ...
3
votes
0answers
162 views

ViM and Python says the encoding is ANSI_X3.4-1968

In ViM, the following command (using Python 3.4.3) outputs ANSI_X3.4-1968: :!python -c "import sys; print(sys.stdout.encoding)" However, I want UTF-8 everywhere. In .vimrc, I do have set ...
9
votes
6answers
10k views

Copy-paste for vim is not working when mouse (:set mouse=a) is on?

I was trying to copy paste something from vim to another application and also, from that application to vim using right click with mouse and then copy and paste (or with Ctrl+v and Ctrl+c and also ...
42
votes
7answers
51k views

Vi vs vim, or, is there any reason why I would ever want to use vi?

I know a bit about *NIX text editors (currently migrating from nano to vim), and, after looking around a bit on the Unix & Linux SE, have noticed that vi is used instead of 'vim' in a fair number ...
10
votes
3answers
2k views

Match word containing characters beyond a-zA-Z

To match a word one can use \v(\w+) From the vim help :h \w: \w word character: [0-9A-Za-z_] This works exactly as described in the manual. However, I want to match words that contain ...
1
vote
1answer
102 views

VIM function for creating new a file with a header including the filename and a timestamp

I have created a VIM function that generates a new file based on the arguments passed to it and on some zsh variables I have setup. Is it possible to extend this function to insert a header into this ...
1
vote
1answer
60 views

How to change default vim colon commands?

I know how to remap keys in .vimrc, but that's not what I want to do. I want to change a colon command; specifically, I want to change or remove :X (that's a capital "X"). I always type it when I'm ...
27
votes
8answers
9k views

Advantages of using set -o vi

I have seen many developers using this command to set the option to vi. I never understood the real use of this? When using bash commands, what help does switching to vi provide?
3
votes
2answers
214 views

What does the '!' really do when it's added to an ex command (:wq! | :w! | :q! )?

I understand that it means force to do something. When doing $ vim -R file I enter in read-only mode, but this works as preventive mode only -R Radonly mode. The 'readonly' option will be set for ...
6
votes
1answer
5k views

Why is vim creating files with DOS line endings?

I have set fileformat=unix in my .vimrc, and yet if I create a file in vim (running in Cygwin) it persists in creating DOS-format files, and I have to run them through dos2unix to clean them. (I ...
0
votes
0answers
38 views

Change colors of statusline in haskell-vim-now

I am using haskell-vim-now, which has many features I like when editing Haskell. However, it also sets a colorscheme I do not like. In my ~/.vimrc.local I already resetted to the default colorscheme. ...
2
votes
2answers
566 views

What is the difference between vim and vim-lite?

I want to install vim on my FreeBSD machine, and this other site suggests installing from FreeBSD ports like this: # cd /usr/ports/editors/vim-lite/ # make install clean This is all great, and I ...