The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Hot answers tagged

26

So, installing vim-enhanced and vim-X11 is enough, but is not at the same time. To enable the system funtcions like +clipboard, you moreover need to use the vimx executable rather than vim or vi (even though they are probably identical, the name changes the behaviour). One way how to do that permanently is by adding aliases in your .bashrc file: alias vi='...


23

The package description contains This package contains a version of vim compiled with a rather standard set of features. This package does not provide a GUI version of Vim. See the other vim-* packages if you need more (or less). I believe this was made, because using the clipboard would involve linking against X libraries, which means, you ...


17

I'm the current Vim maintainer for Debian and the person quoted in the referenced mailing list discussion. As you stated, this isn't a question about Vim. It's about building the software that Vim links against in a way that meets your needs. There's a more thorough discussion (at least for the Debian aspect) of the issue in a bug requesting Python3 to be ...


16

Didn't expect this to be possible, but there is actually an option for this. 'linespace': 'linespace' 'lsp' Number of pixel lines inserted between characters. Useful if the font uses the full character cell height, making lines touch each other. When non-zero there is room for underlining. With some fonts there can be too much room between ...


15

Vim started as a clone of vi and has almost all of the commands and features of the original vi, plus a lot of enhancements. (See :help design-compatible.) It can be compiled into one of basically five configurations: tiny, small, normal, big and huge. (See :help :version.) It can also be configured at run time to disable the extended features and use only ...


14

By default VIM, when terminating, sends the string configured with the option t_te to the hosting terminal to tell it to clear the screen. To avoid it just :set t_te= to send nothing to the terminal and avoid screen clearing. See :help term form more information about terminal capabilities.


14

Ok. Apparently on native vim in Arch there is no support for X so the +clipboard feature is missing. To fix this, install gvim, which although conflicts with vim, which was my initial problem with it, retains the exact same functionality if you use vim Rather than, gvim You still need to set clipboard=unnamed.


11

Since you're on Ubuntu, use the file command: $ file -L "$(command -v vim)" /usr/bin/vim.gnome: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=acb723f1249782755116f93ed45a30e7115ff423, stripped As you can see, my vim is 64-bit. We need to use -L since /usr/bin/vim on ...


11

Well, you can combine the "backward search" motion and the delete operator: d?$<Enter>


10

The loss of kprinter in the move to kde4 was one of the reasons I stuck with kde3 for as long as I could. After some searching, I found this "3rd party" replacement: http://kde-apps.org/content/show.php/KPrinter4?content=163537, https://github.com/credativ/kprinter4. It looks like you have to compile it yourself (Its not included in distros since it isn't ...


10

You can use autocommands to run things automatically when certain events occur. In your case, you could do this: autocmd BufWritePost *.less !less <afile> This autocommand runs every time a buffer with a name that ends in .less is written. The command that is being run is a bash command, and <afile> is the name of the file that is being ...


10

The SpellBad highlighting group should allow you to configure the appearance of misspelled words. Let's say you want them to be red on yellow background. Then you could add the following code somewhere in your vimrc file or in your colorscheme file (but in any case after the colorscheme has set up the SpellBad group, otherwise it would override your ...


9

Try d0kJx Deletes backwards to the beginning of the line, moves up, then joins the two lines and then removes the space in between the two joined lines. You don't have to leave normal mode with this.


9

Reading system-level configuration before user-level configuration is totally normal and expected in UNIX land. Anyway, this sentence: The files are searched in the order specified above and only the first one that is found is read. only applies to "personal initializations". As explained a few paragraphs below, the system vimrc is read no matter what: ...


8

Since you're on Ubuntu, verify if Vim is installed by running dpkg -l | grep vim Check the available alternatives to Vi by running update-alternatives --list vi Set your favorite alternative to Vi by running update-alternatives --config vi


8

You can check if Vim is built with clipboard support with: :echo has('clipboard') If the output is 1, the following should be enough to achieve your goal: "*y in source Vim "*p in destination Vim You can make it all a lot more seamless by synchronizing the clipboard register and the default register with this setting in your vimrc: set clipboard^=...


