Tag Info

Hot answers tagged

14

The first place to check is if there's a backport, but there isn't, which isn't surprising since maverick has vim 7.2 too. The next thing to try is if someone's put up a repository with vim 7.3 packages somewhere, preferably a PPA. There are many PPAs with vim, including several with 7.3 (not an exhaustive list). If you don't find a binary package anywhere ...


11

I think either :pwd or getcwd() is what you are looking for.


9

There isn't a way, and I think a script is the only way. The reason being, what if you had a file called setup.cfg:11 and wanted to edit it? Here is a quick script that does what you want as a oneliner... editline() { vim ${1%%:*} +${1##*:}; }


7

See http://stackoverflow.com/questions/102384/using-vims-tabs-like-buffers/103590#103590 (or why spliting the vim community among all SE/SO sites is a bad idea)


6

vim has an event you can bind to for this, FocusGained, combine this with the redraw! command (the ! causes the window to be cleared first) :au FocusGained * :redraw! The syntax here can be read as 'automatically run the command (au is short for autocmd) :redraw! when I get the event FocusGained for any file matching the pattern *'. to make this ...


5

First of all, quick naming correction - anything open in Vim is a "buffer". The terminology here is similar to emacs, if you are familiar with that editor. Buffers simply refer to open files in the memory of the current Vim process. To see a list of you buffers, use :ls which shows you a list of the current buffers, numbered in the order that they were ...


5

You can install apt-get install either vim-gtk or vim-gnome or even vim-lesstif to get a vim gui.


5

You can use the last jump mark (m') as a temporary mark. To avoid using a different command to re-enter insert mode (i vs. a), you can use the gi command, which re-enters insert mode at the position where it was last exited: inoremap <F4> <Esc>m'ggVG=``zzgi


4

The colours of vim-powerline should be located in your .vim directory. If you use a plugin manager it may be .vim/bundle/ followed by the vim-powerline/autoload/Powerline/Colorschemes tree. The file you are looking for should be the default.vim. The colour setting you are looking for is : . \ Pl#Hi#Segments(['mode_indicator'], {¬ . . \ 'n': ...


4

I got all the pieces together to do the trick. The best way is to create a custom mapping for all the commands: map <F8> :let mycurf=expand("<cfile>")<cr><c-w> w :execute("e ".mycurf)<cr><c-w>p Explanation: map <F8> maps on "F8" the commands that follow let mycurf=expand("<cfile>") gets the filename ...


3

You can use gvim file +5 -c "normal zz" The -c option allows you to specify an editor command to run when starting vim. zz, as others have mentioned, centers the screen on the cursor line.


3

You can use the file:line plugin available here, which does exactly what you want...


3

Build from source. It will be quicker. Trying to both find and enable a repository for a one-off install like that will just cause you headaches further down the line.


3

In gVim you can select the font, vim depends on the font the terminal provides. And it's the same for colour support. Gvim has full support, vim depends on the terminal. Gvim additionally has menus and a toolbar, which vim lacks. One big advantage of vim is that, since it's a terminal application, you have a full fledged terminal at your fingertips. gVim ...


3

you could try something like: :au FocusGained * :redraw!<CR>


3

The autoread option does not have a timer. A reload is triggered when a shell command is launched or checktime is executed. Furthermore, vim does not have built-in timer functionality, so there's no simple way (meaning without plugins or ugly hacks) to call checktime every n seconds. You can misuse updatetime and events like CursorHold to execute checktime ...


2

Install both and try them both, they use the same configuration etc. so there's no risk. As far as differences are concerned: one is a graphical tool one is a command line tool. So the advantage of vim to gvim is that you can use it easily over an ssh connection. (You can do the same with gvim by tunneling X but that has quite some overhead.


2

I took a vim function written by Jan Larres in the question " How to open or close NERDTree and Tagbar with < leader>\?" and modified it (I only added the wincmd commands)to make my vim look like this: +-----------+-------------+ | Tagbar | file | | contents | | +-----------+ | | NERDTree | | | contents ...


2

Sounds like your Vim is in vi-compatible mode; :set compatible? will print compatible then. You need to create a ~/.vimrc file (empty one will suffice) to switch Vim to nocompatible mode. In general, it's recommended to put your customizations there, and leave .gvimrc for the very few GUI-only settings.


2

You could try this using the environment variables: EDITOR SUDO_EDITOR VISUAL And setting one/all to this: "/usr/bin/gvim --remote-silent"


2

gvim returns almost immediately. When sudoedit notices that the editor has returned it will finish reporting no changes. To get sudoedit to work correctly you need to get it to wait until you are finished editing. I normally use -f switch to do this. I have not tried it but the manual seems to support the use of --remote-wait or --remote-wait-silent.


2

The patch script is accessible here in it's own GitHub repo, titled: powerline-patcher. An experiment I first started by downloading the above patching script. $ git clone https://github.com/Lokaltog/powerline-fontpatcher.git I then selected a sample .ttf file to test out your question. $ ls -lr | grep ttf -rw-r--r--. 1 saml saml 242700 Jul 2 20:29 ...


2

Vim can get close(r) to an IDE in terms of features via various plugins, but it will always remain a powerful text editor with great extension capabilities. So for anything larger than a hobby project, you'll certainly miss IDE features like debugging, variable inspection, refactoring, find usages, etc. But why not have both? It's easy to set up a command ...


2

When gvim starts, it sources a file called mswin.vim via the _vimrc file. In the mswin.vim file the keys are remapped. You can undo this two ways. One is edit the mswin.vim file and remove the mapping (not recommended). A second easier potentially less invasive way is to edit the _vimrc file. 1. Start gvim as Administrator. 2. Click ...


2

This can be configured via a buffer-local b:browsefilter variable, which is set in filetype plugins; for C/C++, $VIMRUNTIME/ftplugin/c.vim. To change / override this, just put the following into ~/.vim/after/ftplugin/cpp.vim: let b:browsefilter = "C++ Source Files (*.cpp *.c++)\t*.cpp;*.c++\n" . \ "C Header Files (*.hpp, *.h++)\t*.hpp;*.h++\n" . \ "C ...


1

You cannot. However, you can trick pacman into thinking you have (there are two ways to do this). Simply pass the --dbonly option: pacman -S --dbonly ruby This will commit the transaction to the database (make a record of the install), but not actually download or install any packages. If you want, you could also pass --asdeps to mark it as a ...


1

The ]p and ]<MiddleMouse> commands work like p, but adjust the indent to the current line. So if you paste an unindented code snippet in the middle of a deep conditional, it should just fit.


1

I always set paste to enabled prior to doing this: :set paste Then paste the example code into vim. Paste is typically off by default. See :help paste for more on the implications. To undo the above: :set nopaste I'd check out this StackOverflow Q&A titled: How do you paste with vim without code being commented? for other alternatives to this as ...


1

After pasting, you can do: '[>'] To shift the just-inserted text by 'shiftwidth' columns. You can repeat with ..


1

:'x,.s/$/ / Would add 4 spaces at the end of the lines between mark x and the current line. In visual mode, you can press : which will bring :'<,'> and then add s/$/    / to add 4 spaces to the end of each line in that selection. If you want to add 4 spaces at the right edge of the currently selected visual block, just enter ...



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