Tag Info

Hot answers tagged

3

:set relativenumber has been created to solve that problem.


3

Some basics about search paths When you run a command that does not contain slashes, such as vim, the shell needs to know which file (or shell builtin/function) to execute. It finds this by following the search path, defined in the PATH environment variable. The PATH variable is a list of paths separated by colons, and the shell will look for the command ...


3

Command line ranges can be use to select a specific line that needs to be edited. Then substitute pattern can be used to perform the edit (append). For example, to append text "hi" at the begining of line 3: vim -c "3 s/^/hi/" -c "wq" file.txt To append text "hi" at the end of line 3: vim -c "3 s/$/hi/" -c "wq" file.txt To find more options and ...


3

It depends on which popup menu state you are in (see :help popupmenu-completion). I understand from your question that you're in state 2 (since you've pressed arrow keys to find a completion). However, the default behavior for Enter in state 2 is to insert the completion without newline; what you describe is normally the behavior of state 1 (which is when ...


3

You can set backspace to work like in other editors: set backspace=indent,eol,start Sanity's great.


2

Normally, visudo ignores the VISUAL and EDITOR variable for security reasons and calls vi, so the compatibility mode of vim is enabled. Read How to set visudo to use a different editor than the default on Fedora? to change the default editor.


2

You can use following sequence to only retain the account numbers (cudo's to J.D.Mohr) note the space after the r in the command :%norm $F,d$Bhv0r This assumes that there's only one , after the number you want to retain Breakdown : -> Enter command mode %norm -> Applies a normal command to the entire file $ -> Jump to end of line F, ...


2

First, check that the plugin is correctly installed; its scripts must appear in :scriptnames. Then, check what artifacts it defines (commands, mappings, autocmds), and verify they're there via :verbose map ... and :verbose command ..., :verbose autocmd ... Finally, trigger the plugin functionality while capturing a log with vim -V20vimlog. In the log (or ...


2

Note: dd$ only work at the end of the buffer, where the dd will automatically move the cursor on line up. Elsewhere, it's ddk$. If you're in insert mode, you can alternatively also use <BS> to remove the empty line and move the cursor to the end of the previous line. This also works from normal mode: i<BS><Esc> with this setting: set ...


2

If I understand your question correctly, you can use { and } to go to the start or the end of a paragraph in normal mode. From :help object-motions 5. Text object motions *object-motions* *(* ( [count] sentences backward. |exclusive| motion. ...


1

My personal solution to this is to do 5j or 5k commands to move 5 lines up or down. I find that it's faster to do repeated 5j commands, which have become part of my muscle memory, than it is to try to calculate an exact jump. Of course conditions exist when you want an exact jump, but if you're editing text or code, doing a few 5j commands followed by ...


1

What I find useful is instead of moving the cursor around I move the screen: Ctrl-e - Scroll the screen upwards Ctrl-y - Scroll the screen downwards As this scrolls the screen then I can easily read the code rather than paginating and then working out where I was. Then I move the cursor to where I want it on the screen: H move to top of the screen M ...


1

As the external command is executed through the shell, you just have to append a & to launch the process in the background: nnoremap <leader>dc :execute 'silent !drush cc all &' | redraw!


1

In recent Vim 7.4 builds, you can :set wrap breakindent and have the soft-wrapped lines indented (controlled by the 'breakindentopt' option). However, that is a simple, fixed indent; you cannot dynamically influence this (as would be necessary to maintain the syntax). Alternatively, you can reformat (i.e. hard wrapping) with gq, and then :join or :undo ...


1

As an alternative to using your arrow keys, enable your j & k keys to scroll through the autocomplete list. Doing this changes the current line to match the selected word as you scroll. Therefore you do not have to press enter as the cursor is still in insert mode at the end of the substituted word. To enable this add this to your .vimrc (Thanks to ...


1

You're basically asking us to teach you how to program in Perl with this question. There are whole book series dedicated to this topic. (Yes, single books are now too small to contain the whole scope of Perl.) I recommend that you start with the llama book.


1

According to my vim config: tmux will only forward escape sequences to the terminal if surrounded by a DCS sequence (see) So when my config detects that vim is running in tmux (if exists('$TMUX')) it will surround every escape sequence with "\ePtmux;\e" and "\e\\" My escape sequences are xterm specific, but I guess you need to perform a similar ...


1

The answer lies in two lines from your given :set output: runtimepath=~/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim73,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,~/.vim/after statusline=%f %h%m%r%=%9*Obtaining ../ Somewhere, your statusline is being altered to contain Obtaining ../. Unless this is a stock vim thing ...


1

I thought this is what is documented as Known bugs: Conque only supports the extended ASCII character set for input, not utf-8. - VT100 escape sequence support is not complete. Alt/Meta key support in Vim isn't great in general, and conque is no exception. Pressing Esc+Esc+x or Esc+M-x instead of M-x works in most cases. I haven't used Conque, ...


1

I would consider filing a bug report. In the meantime, why not letting bash behave more vi-like? Issue set -o vi to use vi navigation in bash. UPDATE I've added this as an issue on the Conque website, here: Issue 106: Bash inside Vim not working properly.


1

This will open the specified files and to to the specified line (to wit: line 123) in all specified files: vim -p +'tabdo 123' /path/to/somefile /path/to/some/otherfile


1

This displays all high characters as <xx>: set encoding=latin1 set isprint= set display+=uhex Any single-byte encoding will work, vim uses ASCII for all lower chars and has them hard-coded as printable. Setting isprint to empty will mark everything else as non-printable. Setting uhex will display them as hexadecimal. Here is how the display changes ...


1

I'm not sure why this happens but I experience it on vim in xterm with the solarized colour scheme. To fix it, I suspend vim (ctrl-z), reset the terminal (the reset command) and resume vim (fg). So possibly the terminal has entered a weird state not anticipated by vim. This happens more when editing LaTeX than when editing C++ or bash scripts. It seems to ...


1

I use the c, "change", command quite frequently for this kind of thing, combined with regular search. You can search the file for each line/piece of text you are interested in and then use consecutive n. commands (n for next and then . to repeat the last change.) /^hello - find line beginning with hello; c$goodbye - change line to goodbye; n. - repeat find, ...



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