8

That line: n indent on means "open the file called indent that is at the root of the working directory". Basically, you tell Vim to do something silly and… it does just that. It should be: filetype plugin indent on Be more careful about what you copy and paste.


8

I was able to fix it myself by providing jedi-vim with the location of the packages in my anaconda folder using the $PYTHONPATH variable as follows: export PYTHONPATH=$PYTHONPATH:/home/user1/anaconda3/lib/python3.5/site-packages Thanks to all! Or Add following line in ~/.bash_profile export PYTHONPATH=$PYTHONPATH:/home/user1/anaconda3/lib/python3.5/site-...


8

The problem is probably that you don't have the Consolas font installed and that Vim defaults to an ugly default font. Try using a different font, for example this should work on most Linux systems: set guifont=Dejavu\ Sans\ Mono\ 12 If you want it to work on both Windows and Linux you can use something like: if has('gui_gtk') set guifont=Dejavu\ ...


8

This happens when some system cron job cleans out "unused" files from /tmp. The solutions are: Find that cron job and stop it from rm'ing your Vim /tmp files. Recreate Vim's temporary directory. Given the temporary directory name from the error message, you can recreate the directory manually with "!mkdir <dirname>", or you can use this command which ...


7

For configuration command you've specified gnome2 as your main GUI (--enable-gui=gnome2), are you sure it's the right one? Or maybe gnome2 is not enough to enable GUI, so try to add extra --enable-gui, --with-x parameters. You can also configure so your GUI would be detected automatically by --enable-gui=auto. Also make sure that you have all your ...


6

From :help gf: Trailing punctuation characters ".,:;!" are ignored. So I suppose the dot at the end is not considered as part of the filename but as punctuation. I don't know if it can be done with fewer keystrokes, but to open this file while the cursor is on B, I would type: viWF.<c-w>f viW = visually select characters inside big word F. = ...


6

I still don't know how to use backtick-expansion to populate the arglist with an arbitrary shell command, however I've found a workaround. From :help `=: You can have the backticks expanded as a Vim expression, instead of as an external command, by putting an equal sign right after the first backtick, e.g.: :e `=tempname()` The expression can contain ...


6

Thanks to x33a on the Arch forums, I was able to solve my problem. (https://bbs.archlinux.org/viewtopic.php?pid=1596987#p1596987) I changed the python 3 flag from --enable-python3interp=dyanmic to --enable-python3interp This resulted in only python 3 being available.


6

You can use: :set t_Co=0 This will tell Vim that you're not using a colour terminal. The difference with using :syntax off is that this will still enable some syntax highlighting features with bold, underlined, and "reverse video".


6

I have a couple guesses. My first guess is that this is because you have "diff" on, most likely because you had done "diffthis" at some point, or started vim in diff mode. From :help diffthis *:difft* *:diffthis* :difft[his] Make the current window part of the diff windows. This sets the options like for "vimdiff". You ...


5

A "pure" Vim way, just because we can: :let is_64_bits = match(strpart(readfile(resolve('/proc/' . getpid() . '/exe'), 'b', 1)[0], 4, 1), '\%x02') != -1 So, how does it work? Split up in multiple commands: Get the path to the Vim binary: :let file = resolve('/proc/' . getpid() . '/exe') Read the first "line" of the current binary. Reading a "line" makes ...


5

Vim's -o and -O options will open the files while splitting them horizontally or vertically respectively. Taken from Vim's help page :help -o and :help -O: *-o* -o[N] Open N windows, split horizontally. If [N] is not given, one window is opened for every file given as argument. If there is not enough room,...


5

Most likely you've got some conflict with file syntax, which can be confirmed by turning that off: :syn off For example, by default in vim files (Such as your .vimrc) spell checking is only performed in comments.


5

Just discovered this after viewing /etc/vim/vimrc for the first time. Uncommenting the line "set background=dark" in vimrc solves my readability problem also. It changes the syntax colors so that they are distinguishable against my black background! This is actually better than what I had hoped for in the original question! (Presumably :set background=dark ...


Only top voted, non community-wiki answers of a minimum length are eligible