Monday, September 19, 2016

vim (gVim 8.0+ on Windows) configuration notes and settings

1. In Windows, drag and drop OLE (:drop) functionality will be disabled if the program is launched as an Administrator. So remember to NOT set launch as administrator in the app's properties dialog box so drag and drop will continue to work. This also allows the right click context menu to work for 'edit with vim' and 'edit with vim (existing)' commands to open files properly. Windows won't allow drag and dropped files to escalated programs or at least it didn't work with vim.

2. As a side effect of #1, not launching as admin, means the program might not have write rights to the vimrc config file (c:\Program Files (x86)\Vim\_vimrc) so even doing :w! didn't work. E212 Can't open file for writing was the error.

Also,
cmap w!! w !sudo tee % >/dev/nul
didn't work. What DID work was going to the _vimrc file in Windows file properties security dialog and change the file permissions to allow users full access.

3. colorscheme (filename without .vim) only read from c:\Program File (x86)\Vim\Vimfiles\colors and not the default %HOME%\vimfiles\colors folder. Solution: copy the filename.vim to the program files folder.

4. Airline not showing patched font properly. Out of the prepatched fonts available the OTF fonts didn't seem to work. One font that did work that I like is Inconsolata-g.

set guifont=Inconsolata-g_for_Powerline:h11

with
set guioptions-=e "guitabs off

and
let g:airline#extensions#tabline#enabled = 1
let g:airline_powerline_fonts = 1

turned on it worked fine. I had to make sure the following WASN'T set as this killed the special symbols.

"if !exists('g:airline_symbols')
"  let g:airline_symbols = {}
"endif
" unicode symbols
"let g:airline_left_sep = '»'
"let g:airline_left_sep = '▶'
"let g:airline_right_sep = '«'
"let g:airline_right_sep = '◀'
"let g:airline_symbols.linenr = '␊'
"let g:airline_symbols.linenr = '␤'
"let g:airline_symbols.linenr = '¶'
"let g:airline_symbols.branch = '⎇'
"let g:airline_symbols.paste = 'ρ'
"let g:airline_symbols.paste = 'Þ'
"let g:airline_symbols.paste = '∥'
"let g:airline_symbols.whitespace = 'Ξ'

and to have it show properly with airline updating the status line and tab line upon starting gvim:

autocmd VimEnter * silent AirlineRefresh | wincmd p | wincmd p

That seemed to fix it to get working right at startup.


No comments:

Post a Comment