Tag Info

Hot answers tagged

8

You can use the VIMINIT environment variable to override the use of the usual .vimrc while keeping other parts of the initialization process. VIMINIT should be set to one or more ex-style commands (“colon” commands; use pipe (|) to separate multiple commands), not just the path to a different initialization file. VIMINIT='so /tmp/myvimrc'; export VIMINIT ...


8

Suppose you have this other set of settings in /tmp/myvimrc. If my reading of man vim is correct you can start vim with this set of settings using the following: $ vim -u /tmp/myvimrc Thus, to make this an option for the rest of the session, I would create a function that sets this as an alias for vim. Thus, in bash I would put something like this in my ...


6

using .zshrc to modify my environment variables That's the root cause of your problem. .zshrc is a startup file for interactive shell sessions. Use it to set shell settings, not to set environment variables. Environment variables are typically set in a session file such as .profile. See Alternative to .bashrc (what goes for .bashrc also goes for ...


5

You have to change the color of your cursor line to a color other than the color of your cursor. If you're in a terminal emulator like st or rxvt, Vim cannot change the color of your cursor; it will always be the color your terminal application decides to make it. Only the graphical version of Vim is able to change the color of your cursor. You can change ...


5

You could use :confirm quit, e.g. map <C-w> :confirm quit<CR> By the way: C-w is a bad choice for a shortcut, because it is used as the start of other shortcuts, e.g. C-w v for splitting vertically. That's why you experience a short delay before the dialog pops open: after you press C-w, vim waits a short time for other keypresses, before it ...


4

Your server is trying to use a file for lexical highlighting. The file does not exist at the place where vim is looking for it. At this point, you can do any one of the following: Remove the reference to syntax in /etc/vimrc Look for the syntax file on your server (e.g. find / -name syntax.vim) and copy or symlink that file to the directory where vim is ...


3

See this wikia.com article for the exact thing you're tyring to do: http://vim.wikia.com/wiki/Map_Ctrl-S_to_save_current_or_new_files In a nutshell you need to do the following. 1. Add this to ~/.vimrc " If the current buffer has never been saved, it will have no name, " call the file browser to save it, otherwise just save it. nnoremap <silent> ...


3

Due to the way that the keyboard input is handled internally, this unfortunately isn't generally possible today, even in GVIM. Some key combinations, like Ctrl + non-alphabetic cannot be mapped, and Ctrl + letter vs. Ctrl + Shift + letter cannot be distinguished. (Unless your terminal sends a distinct termcap code for it, which most don't.) In insert or ...


3

Yes, it is possible. You can load menu.vim (the default gvim menu definitions), or you can just start from scratch and create your own, then access them through :emenu. This doesn't give you nano-like always-visible menus, though; it gives you the ability to navigate menus using command-line tab completion. If the user doesn't have a vimrc, you'll want to ...


3

If it is not an interactive or a login shell I think you're left with using ~/.zshenv. The following is from section "STARTUP/SHUTDOWN FILES" in zshall(1): Commands are then read from $ZDOTDIR/.zshenv. If the shell is a login shell, commands are read from /etc/zsh/zprofile and then $ZDOT- DIR/.zprofile. Then, if the shell is interactive, commands ...


2

It should be syntax on or syntax off. set syntax=something is used to change the current syntax (c, perl, nasm, etc). UPDATE: As @garyjohn pointed in comments, it's possible to turn it on/off for the current buffer and its corresponding filetype using set syntax=ON and set syntax=OFF.


2

As far as i know there is no way to have menues with vim (in the terminal). Depending on the role of your server you may consider talking to the admins and demand the installation of additional editors like nano, emacs, mcedit…. If this is not a production environment and should be used by developers interactively there is no good reason to deny the ...


2

Vim expects to find its installation files (eg help system, definitions for syntax highlighting) in a particular place but can run without many of them. It's possible that while you can run Vim, it cannot locate these installation files. Vim will try several methods to locate these files but if you have a unusual installation then they won't be found. If ...


