Tag Info

New answers tagged

1

It appears vimtex adds its own custom highlighting. I turned off the background for these: highlight texMathMatcher ctermbg=none highlight texMathZoneX ctermbg=none highlight texRefLabel ctermbg=none highlight texStatement ctermbg=none Feel free to let me know if there is a more elegant solution.


0

If the newly installed vim is your current vim: echo `which vim`


0

I got this error on every exit. I did not use sudo. It explicitly mentioned my user home directory: E138: Can't write viminfo file /Users/henrik/.viminfo! Removing ~/.viminfo did not fix the error. Turns out I had a bunch of viminfo temp files, and removing those fixed the issue: ls ~/.viminf* # If you want to see the files. rm -rf ~/.viminf* # ...


0

I use ranger too, and vim. Try export EDITOR=vim ranger then try out E option to open an editor for the file. If it worked, then the changes are not working for you for either of the two reasons. You forgot to source .bashrc after editing it with export EDITOR-vim change. You might be using another shell For scenario one, just do a source ~/.bashrc ...


0

The code doesn't set any value to an empty status string, but simply acts using some defaults. See src/screen.c, function win_redr_status(). The items shown are based on features compiled in, therefore to reconstruct the exact statusline one would need to look at the features compiled in. It might be simpler to use the example statusline given in :h ...


0

I'd guess that for one or the other you would have a ~/.vimother instead of the usual ~/.vimrc and then launch that one or the other via $vim -u ~/.vimother possibly via a shell alias or function. That would keep the vim stuff separate from the neovim stuff.


0

You can use tmux -2 to solve this issue.


1

I did itusing a bit of a hackier way: Using tcsh I put the following in my .cshrc # escape sequence to set the screen title alias stitle 'echo -n "^[k\!*^[\\"' # shorthand to set the screen title to the hostname alias H stitle `hostname -s` # shorthand to set the screen title to the filename, launch vim, and then set it back alias ...


0

After adding the line below into .tmux.conf set -g default-terminal "screen-256color" You still need to add the line below into .vimrc set term=screen-256color Finally, the alias need to be added to .bashrc alias tmux='tmux -2'


0

A solution figured out by myself: :function Echo_to_file(expr_str) : redir => zen_temp | exe a:expr_str | redir END | put=zen_temp :endfunction :call Echo_to_file("function Echo_to_file") function Echo_to_file(expr_str) 1 redir => zen_temp | exe a:expr_str | redir END | put=zen_temp endfunction It works pretty good, though I don't ...


2

The dict attribute is dispensable in this case, because defining and assigning function directly to dictionary implied dict attribute for function, using dict attribute is not necessary anymore. That type of functions are called anonymous-function or numbered-function. In your example, you have defined two ClassZ keys, Change_author_name and ...


0

vim has no syntax like i in L like Python. But you can make syntax shorter with count() instead of index(): :echo count([1, 2, 3], 2) 1 Then you can use: if count(L, i) echo 'i in L' endif A note that count() will be slower than index(), since when it counts all occurrences of i in L, instead of first index like index().


2

In command mode: :put =string(L) string(expr) function convert expr to a String. See :help string() for more details.


2

You can insert CTRL-V somewhere in the abbreviation to avoid the abbreviation occur. After typing :una ma, press Ctrl+v twice, then typ in, your command mode now look like this: :una ma^Vin Press Enter and the abbreviation was gone. It's better if you only define abbreviation in which mode you want to operate. In your case, using iab to make main only ...


0

I've solved this in a better way than my other answer: First of all get the new vim with brew install vim and then do vim --version Make sure it is 7.4+ Note that if you do vi --version you may that vi is at 7.3 Now make vi use that newer vim alias vi=vim and add that alias to your .bash_aliases file (or wherever you put aliases) Finally add ...


10

Just because you ran vi demo.c does not mean a file demo.c was created. It isn't created until you write the buffer to disk for the first time. Simply write the buffer to disk before compiling: :w This is confirmed by the message [No write since last change] you see. This message means the buffer changed (in that you created the buffer called demo.c) ...


0

This alternative option using a : command worked for me: :1,$!pbcopy This is useful for referring to line numbers, etc without having to navigate and highlight the area.


2

I'm sure this is a duplicate but: gg"*yG gg go to the first line "*y start a yank to the system clipboard "register" G move to the end of the file (you will see how many lines were yanked)


4

You must search for <td>n. The escaped version searches for a single isolated word td followed by n. \<word\> pattern is useful for searching words even when they are separated by other stuff than whitespace or appear at the beginning or end of the line. So try: /<td>name=


1

vim regex engine support Bracket Expression, you can defined a class of characters as a sequence of characters enclosed by square brackets [...]: /[+\-*/%(=]/ will match any character from those characters (You need to escape -, which defined a range between characters, to match it literally) To check current line contains any in set of characters: if ...


2

network conditions. To detect if your network conditions are good exit to shell on remote machine and hold any character key. If you see that character flow is unstable or 'hangs' you have network problems. vim does autosave and target disk if NFS or something like that. To detect Either use sar to get data from the past or run vmstat in other ssh session ...


0

Actually, Ultisnips can do it almost perfectly (this may be new). Slightly modifying answers given above, I have good success with inoremap () ()<C-R>=UltiSnips#Anon('($1)$0', '()', 'double parentheses', 'i')<CR> One has to type () which find better but that can be changed to ( as well. Then, the additional optional arguments to UltiSnips#Anon ...


1

Type :w !xsel -b to copy the visual selection. When you press : while the visual selection is active, this inserts a range that designates the visual selection, so you'll end up executing :'<,'>w !xsel -b. This copies all lines that are partially or completely selected, i.e. line where the selection starts and the line where the selection ends are ...


0

I had this problem a long time ago with broken characters, which were not displayed correctly. I think I had edited a file under both Unix and Windows and afterwards characters with different encodings showed up in the file. Things you could try: If your document is supposed to only contain ASCII characters, you could remove every other character (and ...


1

You can surround it by quotes to stop vim from calculating the result echo '-1 -1'


2

If the extra :w<enter> is the only insertion in that place I use ESC + u (undo). If not it's just as long as yours but depending on personal preferences/habits it might be faster: ESC + up arrow + J (join) + left arrow + left arrow + x + x (delete current char). Technically the longer sequence can be saved as a macro and then invoked with just ESC + ...


2

C-o u C-o: normal state for one command u: undo Note: this might undo more than you want depending on how much you changed.


1

With set backspace=2, you should be able to just press Backspace three times.


0

I preferred the answer from http://superuser.com/questions/138748/how-to-scroll-up-and-look-at-data-in-gnu-screen#177407: Add the following to your ~/.screenrc: termcapinfo xterm ti@:te@ termcapinfo xterm-color ti@:te@ Scrolling back feels a bit weird because it seems to scroll all windows at once and screen disappears completely if you go back too ...


0

Unfortunately, I can't add a comment yet to Alex Leach's answer so I'm going to include an addendum here for Mac OS X users: Enter Copies the selected text


1

Turns out this is infuriatingly easy: use the "v" command to highlight the text area you want. Immediately press the "!" command, followed by your command. So the sequence is "v" "!"


2

You can still do basically the same thing from visual mode. Once you have the area selected, hit the following1: :'>,'> !tee >(xsel -b) You need to pipe to tee so that the contents of your selected area isn't cleared. 1Adapted from here.



Top 50 recent answers are included