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 ...


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 ...


4

guifg or guibg only works for GUI vim. For terminal version you will need to add other attributes: ctermfg, ctermbg. Type :highlight without any attributes in your vim to show currenly set color settings.


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

has('gui') return True if Vim has a GUI compiled in (regardless of whether you're running the terminal vim or not). A better option is has('gui_running'), which only returns True if the GUI is actually running.


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

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


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


2

By default the cursor is always on a column that contains real text. 1 2 3 4 5 6 7 8 9 1 2 3 4 5 1 2 3 4 5 6 7 8 9 If your cursor is in line 1 on the character '9' and you move down, the cursor "jumps" to the character '5' in the second line. If you move down again, it jumps to the '9' in the third line. Because of this change of the cursor column, the ...


2

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

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 ...


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

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

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

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


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 ...


1

AFAIK, there is no direct way to do that in Vim. Here is a workaround: First of all I have the following mapping in my vimrc (From Vim Tips Wiki, Tip 759): nnoremap <expr> gp '`[' . strpart(getregtype(), 0, 1) . '`]' With this you can visually select the text you have just pasted (or changed). Note that gp is already used by Vim for Just like "...


1

In theory, it's fairly easy. I practice, there are a few gotcha's. Let's walk through this step by step, and I'll tell you what to look for. Once you validate that everything is correct, you ought to be able to do this lickity-split. Note: I use Red Hat/CentOS. You may have to make slight variations in commands for your environment. On "local" make sure ...


1

I tweaked an example which Ralf mentioned in the comments to get this: gvim --server=$SERVER --remote-send ":execute('tab tag $tag')<CR>" Remote send sends the following commands to the gvim server. <CR> is the return character.


1

You can increase the size of any standard console window in Windows, including Vim. Open the system menu by clicking the icon in the upper-left corner of the window (to the left of the window title) or pressing Alt+Space. Select the Properties menu item. In the Properties dialog, select the Layout tab. Adjust the Screen Buffer Size and Window Size. In ...


1

For the gVim part of the answer, there are a few things you can add to your _vimrc. set guioptions -=m will remove the menu bar, and set guioptions -=T will remove the toolbar (below the menu bar). If you're not using these, you may wish to speed up load times by not building the menus: you can add let did_install_default_menus = 1 and let ...


1

See :help vimrc for a detailed understanding of how _vimrcs work: When Vim loads, it invokes _vimrcs in the following steps: $VIM/vimrc The first existing file of $HOME/_vimrc $HOME/vimfiles/_vimrc $VIM/_vimrc $VIM/vimrc is the system-wide config file. $VIM/_vimrc is a user-defined config file used if the two $HOME files above are not defined.


1

One slightly hacky workaround that I’m not entirely satisfied with is to use the space character for listchars tab: execute 'set listchars+=tab: ' (Note that there are 2 spaces; the first character traditionally represents the start of a tab, and the second character is used for the "filler" space.) I use myself a value more like execute 'set listchars+=...


1

Actually, you can set vim as your default editor by setting the path of the GVim in your PATH variable. For setting of GVim in PATH follow these steps. You can set any application as default for you. The only thing you have to do is add the application path to the PATH variable.


1

I can't tell what machine your using, but on my iMac I had the exact same issue and I've finally fixed it. The solution was to go to preferences and uncheck "Use Core Text renderer". I no longer have the issue and as far as I can tell, there hasn't been any adverse affects from doing this.


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