Tag Info

New answers tagged

0

Vim can be used to compile using gnu make the current file - even if there's no Makefile for the file (for more details see here): :make %:r This way vim provides you with access to the quickfix error feedback from the compiler (:help quickfix) list - :cn Next error, :cp Previous error, :cw New window listing errors. If you've not got gnu make then you ...


0

Rename the current buffer with :file <new-name> (or :f <new-name>): :f[ile][!] {name} Sets the current file name to {name}. The optional ! avoids truncating the message, as with :file. If the buffer did have a name, that name becomes the alternate-file name. An unlisted buffer is created to hold the old name.


2

The NrrwRgn - A Narrow Region Plugin similar to Emacs plugin can show parts of the buffer in a separate scratch buffer, with automatic syncing back. That looks like a solution when you're concerned about moving away from the view. Otherwise, I would just size a split window to show exactly what you want, and keep it at that.


0

You can use folds to fold the portions you do not want to pay attention to. To create a fold use v{motion}zf in visual mode. Use za and zd to unfold and remove a fold respectively. You can also create folds in command mode. Essentially {motion}zf. This video might be a handy reference.


0

With the SwapIt - Extensible keyword swapper, you can define tag groups that can then be toggled via <C-a> / <C-x>. For example, in ~/.vim/ftplugin/html_swapit.vim: SwapList layout p div span If you have both start and end tag on the same line (and there's only one of that type), you can edit both via my ChangeGlobally plugin. There are ...


1

This happens when TERM isn’t set to the correct screen[-256color] in Vim’s environment, usually by some shell startup script. If that is the case – for example, you have a TERM=xterm-256color , either remove it or make sure it checks the original value of TERM before changing it, e.g. if [[ $TERM == xterm ]]; then TERM=xterm-256color fi


1

I found that this happens when I enter netrw (with :Explore, for example) and press O on a file, it attempts to "obtain" this file resulting in an error message and this text being appended to my status line. I haven't found a way to get rid of it other than to use :set, copy out the normal status line, and re-set my status line to the proper one without ...


2

What you can do is use :redir to write them out to a file and then edit them: :redir > variables.vim :let g: :redir END :n variables.vim or use variables.vim as input to some other command.


0

It can let you easily navigate and edit the command line using vim's shortcuts, e.g. quickly move to one word right, delete a word. By the default shortcuts, when you need to go to the end of the line, you need to Ctrl+e, whereas with set -o vi, you just hit $, like in vim.


1

I needed two autocmds to do this. To reach the gap between the headers and the message, search for an empty line: autocmd BufRead /tmp/mutt-* execute "normal /^$/\n" then to enter insert mode: autocmd BufRead /tmp/mutt-* execute ":startinsert"


0

If you insert 1G in there that should get you to the first line of the file.


1

You'll have to live without ctrlS because that is the terminal command to stop output (ctrlQ undoes that). Other function keys should be mappable without any problem, just enter :map , then hit the function key you want to map which should show e.g.<F5> for F5, then space, then what you want the key to map to. You can put that line (without the ...


1

First, you need to know what ci" mean in vim: c means change i means inside " means double quote literal text object. So, ci" means change a string inside quotes. Adding 2 applied change command over 2 quotes.


1

I suggest you read doc/motion.txt. It states that with count 2 the quotes are included and thus i" works a bit like a" except no extra whitespace is added. EDIT: Just to be clear, I don't strictly speaking provide an answer. I take this behaviour as the design decision of the author and since he did not provide rationale in the manual, you can only ask ...


0

Put this in your .screenrc: bindkey "^[[5~" eval "copy" "stuff ^b" bindkey "^[[6~" eval "copy" "stuff ^f" This will make PgUp and PgDn enter copy mode and move by pages within screen's scrollback buffer. Caveat: You still need to hit Esc to exit screen's copy mode.


0

You need to edit your .vimrc like so with a colon before the commands :colorscheme gotham256 :set background=dark :set t_Co=256 :highlight Normal ctermbg=NONE :highlight nonText ctermbg=NONE Hope this helps!


3

I don't think you can map CapsLock from within Vim. You remap it within X using setxkbmap: setxkbmap -option caps:swapescape For remapping in the console, if your distro uses systemd, you can use a custom keyboard layout in /etc/vconsole.conf as described on the Arch Wiki, and for other init systems see this U&L answer.


26

You can use another character instead of slash / as delimiter to substitution command. Example using #: :%s#/a/b/f/g/d/g#/s/g/w/d/g/r#


2

Maybe you can use sed Example 1 – sed @ delimiter: Substitute /opt/omni/lbin to /opt/tools/bin When you substitute a path name which has /, you can use @ as a delimiter instead of /. In the sed example below, in the last line of the input file, /opt/omni/lbin was changed to /opt/tools/bin. $ sed 's@/opt/omni/lbin@/opt/tools/bin@g' path.txt ...


0

On Red Hat (and Fedora), use the /usr/bin/vimx command. The + register (system clipboard) will work if you use the vimx command. vimx has support for the system clipboard compiled in: $ vimx --version | grep xterm_clipboard +eval +mouse_dec +startuptime +xterm_clipboard vimx is in the vim-X11 package, which also contains gvim. Use ...


0

I have found autoclose adding a bit of lag, and also interfering with my setup (Ultisnips and Supertab), but I like its approach of emulating Eclipse CDT. I use delimitMate with the following maps to help with the navigation and indentation, trying to get the same results: imap <C-F> <C-G>g " To jump out brackets in same line. ...


1

Yes, you can have that same auto code completion for C++ feature. Both Gedit and Vim have facilities for extension through plug-ins. This allows you to write the completion, so you can have that feature in either of them. You might want to spent some time looking if someone has not already done so.



Top 50 recent answers are included