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

learn more… | top users | synonyms

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
577 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
3answers
165 views

How to copy contents of a (large) vim file to the OSX system clipboard to paste in other apps?

I like to use vim to edit other (non-programming languages) stuff. So I paste the content into vim and make the changes. How can I copy all of the text back into the primary clipboard for pasting? ...
1
vote
1answer
32 views

How to search for <td>n in vim?

I can search for n with /n/ I can search for <td> with /\<td\>/ But how can I search for <td>n ? When I try /\<td\>n/ i get not found I'm trying to target the ...
1
vote
1answer
90 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
1answer
38 views

How to express “There is a specified symbol in the following unknown numbers of characters” in regex(vim)?

I have many python code examples in my markdown files, which should be prepended with >>> symbols. So I write a vim function to do this job: function AddShellPrompt() range let lnum = ...
2
votes
0answers
17 views

Why in “:normal”command ^[ seems doesn't work with A? (vim)

Today, I learnt a bit of vim normal command, and below is my experiment: :normal i Insert ^[ yyp :normal A Append ^[ yyp # RESULT OF EXECUTE FIRST COMMAND FOR SEVERAL TIMES Insert Insert ...
2
votes
1answer
49 views

Vim pausing randomly for a minute or so at a time

I'm running Linux Mint Maya 13.2 on a laptop from a USB stick, and SSHing onto that install from my own work computer. When i'm editing a file with Vim, i keep getting a pause of about a minute where ...
2
votes
1answer
76 views

Vim cursor highlights wrong position

I'm having some weird vim cursor behavior which I'm unable to solve. While I was editing a file, suddenly the cursor marker moved one or more spaces to the right while the cursor actions still ...
0
votes
1answer
29 views

Is it able to echo parallel negative numbers in vim?

In h vim-script-intro. It says - will be interpreter as minus or negative depends on the situation. Thus echo -1 1 will result -1 1, and echo -1 -1 will result -2. Drove by my curiosity, I tried ...
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
3answers
143 views

Copy vim selected text to system clipboard

My vim is not compiled with clipboard feature. So, i use xsel as suggested by Gilles to copy/paste the contents. I use :.w !xsel -b for selecting the current line and, :w !xsel -b to select the ...
2
votes
1answer
48 views

Strange characters after pressing numeric keyboards in VIM editor

I'm running VIM under GNU screen. When I'm in insert mode and press e.g. asterisk symbol on numeric keyboard, instead of asterisk I get <F3>, when I press e.g. 4 I get t followed by newline. My ...
2
votes
3answers
312 views

Trailing spaces when copying from console

It's this annoying behavior I've been experiencing here and there occasionally: when you select text with mouse in console (that is, copy it), paste it, and realize you've got extra spaces at the end ...
1
vote
1answer
49 views

Write before the cursor

In Vim, I have a #write after cursor A #write after end line I #write at start of line I want to write before a word, for example I want to edit this line My cursor is at the position after ...
0
votes
1answer
51 views

Python feature disabled vim-nox

I have installed vim-nox version 7.4 package in my Debian Wheezy machine from backports. I am confused that the python feature still does not work as shown from vim --version command as -python as ...
2
votes
1answer
72 views

How to insert named register from vim commandline

Using vim I have some troubles inserting the value of a specific register using commandline mode. When in normal mode I can enter the sequence "*p which will put the value of register "* beneath the ...
0
votes
0answers
30 views

writefile() to file descriptor produces output with alignment issue

The command that produces weird output: $ vim -ec 'call writefile(["line1","line2"],"/proc/self/fd/9") | qall!' 9>&1 1>/dev/null 2>&1 line1 line2 $ Same command ...
3
votes
1answer
131 views

How to get clipboard support on a Linux server without X11

I have a virtual Linux development environment running under VirtualBox and Vagrant. I use tmux and vim to setup multiple open vim instances. I'd like to be able to copy and paste between those ...
0
votes
0answers
26 views

Weird UI glitching in VIM adjusting split bar

i just installed gvim on linux mint and I'm experiencing some weird UI glitch when adjusting the split bar and it also seems to happen when making changes to files in the editor. I have similar ...
4
votes
2answers
34 views

Edit columnar data in vim

Data Name Age Madhavan 29 saravana<Tab Press> ! How can i edit this data in vim in a tabular fashion? When i press tab key from column 1 in row 3, ...
0
votes
3answers
119 views

Restore a screen session after shutdown

Not concerned with conventional attaching and detaching, I'm talking about restoring a screen session after shutting down my system entirely. I usually have changed to various directories depending ...
-2
votes
1answer
98 views

ls: No such file or directory [closed]

I have been messing around trying to install macvim to a higher version of 7.4. I finally got it working but now I get the error ls: No such file or directory when looking for a directory. I can ...
2
votes
1answer
115 views

Editing multiple files simultaneously with vim/gedit

I'm trying to save some work by editing multiple files with the same name located in different directories: $ mkdir -p directory_{0..10}/results How may I create files with the same name in all ...
0
votes
1answer
32 views

Wrap all lines with character sequence in vim

So basically I copy/pasted some code, and I need to prepend and append some more code to each line. Each line is a function call, and is getting added to a switch statement as it's own case. Right ...
3
votes
1answer
44 views

Is there a FileType name for files without suffix in vim?

With my current knowledge, I can use commands such as autocmd FileType markdown colorscheme zen to set a colorscheme for a particular type of file. I have a need to use a colorscheme for all those ...
1
vote
0answers
57 views

How may I reset a buffer index on Vim?

I'm using MiniBufExpl to manage buffers. In my workflow, I usually work on one thing at a time. I'm opening some files, coding, enjoying. Then, I want to clear my workspace to start with new ...
1
vote
2answers
81 views

Extract lines from a file using vim or teminal

I have the following in a file. I'd like to use Vim or terminal to extract title and its content like this. How can I achieve this? Topic 1 - Core: Algebra 1.1 Arithmetic sequences and series; sum ...
2
votes
1answer
102 views

Delete from a character above current cursor until cursor position?

Say I have: void SomeFunc () { //stuff } If my cursor is where the { is, how can I "delete up to )" ? In other words, how can I get : void SomeFunc (){ //stuff }
1
vote
1answer
24 views

vim: Automate context-sensitive parenthesis replacement with surround.vim

I am using vim with the surround.vim plugin and want to replace all occurrence of sin(...) with sin[...] in a (very long) mathematical expression (containing matching parenthesis). Example input: ...
0
votes
0answers
6 views

redirect help info to vim [duplicate]

I use this kind of commands to redirect help info to vim, for example: man ls | col -b | vim -R - but for some help info highlighted with color: celery -h there is a mess in it. How to make it ...
0
votes
0answers
11 views

Synchronize strings copied on vim with the xserver clipboard [duplicate]

How to copy a string in vim under terminal and get it available in the main clipboard? Seems that by default, is not possible to copy from vim to my browser, for example
3
votes
1answer
197 views

terminal color theory

TLDR: What is the theory behind terminal colors? I have a fixed value of LS_COLORS in numbers: ...
17
votes
2answers
360 views

How do I save the changes to my vim buffer as a patch file?

Is there a way to save the changes I made to my vim buffer as a patch file for the original file, without saving it as a separate file and using diff?
1
vote
2answers
26 views

Cursor points to bottom when a zip file is opened with vim

I am trying to open a .zip file via vim. By default the cursor points to the bottom of the file once it opens. How can I bring the cursor to the beginning of the file as soon as I open a zip file? ...
5
votes
0answers
215 views

mutt: how to display emoji characters correctly?

I'd like to be able to see emoji characters properly in mutt, but e.g. 💗 shows up as ^J in mutt's pager. Running :set pager=view and re-opening the message displays the character correctly with ...
2
votes
2answers
68 views

Insert “return 0” between all braces in a file?

I'm setting up a fairly large (~50 functions) test library in C++. I forgot that the functions have to return integers. I actually forgot to put a return type at all, how dumb is that? I added the int ...
1
vote
1answer
537 views

How do you downgrade multiple packages in arch linux?

I am trying to downgrade the vim package on arch linux to an earlier version (as I need to use an earlier version of ruby which breaks it [ref]). running downgrade vim and selecting the version ...
0
votes
0answers
35 views

Vi help problem with / in command mode

Hope someone can guide me in the right direction. I have an issue with the vi text editor, when in command mode after I enter ":" and want to use "/", the forward slash does not come up. What I get is ...
1
vote
1answer
34 views

Pasting with vim squeezes content in between previous content and margin

I'm learning my way around the vim and got around to copy-paste. Or yank-paste. Now when I try to paste a yanked piece of text, it pushes previous content to the right and squeezes in on the left. I ...
1
vote
0answers
201 views

Installing a light vim colorscheme on gnome-terminal

I'd like to install a light color scheme for my vim, but it never seems to work (I tried several now). What I'm trying to obtain is something like you can see in this screenshot of mayansmoke: ...
2
votes
2answers
209 views

How to use vim-slime from within a single tmux session?

I'm trying to integrate ipython and vim through a single tmux session using the popular vim plugin "vim-slime." The problem is that while I can get it to work fine provided that vim is opened in a ...
2
votes
1answer
454 views

How to clear search and command history in Vim?

If you search something in Vim by prepending searchterm with a forward slash, e.g. /searchterm, Vim puts that searchterm into the search string history table. You then are able to navigate through ...
-1
votes
2answers
56 views

Vim,how to escape &?

Simply question,i want to search & as exact word,how to do in vim? I had try \& and \<&> but doesn't work
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 ...
0
votes
1answer
33 views

Vim - inconsistency between :tabnext N and :tabprev N

From Vim's :help tabs: :tabp[revious] {count} :tabN[ext] {count} {count}<C-PageUp> {count}gT Go {count} tab pages back. Wraps around from the first one to the last one. While ...
0
votes
1answer
22 views

Create parameterized keybindings

I'd like to map +Ngt and -Ngt to :tabnext N and :tabprev N. I can create key bindings such as: nnoremap <buffer> <silent> +1gt :tabnext 1 nnoremap <buffer> <silent> +2gt ...
6
votes
1answer
110 views

How can I make `sudo crontab -e` use my `sudoedit` environment?

I've started using sudoedit <file> instead of sudo vim <file>. One of the advantages is that it uses my local ~/.vimrc. However, when using sudo crontab -e, it uses /root/.vimrc instead. ...
0
votes
1answer
290 views

How can I expand directories by default in Vim's netrw tree view?

I can make netrw use the tree view by default by adding this to my vimrc: let g:netrw_liststyle=3 But I can't figure out how to expand sub-directories by default, is there a way?
1
vote
1answer
85 views

Cannot get vim to recognize unicode

I am having the most trouble ever getting vim to recognize unicode. At the top of my vimrc I have set encoding=utf-8 set fileencoding=utf-8 and LANG shows echo $LANG en_US.UTF-8 but when I open ...