Hot answers tagged

6

Try: :g/^G1 Z/s/F1800/F500/g The :g is the "global" command. It selects lines with a regular expression and then executes a command on it. Here it selects lines that start with G1 Z and then substitutes all "F1800" with "F500" in this line. BTW: The default command for :g is print. So by just executing :g/^G1 Z/ Vim will print all lines that start with ...


6

To quote the help: *gf* *E446* *E447* [count]gf Edit the file whose name is under or after the cursor. Mnemonic: "goto file". Uses the 'isfname' option to find out which characters are supposed to be in a file name. Trailing punctuation characters ".,:;!" are ignored. Escaped ...


5

I believe that it's not Vim that you can't fullscreen: Vim in terminal mode runs in a terminal emulator. On Windows I think you can't make the console go full screen so this is absolutely not related to Vim. However if you want to remove the menu bar from gVim you can read :h 'guioptions' and you'll find out that you can add this line to your .vimrc (or ...


5

I screwed up slightly on which :verbose map to use. Since it's while editing, and the relevant mapping is imap or inoremap, :verbose imap/:verbose map! would be the right command. In this case, the reason I had such weird behavior is because of the function it's mapped to. It calls a function in a parentheses auto-completion/utility library, and ...


4

Use remap to trigger expansion imap "prg prg<c-a> or exe printf('imap "prg prg%s', g:UltiSnipsExpandTrigger) But not this: imap <expr> "prg 'prg' . g:UltiSnipsExpandTrigger g:UltiSnipsExpandTrigger is a variable, map won't figure out special key code of it's value for you. Manual expansion inoremap "prg prg<c-r>=UltiSnips#...


3

So it looks like if no guifont is specified in your vimrc, gVim will use some built in default font and it would not be reflected in guifont -- set guifont is empty. But it turns out it is possible to change the size of your default font -- use guifont without name, just size: set guifont=:h10 set guifont=:h16 ... whatever your default bitmap font supports


3

You can use \%c to match a column in a substitution: :%s/\%131c.*// For more help see: :h /\%c


3

Got an answer on the vim_use Google group. It came down to priorities, and which vimrc is being used. For MacVim, there's a .gvimrc as well as a .vimrc file, and the .gvimrc file was overriding the .vimrc settings. Once I copied the .vimrc file to .gvimrc with the following changes in particular, I got the same view: set tabstop=4 softtabstop=0 expandtab ...


3

In this case the double quote " starts a comment. After removing the comment you have: set rtp+= While double (or single) quotes are normally used to enclose strings, the syntax for setting options is different. The set command predates Vim and was available in the original Vi. PS: You can use forward slashes for runtimepath.


3

I was actually able to update gvim to 8.1 on Ubuntu 18 by following the same as this question asked in the past about older versions: https://askubuntu.com/questions/875003/ubuntu-16-10-repository-providing-vim-8 Basically, I followed the first option pointed by that answer: sudo add-apt-repository ppa:jonathonf/vim sudo apt update sudo apt install vim ...


2

What does "mapping" mean in this case, and what are the advantages between the two approaches? It means that when you press Q, vim reacts as if you had typed gqip. The advantage of this is that you can create whatever keyboard shortcuts you like and use vim the way that feels most naturally to you. Is it possible to change gggqG to gqG or ggq and if so ...


2

I don't have a Linux machine with graphical interface here to test it, but I'd say the correct syntax for that line would be something like: set guifont=Ubuntu\ Mono\ 15


2

Displaying ^I for tab is the default Vi behavior. You could set the list character for tab to a spaces: set listchars=nbsp:×,tab:\ \ ,trail:\ , set list Note that I have added a definition for trailing spaces (to be displayed as spaces). Without it, the nbsp is not displayed. Alternative: Use Syntax highlighting Just add the following to your vimrc: ...


2

I'm afraid there's no solution for that: vim (or even Python) can't detect the end of the function if you don't change the indentation (besides the return 42). The comment on first column may seem strange but is not enough to tell Python that your function has ended: def test(): """comment""" print("on test") # comment print("still on test") ...


2

You are doing this in GVim and this only provides a terminal with limited capabilities. The command echo $TERM returns "dumb". Might be your zsh /oh-my-zsh setup can't handle this. It works for me (with bash) as my bash setups checks for terminal capabilities before configuring a colored PS1 or configuring colored output for ls or grep. Vim 8.0.1609 ...


2

In your ALEInfo output, it shows that ALE is using the variables from your latex autogroup. (Line 38: let b:ale_fixers = ['latexindent', 'remove_trailing_lines', 'trim_whitespace']) Each of your autogroups are being loaded and b:ale_fixers is being overridden each time. You could add something like the following to each of your augroups: au FileType *.py ...


2

The syntax files define regions of code and links them to highlight groups, which in turn are colored by the colorscheme. So, if you want to keep your colorscheme for more than just ui elements (status/tabline, etc.), you’ll need to syntax enable. That said, there are a few ways to improve the speed of syntax highlighting. See this very detailed QA further ...


2

The following command uses look behind regex pattern: :%s/\v(^G1 Z.*)@<=F1800/F500/g %s starts the substitution in the whole file. / starts the find part of the find and replace. \v enables very-magic (see :h /magic) (^G1 Z.*)@<= looks behind for lines starting with G1 Z. But it doesn't start the matching. (see :h /\@<=) F1800 starts matching for, ...


2

Use :execute to assemble a command from a string, which allows you to include the contents of a variable or return value from a function. This should work: function! WinRight() let ypos=getwinposy() execute "winpos 1241 ".ypos endfunction Or even: function! WinRight() execute "winpos 1241 ".getwinposy() endfunction


2

I rarely ever run :Gpush on its own, so maybe try this: :Gstatus in the new split view, use - to toggle which changes you want to stage for the commit, then use cc to commit. After entering the commit message and save/quit, the split window shows unpushed commits; you can use - to push individual commits. The exact push line and parameters are shown in ...


2

If it is indeed a single character, it’s likely to be <C-\>. You can use ga to get the ascii, octal, etc., versions. For grep(1), most shells (my bash, at least) will let you input literals with <C-v> much like vim.


2

File Separator, code point 28, or 0x1C, originally used to delimit data structures. If you cannot type it with Ctrl+\, you can use alt codes if you have a number pad on your keyboard. Type Alt+28 and you should get something that looks like this: ∟ You must use your number pad, the keys above the letter keys will not work. If your keyboard doesn't have a ...


2

I don't think --remote is the issue here. I can reproduce what you observed with a normal vim instance and the args command (e.g. args a.c a.h b.h b.c then args will show he two .h files at the end). I went through the code a bit last night (disclaimer: it's been years since I used C with any regularity) and it looks like expand_wildcards() followed by ...


