You are not logged in.

#1 2016-12-05 13:48:07

HighSpeedLowV
Member
Registered: 2016-10-19
Posts: 4

[Solved] Setting hi Normal ctermbg=None in .vimrc has no effect

I'm currently using urxvt as my terminal emulator with the following .Xresources:

! My color scheme
! special
URxvt.foreground:   #c5c8c6
URxvt.background:   #1d1f21
URxvt.cursorColor:  #c5c8c6

! black
URxvt.color0:       #1d1f21
URxvt.color8:       #969896

! red
URxvt.color1:       #cc6666
URxvt.color9:       #cc6666

! green
URxvt.color2:       #b5bd68
URxvt.color10:      #b5bd68

! yellow
URxvt.color3:       #f0c674
URxvt.color11:      #f0c674

! blue
URxvt.color4:       #81a2be
URxvt.color12:      #81a2be

! magenta
URxvt.color5:       #b294bb
URxvt.color13:      #b294bb

! cyan
URxvt.color6:       #8abeb7
URxvt.color14:      #8abeb7

! white
URxvt.color7:       #c5c8c6
URxvt.color15:      #ffffff

! Making transparent
URxvt.transparent: true
URxvt.shading: 20

! Improving how fonts look
Xft.dpi: 96
Xft.antialias: true
Xft.autohint: 0
Xft.hinting: true
Xft.hintstyle: hintfull
Xft.lcdfilter: lcddefailt
Xft.rgba: rgb

URxvt.scrollBar: false
URxvt.intensityStyles: false
!URxvt*letterSpace: -1
URxvt.font: xft:Ubuntu Mono derivative Powerline:pixelsize=18

Here is my .vimrc:

" Turning off compatability with vi
set nocompatible

" Make backspace behave in a sane manner.
set backspace=indent,eol,start

" Switch syntax highlighting on
syntax on

" Enable file type detection and do language-dependent indenting.
filetype plugin indent on

" Mapping tabnext and tabprev to F8 and F7
map <F7> :tabp <CR>
map <F8> :tabn <CR>

" Increasing the number of lines that can be yanked
set viminfo+=<500

" Mapping paste mode to F2
set pastetoggle=<F2>

" Setting tabs
set tabstop=2
set shiftwidth=2
set expandtab
set softtabstop=0

" Shortening message size
set shortmess=at

" Turning on relative numbering
set number
set relativenumber

" Turning on file-type based indentation
filetype plugin indent on

" Showing the cursorline
set cursorline

" This is so that the file is opened back to the same line as before
if has("autocmd")
  au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
    \| exe "normal! g'\"" | endif
endif

" Some file associations
au BufNewFile,BufRead *.glf setlocal ft=tcl
au BufNewFile,BufRead *.fun setlocal ft=fortran

" Setup for airline
set laststatus=2
let g:airline_powerline_fonts=1
let g:Powerline_symbols='unicode'

" Don't show separators in airline
"let g:airline_left_sep=''
"let g:airline_right_sep=''

" Allowing fortran free source
let fortran_free_source=1

"--------------------------------------------------
" This is for working at night
"--------------------------------------------------

set background=dark
colorscheme base16-default-dark
"colorscheme jellybeans
"colorscheme lucius
"LuciusDark

"--------------------------------------------------
" Day
"--------------------------------------------------

"set background=light
"colorscheme lucius
"LuciusLight
"let g:airline_theme = 'pencil'

hi Normal ctermbg=None
"hi Normal ctermbg=0 cterm=NONE

I'm trying to get vim to be transparent, but setting

hi Normal ctermbg=None

has no effect.  However, if I open vim and type

:hi Normal ctermbg=None

it works perfectly.  This has been driving me nuts.  I've spent a few hours searching around for a solution.  Some say that this highlight command should come at the end of your vimrc, after you have set the colorscheme.  Others said it should come earlier.  I've tried all of the above and none are working.  Any thoughts or advice would be greatly appreciated.

Last edited by HighSpeedLowV (2016-12-05 15:29:30)

Offline

#2 2016-12-05 14:50:33

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,523
Website

Re: [Solved] Setting hi Normal ctermbg=None in .vimrc has no effect

http://stackoverflow.com/questions/2738 … d-ordering

If you really want to try make your approach work, you highlighting command would have to be under your ~/.vim/after/ directory.

But why not just modify the color scheme file?


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2016-12-05 15:29:02

HighSpeedLowV
Member
Registered: 2016-10-19
Posts: 4

Re: [Solved] Setting hi Normal ctermbg=None in .vimrc has no effect

Good point.  I wasn't aware that the plugins were loaded after the vimrc.  I tried to modify the base16-default-dark colorscheme yesterday, but the syntax wasn't clear to me and I thought this simple fix should work.  The line I want is 115 in base16-default-dark.vim:

call <sid>hi("Normal",        s:gui05, s:gui00, s:cterm05, s:cterm00, "", "")

I tried some different things, all wrong.  Your suggestion about putting the command in ~/.vim/after does what I wanted.  Specifically, I created the following file ~/.vim/after/plugin/transparent.vim whose contents were

highlight Normal ctermbg=None

  Thanks for your help.

Offline

Board footer

Powered by FluxBB