Hot answers tagged

79

Try from within vim ... :version and if your get ... Small version without GUI. You are missing package vim-gui-common. It is probably also advisable to install vim-runtime. Commands to install: sudo apt-get install vim-gui-common sudo apt-get install vim-runtime Another cause might be that alternatives is pointing to the wrong one: update-...


23

The path is correct but the file doesn't exist yet. It is not created by default because it's an optional way to configure your own settings. Like with any text editor, when you call vim and enter the name of a file that doesn't exist (or is blank) it opens a blank file with that name, that's why vim ~/.vimrc opens an empty file. Press i, write something, ...


21

User-specific changes like that should go in your personal .vimrc, which should be located in your home directory. If this file doesn’t exist yet you can simply create it. This will add your set line to ~/.vimrc creating this file if necessary: echo 'set mouse=a' >>~/.vimrc After that, either restart vim or source the file in a running instance with ...


18

This is the main difference: " Comments to describe what the line of code below does "" Actual working code for the .vimrc file but still commented. So that when you see double "double quotes" it's commented code, you can uncomment it by removing the double "double quotes", the single "double quotes" mean "I'm just a comment" and are not to be "...


9

When vim gives you this warning, it also should give you some options at the bottom: [O]pen Read-Only, (E)dit anyway, (R)ecover, (Q)uit, (A)bort: Chose "R" if you want to recover whatever changes and "E" if you don't. If you persistently get this message, delete the swap file named. More information is found in the error message normally.


9

You probably don't have the full version of VIM installed. To check, try executing vim or: readlink -f `which vi` For example, Ubuntu 16.04 LTS only came with /usr/bin/vim.tiny Install the full VIM: sudo apt update sudo apt install vim Now you should have /usr/bin/vim.basic, and the .vimrc commands should succeed.


6

If this started after you've updated to 16.04, it might be b/c of the change to python 3 as the default interpreter as @luka5z pointed out. To resolve, I updated to the latest clang-format.py file from https://llvm.org/svn/llvm-project/cfe/trunk/tools/clang-format/clang-format.py and edited .vimrc lines from: " Add hook for clang-format map <C-K> ...


5

The easiest way to create a ~/.vimrc file, and have an excellent starting point for your own explorations, is to run the following from a Terminal window: cp -v /usr/share/vim/vim*/vimrc_example.vim ~/.vimrc Open this file with you favorite text editor and start exploring, the file is well commented and there are also endless examples on the Internet to ...


4

Turns out I didn't have vim, just had vi, due to dependency issues after the upgrade. tl;dr; - needed older versions of dependencies. Fixed with: $ sudo apt-get remove vim-common $ sudo apt-get remove vim-runtime $ sudo apt-get update && sudo apt-get install vim Change .vimrc setting "set filetype off" => "filetype off" Full Version... Fix ...


4

Is your locale set correctly? I was having this problem until a few minutes ago, I eventually traced it to misconfigured locales. Fixed the config files and ran locale-gen, then source /etc/profile (or better, reboot) and vim behaved properly. No more starting up in replace mode. I'm on Arch linux so I won't post the exact steps, but maybe you have a ...


3

By setting t_Co to 256 what you'll get is a degraded version of Solarized. It's better to update your terminal color palette instead for more precise colors. set t_Co=16 let g:solarized_termcolors=16 By setting t_Co and solarized_termcolors to 16 we tell Vim and Solarized to use terminal's color palette.


3

You're stuck in insert mode because the ESC key is disabled. Take the following out of your .vimrc: "disable the esc button :inoremap <esc> <nop>


3

-rwxrwxr-- 1 root root means the file belongs to the root user and that only him and users from the group 'root' may write to it. You can use your sudo powers and run sudo vim vimrc or you could change the owner with sudo chown <insert-your-username-here> vimrc and then edit it with vim vimrc


2

Your plugins may be loaded, but just not have a visible effect by default. For example, the line Plugin 'bling/vim-airline' loads the vim-airline plugin, but you will not see the fancy status line until the status line is shown for some reason. (The bottom line in your screenshot is not the status line.) The status line get's shown if there is a split ...


2

Use :w! to override read-only, instead. Edit the file with sudo vi <filename> if necessary. Also, it looks like you may be trying to edit /etc/vim/vimrc. Don't do that ; edit ~/.vimrc (or /home/youruser/.vimrc) instead.


2

For me I had to install vim.nox-py2: aptitude install vim-nox-py2 and use update-alternatives to activate it: update-alternatives --config vim select the number corresponding to vim.nox-py2.


2

This worked perfectly for me: :command-bang Q q<bang> From vim's help (:h command-bang): Special cases :command-bang :command-bar :command-register :command-buffer There are some special cases as well: -bang The command can take a ! modifier (like :q or :w) and ...


2

You just have to give :command Q q Similarly, you can do for other commands like, :command WQ wq :command W w


2

I was able to solve the problem in two steps. Since vim had not been able to generate the required index from the compressed documentation, I extracted these files before re-running the indexer. As vim is able to deal with compressed documentation, I removed the extracted documents and adjusted the filenames of the index accordingly. #!/bin/bash #set -x ...


2

Here is a good place to use abbreviations. From :h abbreviations 2. Abbreviations *abbreviations* *Abbreviations* Abbreviations are used in Insert mode, Replace mode and Command-line mode. If you enter a word that is an abbreviation, it is replaced with the word it stands for. This can be used to save typing for often used long words. And you ...


1

if exists('*pathogen#infect') " The function pathogen#infect() exists else " The function pathogen#infect() does not exist endif Use :help exists() for more infomation. In addition to variables, exists() is also able to test for &options, *functions, :commands, #event autocommands.


1

You ran git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim with sudo. This put it Vundle in /root/. You need to follow the instructions for Vundle and issue the command correctly: git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim


1

From the README (emphasis mine) : IMPORTANT NOTE FOR TERMINAL USERS: If you are going to use Solarized in Terminal mode (i.e. not in a GUI version like gvim or macvim), please please please consider setting your terminal emulator's colorscheme to used the Solarized palette. I've included palettes for some popular terminal emulator as well ...


1

The general syntax for mapping keys is: {cmd} {attr} {lhs} {rhs} where {cmd} is one of ':map', ':map!', ':nmap', ':vmap', ':imap', ':cmap', ':smap', ':xmap', ':omap', ':lmap', etc. {attr} is optional and one or more of the following: <buffer>, <silent>, <expr> <script>, <unique> and <special>. More ...


1

For Unix/Linux, vim looks for $HOME/.vimrc, so the first thing that could affect this is, of course, the environment variable $HOME. Is this set on your system (it should be /home/your_user_name. There is no place that I've seen that specifies where this file should be, so the only other way I can see would be if you start with the -u option to specify a ...


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