2

It's not perfect since you have to run it multiple times to get every slash, but that's not too big of a problem: :%s/(.*\zs\/\ze.*)/./g This will replace one slash inside of parenthesis with a dot. To get it to replace all of them, you could then run something like 5@: to get all of them replaced. (Adjust 5 to be as big as needed).


2

Another way is to use a sub-replace-expression, \=: :%s/([^)]*)/\=substitute(submatch(0),'\/','.','g')/ The :s/([^)]*)/{replacement}/ will match a pair of parens, ([^)]*). The {replacement} is \={expr}. Where {expr} will be a vimscript expression to be evaluated. In this case a substitution over the entire match, submatch(0), matching on \/ and replacing ...


2

This is a known problem and has been discussed a couple of times in the past. Unfortunately, Vim is not really good suited to the specifics of indic fonts and therefore in the current implementation displays them a bit garbled. Having said that, a PR implementing proper support would certainly be appreciated. See those threads on the mailinglist: https://...


2

If there really isn't a simple query to find the information then we'll have to brute-force it... Two key behaviors are described in :h 'guifonts': [If a list of fonts is given] the first valid font is used. and [If a single font is given and] the font cannot be found you will get an error message. That suggests something like this function: func! ...


1

I found a workaround. Manually copying the entire vim-airline tree under the $HOME/vimfiles/pack/plugins/start/ did the trick, as the vim-airline plugin was then able to be loaded at startup. For some reason, simply installing vim-airline via Vundle doesn't make it able to be loaded on startup on both of my setups, unlike other packages. Update: I also ...


1

Since the OP is dealing directly with manpages, I suggest :runtime plugin/man.vim (Which can be put in startup files), followed by :Man command Also see help MANPAGER


1

according to :h gui-colors You can also specify a color by its Red, Green and Blue values. The format is "#rrggbb", where "rr" is the Red value "gg" is the Green value "bb" is the Blue value All values are hexadecimal, range from "00" to "ff". Examples: > :highlight Comment guifg=#11f0c3 guibg=#ff00ff You ...


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