2

There are two problems: The :highlight command does not evaluate ctermfg values as expressions. It accepts only a literal color number, or a color name (see :help cterm-colors). You get E421 because s:base00 is not a number, nor a valid color name. You could use execute 'highlight GroupName ctermfg=' . s:base00 to build an command string and execute it ...


2

If you are working within a GUI or a window manager of some sort, you may be able to configure it to send a different keystroke to your terminal application or Gvim application when you type Ctrl;. You would need to tell it to send a keystroke that vim understands but that is harder for you to type. For instance, you could map Ctrl; to Ctrl^ (which I ...


2

To keep cursor position use something like: function! <SID>StripTrailingWhitespaces() let l = line(".") let c = col(".") %s/\s\+$//e call cursor(l, c) endfun else cursor would end up at beginning of line of last replace after save. Example: You have a space at end of line 122, you are on line 982 and enter :w. Not restoring ...


1

The issue is caused by the sensible plugin:line 93. :help t_Co " Allow color schemes to do bright colors without forcing bold. if &t_Co == 8 && $TERM !~# '^linux' set t_Co=16 " << --- Causes hickup endif If you run vim in verbose log mode (vim -V15load_log.vim) – and search for t_Co= and RedundantSpaces you'll see that sensible is ...


1

After doing these commands: cd ~/.vim/bundle git clone git://github.com/mattn/calendar-vim You need to add the following line to your $HOME/.vimrc file: Bundle 'calendar-vim' After doing this when I start up vim I get the command: :Calendar Which shows the following in vim. screenshot ...


1

Usually people want it the other way around, using (approximated) colors defined in a GVIM color scheme in the console, too. It all depends on your colorscheme; it provides the attributes (like bold / italic), foreground and background colors for terminals, color terminals, and the GUI. Good color schemes provide similar definitions for all three. You can ...


1

I made the <F4> key apparently work in all modes by using map <expr> expression maps as follows: MapOptToggle <F4> relativenumber MapOptToggle! <S-F4> number command! -bang -nargs=+ MapOptToggle call <SID>MapOptToggle(<bang>0, <f-args>) function! s:MapOptToggle(bang, key, opt) function! s:ToggleOpt(opt) if ...


1

You can add your .vim runtimepath on top of your .vimrc file: :set runtimepath=/home/b/.vim,$VIMRUNTIME This makes vim search for plugins, colors etc. in /home/b/.vim first and then in the standard location (for example /usr/share/vim/vim72/ in debian squeeze). I'm using this together with an alias vim='vim -u /home/b/.vimrc'.


1

I'm not sure what you mean by pollute but if you mean just not having duplicated files you can create a symbolic link. That's the way I keep my vim settings the same across different users. I have .vimrc and .vim folders in /usr/local/etc/vim_settings, owned by root but readable for everyone else. Then for each user I do the following: ln -s ...


1

Which vimrc are you talking about? I don't use/know vim, but in many cases rc files have two kinds of "incarnation": a system-wide rc-file under /etc that dictates the system defaults for the application and user-wide rc-files under the user homedirs, where users set their own settings, that override the defaults from the system-wide configuration file. ...


1

You can use a Vim macro. In the command mode, use press q to enable macro mode, and let's call your search highlight a macro 's' - meaning go ahead and press 's'. Now you can search for all the '%' characters by first setting :set hlsearch (just to make sure) and then entering /%. Then, you can save this macro by pressing q again. After this, whenever you ...


1

I am not sure why your version is not working, but I am able to do this using the call option and putting the settings in a function like this: set tabstop=4 set softtabstop=4 set shiftwidth=4 function! setAltPrefs() set tabstop=2 set softtabstop=2 set shiftwidth=2 endfunction autocmd FileType xml,html,xhtml,javascript call setAltPrefs() ...



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