Tag Info

Hot answers tagged

4

You need an awesome and must-have plugin surround. Then, it will happily do what you want if you select text and type sb (surround-braces), or s). It actually can do a lot of surrounding: various quotes, tags, etc. It allows you to put cursor in the double-quoted word and change double quotes to single quotes by typing: cs"' (change-surround " to '). Or you ...


4

The :tag <identifier> command is equivalent to Ctrl-] when the cursor is over <identifier>. See :help CTRL-] So you can type :tag process_input to jump to that function's tag. Further, the :tag command uses tab completion, so you can instead type :tag pro<Tab> and Vim will complete as much of that name as it can. Hit <Tab> again ...


3

Many settings (like indentation) are bound to filetypes, anyway. You can also define buffer-local mappings and commands, so several pieces of your requirements just require consistent use of built-in abstractions (read :help ftplugin). For global stuff, I would recommend to keep the differences to an absolute minimum, as this prevents building up muscle ...


3

I had the same problem, but I aliased ; to : instead. nnoremap ; : (Why worry about not releasing Shift in time if you can just not press it in the first place.) A more direct answer: command Wq :wq (As it happens, user-defined commands must start with an upper-case letter.) You'll likely want proper tab-completion though, as well as :W: command ...


2

Mappings work just like a recorded sequence of keys (as the right-hand side). As this is Vim, you need to be aware of the modes; here, normal mode, so n: :nnoremap <C-g> :NERDTree<CR> This maps (without remapping, the nore... part) to <C-g> (see :help key-notation) the :NERDTree command, concluded by Enter. To have this permanently, put ...


2

Unfortunately you're misinterpreting the post you linked to. You would create a .vim directory in your home directory, which is what the ~ (tilde) means. Then within that directory you should create a colors directory, and put your colorscheme files there. At that point, a :colorscheme command should find the file automatically.


2

In addtition to Dmitry's suggestion of the surround plugin, adding parenthesis around highlighted text can be done with the following command: xi()<Esc>P You can set a map in visual mode using (for example) \s by adding the following to your ~/.vimrc file: xnoremap <leader>s xi()<Esc>P


2

Yes, it's definitely possible. See (the single quotes are meant to be typed): :help 'foldtext' For example: function! MyFoldText() let lines = printf('%' . len(line('$')) . 'd', v:foldend - v:foldstart + 1) let line = substitute(foldtext(), '^+-\+ *\d\+ lines: ', '', '') return '[' . lines . ' lines: ' . line . ']' endfunction set ...


2

Have a look at (with the single quotes typed): :help 'makeprg' For example, try this: :set makeprg=coffee\ -c\ % Then you can just type :make instead.


2

The HOME variable is defined in /etc/passwd. The line of the root user should normally look like this: root:x:0:0:root:/root:/bin/bash The 6th field (separated by colon :) defines the home directory and is copied to the HOME environment variable by PAM; the mechanism of linux to authenticate users.


2

Does this do what you want? :%s/[0-9-]\+$/\=submatch(0)=='-'?1:submatch(0)+1/


2

I use the tool nircmd which has an option elevate to run programs as admin. Here is an option to open Visual Studio projects (sln files) as admin: Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\VisualStudio.Launcher.sln\Shell\Open Solution elevated] "HasLUAShield"="" [HKEY_CLASSES_ROOT\VisualStudio.Launcher.sln\Shell\Open Solution ...


1

Specify the ruby executable for Syntastic Syntastic calls ruby -c to check the syntax of a file, so the errors it shows depends on which version of ruby its using. You can point it to the one you want to use like this: let g:syntastic_ruby_exec = 'path/to/ruby/executable' $ type ruby will tell you where your current Ruby executable is. Ruby installers ...


1

If I understand you right, you can't get Vim to do exactly what you want, but you can get close. Read: :help 'laststatus' :help 'statusline' (The single-quotes are meant to be typed as part of the help command.) Specifically, you want to make the statusline always show up: :set laststatus=2 Then configure the statusline with the appropriate ...


1

I cannot reproduce the problem, not with the latest 7.4.608, nor with 7.4, or 7.0. I think you have custom syntax extensions that cause this. Try with $ vim -N -u NONE; the problem probably is gone then. You should then check your syntax extensions (~/.vim/after/syntax/cpp.vim, ~/.vim/syntax/cpp/*.vim, etc.). You need to find out which syntax group causes ...


1

You can jump to a specific known tag with the :tag command. For example: :tag process_input


1

For everyone having the same problem: i found this vim plugin http://www.vim.org/scripts/script.php?script_id=31 which seems to have more options, like splitting the pane and so. I didn't try it, but you might give it a try.


1

It sounds like you have some mappings overriding the default keystrokes. If you use the :verbose command you can see what set a mapping (or option, or a number of other things). For example: :verbose :map d That should show you all mappings that start with d and what set the mapping.



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