New answers tagged

0

Anthony's answer is straight to the point. However, you can also use ggvG to highlight the entire file. The gg moves at the beginning and vG highlights until the end of the file.


2

The simplest way to format the whole file would be to run: gggqG The gg moves to the start of the file and the gqG formats all the lines between the current position and the last line of the file (G). However, this can result in some lines (not separated by an empty line) being treated as belonging to the same paragraph and being joined to each other, ...


0

I know the question was posted almost six years ago, but for anyone else who in the future might land here while trying to figure out how to get vim into every aspect of their lives, I recommend checking out the wasavi extension. Essentially, Ctrl-Enter will start a vi buffer within the textbox your cursor is currently in. Do all your vi magic and hit ZZ and ...


0

I have noticed that the ftplugin vim scripts for many languages can be executed for a single file. For example, a haml file can have embedded coffeescript, css etc. and I'm guessing that since the haml syntax for vim includes embedding those languages, Vim runs the ftplugin scripts for them. For that reason, I've gotten into the habit of wrapping my ...


0

The problem is a feature called "Automatic word wrapping" documented here. To disable the insertion of line breaks when adding text to a line, add "l" to the value of option formatoptions. After doing this, the problem vanished.


0

Edit -> File Settings -> Toggle Line Wrap or :set wrap!


0

I just wanted to add a comment to the accepted answer with the code changes needed to make it work in Yosemite, but since I don't have sufficient reputation couldn't add a comment, and hence attempting to reply via an answer. The "Open File in Terminal from Finder" script was working fine in Mavericks, but it stopped working after the upgrade to Yosemite. ...


0

In my custom VIM syntax file I have: syntax region MyString start="'" end="'" highlight link MyString String Maybe that will work for you?


0

The quote character used for comments is " (ASCII value 0x22 -- quotation mark), but you are using a character that looks similar, but is not the same: ” (Unicode value 0x201d -- right double quotation mark) Replace the character and it will work.


1

In a terminal, control@ and controlspace are almost always the same: the control modifier tells the terminal to strip off bits above the low-order 5. The code for @ is 0x40, and that for space is 0x20. The low-order bits would be 0x1f — and those bits are zero in @ and space. So both produce an ASCII NUL (0).


0

You are using zsh in the vi mode. To solve your problem we divide the problem in two parts 1. part - print command history lines matching a pattern For this we create a file ~/bin/history-print-regexp.sh containing: #!/bin/zsh # command 'regular-expression' number-of-lines(counting from the end of the file) nmbr=15 if [ "$#" -eq 2 ]; then nmbr=$2 fi ...


0

This is also reported over on github. Putting the following line in your .tmux.conf file solves the issue until libvte is updated. set-option -g terminal-overrides ',xterm*:Cr=\E]12;gray\007'


5

Stack Overflow and other Stack Exchange sites, like many other websites with embedded editors, bind various keyboard chords to editing commands. These are sometimes called access keys (if you want to do a web search) and are bound when the page is loaded. In your case, Vimperator's default keymap for editing a HTML text area in an external editor, Ctrl-i, is ...


0

In 'quick-and-dirty' scripts, the solution is often to insert the literal character into the file. In this case you would type control+v followed by the return key, to insert a character looks like an ^L but you can tell it isn't caret-ell because the cursor moves across it as one character. Characters entered into the file this way do not tend to survive ...


0

You can also use the vim-layout script that uses the -o, -c arguments automatically and supports different layouts. To get the output you wanted you would simply run: vl <the three files> Disclaimer: I wrote the script.


1

See :help i_CTRL-V_digit. You need to start the sequence with an upper-case U, because the cat emoji is outside the basic multilingual plane (the codepoints from U+0000 to U+FFFF).


2

Ah, lord, somebody in #vim on Freenode helped me out: that line going around is bugged, because ; doesn't mean subsequent-command in Vim. The following works as intended: mvim --remote-silent +":%line | silent foldo!" "%file"


0

Wrapping is controlled by the 'textwidth' option. :help 'textwidth' shows that it's local to buffer, so different values can be set, for example manually via :setlocal textwidth=50 To make this automatically apply to all Ruby files, you can use Vim's built-in filetype detection and filetype plugins. Put the above command into ...


1

IntelliJ has nice Vim plugin, and it supports vimrc. Ofc it's not 100% compatible but like 85-90% which is greater. IDE itself is not free but you can use development version which is pretty stable https://www.jetbrains.com/idea/ The other nice solution as @romainl mention is Eclim http://eclim.org/ It gives you IDE power in your Vim.


0

You're better off adding filetype plugins to the after section of your user vim runtime directory, and defining your mappings there without using autocmd. For example, in ~/.vim/after/ftplugin/html.vim you would put your HTML mappings, and ~/.vim/after/ftplugin/javascript.vim for JavaScript mappings. However, that won't solve your problem. You need to make ...


0

There is a plugin called vim-lastplace (I am the author) that will open your files where you left off. It improves on the above suggestions by ignoring commit messages because you're typically editing a new message and want to start at the top of the commit message file.


0

Actually, there is a way to do it according to this answer: :args *.c | argdo tabe Works perfectly. It will probably close all your other tabs though. Click here if you want to learn more. When it comes to the weird behaviour of :tab: it turns out that there is a variable tabpagemax which is set to 10 by default. This explains everything. You can find ...


0

The 2016 solution is to use Karabiner open-source program which allows you to remap modifier and other keys with very fine granularity, for example Remap only the left ⌘ Cmd or Option key. Remap a key only for specific applications, e.g. only inside Terminal, Emacs, or virtual machine. For example, here's how to remap left ⌘ Cmd key to act as Ctrl only ...


0

Another benefit of using visudo -f as mentioned in some answers is there is a corresponding option -c or --check that verifies you don't have invalid information in a sudoers.d file or any other file you might want to put in sudoers.d. This is REALLY handy in the cases mentioned with automated tools, as you can run e.g. sudo visudo -c -q -f ...


0

The external executable for :grep is controlled by the 'grepprg' option, and on Windows, this defaults to findstr, as :help 'grepprg' details: For Win32, the default is "findstr /n" if "findstr.exe" can be found, otherwise it's "grep -n". So, just put the following into your ~/.vimrc: set grepprg=grep\ -nH


1

If you do the usual normal mode deletion from the beginning [of the sentence] with [count]dw, your cursor will already be on the new first word. Then, a simple ~ will toggle its case. I think it can't get any simpler than that! Sure, you could write a custom command (but handling the motion like d{motion} isn't trivial to implement), but you'd probably have ...


0

Just install cygwin from cygwin.org! It handles all your unix utilities as exe files and gvim is included. After installing, go to a cygwin shell and cd /cygdrive/c to get to the root of your C:\ drive.


0

Firstly, you can rename it to whatever you want so you don't have to type out gvim.exe. You could call it v.exe if you really wanted, as long as nothing clashes with it. The .exe is entirely optional as well. So you could just call v file.txt. Then you can place it on your machine somewhere and add it's path to the environmental variable PATH, meaning it ...


0

step 1: make install DESTDIR=~/.local (make your local dir if it is not present) step 2: export PATH=$PATH:/remote/users/yourusername/.local/bin


2

Explaining this behaviour Syntax highlighting is meant to modify a colour scheme. The default SAS syntax highlighting is meant to modify a normal colour scheme, like I use, and then it is suitable to show data as blue on white. On a reverse video scheme, like koehler, it is not. When you change your colour scheme to a normal one, vim throws away your ...



Top 50 recent answers are included