• Stars
    star
    146
  • Rank 252,769 (Top 5 %)
  • Language
    Vim Script
  • Created almost 9 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Remove all background color on Vim

Vim transparent

If you love transparent term, but your favourite vim color scheme doesn't

Screenshots

Without vim-transparent (example color scheme is PaperColor)

papercolor without transparent

With vim-transparent

papercolor with transparent

Installation

I recommend to use Vim-Plug to manage plugins.

Plug 'tribela/vim-transparent'

Configuration

Advanced configuration

The bad thing is something in vim may be not transparent, if you use vim plugins. You can use :filter /<pattern>/ hi to find the highlight groups e.g. :filter /CocList/ hi, and change it.

For example, I use these plugins, coc.nvim, lightline, rnvimr, fzf.vim, vim-deus.

Plug 'tribela/vim-transparent'

" default
let g:transparent_groups = ['Normal', 'Comment', 'Constant', 'Special', 'Identifier',
                            \ 'Statement', 'PreProc', 'Type', 'Underlined', 'Todo', 'String',
                            \ 'Function', 'Conditional', 'Repeat', 'Operator', 'Structure',
                            \ 'LineNr', 'NonText', 'SignColumn', 'CursorLineNr', 'EndOfBuffer']

" Pmenu
let g:transparent_groups += ['Pmenu']

" coc.nvim
let g:transparent_groups += ['NormalFloat', 'CocFloating']

augroup transparent
    autocmd VimEnter,ColorScheme * call MyTransparent()
augroup END

function! MyTransparent()
    " Customize the highlight groups for transparency in here.

    " CursorLine
    "hi CursorLine ctermfg=NONE ctermbg=239 guibg=NONE guibg=#4e4e4e

    " coc.nvim
    "hi CocMenuSel ctermbg=239 guibg=#4e4e4e
endfunction

vim-deus configs:

set t_Co=256
set termguicolors

let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"

" Add `let s:ds.none = ['NONE', 'NONE']` to deus.vim.
let g:deus_sign_column = 'none'

"set background=dark    " Setting dark mode
colorscheme deus
let g:deus_termcolors=256

Because of let g:transparent_groups += ['NormalFloat', 'CocFloating'], floating windows are transparent. So add borders for those transparent floating windows. Input :CocConfig to open the coc-settings.json, and add the blew:

    // `:h coc-config-float`
    "suggest.floatConfig": {
        "border": true
    },
    "diagnostic.floatConfig": {
        "border": true
    },
    "signature.floatConfig": {
        "border": true
    },
    "hover.floatConfig": {
        "border": true
    },

Make lightline transparent:

autocmd VimEnter * call SetupLightlineColors()
function SetupLightlineColors() abort
  " transparent background in statusbar
  let l:palette = lightline#palette()

  " `let s:p.{mode}.{where} = [ [ {guifg}, {guibg}, {ctermfg}, {ctermbg} ], ... ]`
  let l:palette.normal = {
          \ 'left': [[ '#008080', 'NONE', 6, 'NONE' ]],
          \ 'middle': [[ '#008080', 'NONE', 6, 'NONE' ]],
          \ 'right': [[ '#008080', 'NONE', 6, 'NONE' ]],
        \ }
  let l:palette.inactive = l:palette.normal
  let l:palette.visual = l:palette.normal
  let l:palette.insert = l:palette.normal
  let l:palette.replace = l:palette.normal
  let l:palette.tabline = {
          \ 'left': [[ '#0000ff', 'NONE', 12, 'NONE' ]],
          \ 'tabsel': [[ '#008080', 'NONE', 6, 'NONE' ]],
          \ 'middle': [[ 'NONE', 'NONE', 'NONE', 'NONE' ]],
          \ 'right': [[ 'NONE', 'NONE', 'NONE', 'NONE' ]],
        \ }

  call lightline#colorscheme()
endfunction

" Comment out the `colorscheme`.
let g:lightline = {
      "\ 'colorscheme': 'deus',
      \ }

Rnvimr:

" Rnvimr background
":hi RnvimrNormal
" show draw border
let g:rnvimr_draw_border = 1

fzf.vim:

":echo g:fzf_colors
" transparent the gutter
let $FZF_DEFAULT_OPTS=$FZF_DEFAULT_OPTS .. ' --color=gutter:-1'

Images

lightline and vim-deus:

coc.nvim floating windows:

coc.nvim CocList:

Rnvimr:

Pmenu:

Usage

vim-transparent automatically transparent all of highlight settings.

You can disable it by :TransparentDisable and re-enable it by :TransparentEnable

More Repositories

1

image-cleaner

Remove duplicated images from a path
Python
23
star
2

tbraille

Figlet/Toilet like CLI tool with braille characters
Python
15
star
3

terminalize

a javascript library to terminalize your site.
JavaScript
10
star
4

autotweet

learn your response pattern from twitter
Python
7
star
5

transparent.nvim

Transprent vim backgrounds
Lua
5
star
6

need-nya

Python
5
star
7

cf-patch-doh

DOH server that patches CF's IP to forcefully use ICN region
Python
5
star
8

upbit-parody

Warning to coin market to use EV cert
HTML
3
star
9

ElefantoRadio

Rebirth of Bluebird Radio on Mastodon!
Kotlin
3
star
10

Apagando

๐Ÿ’กยกApagando las luces!
Python
2
star
11

antiweb

Web breaker to resist "anti" linux websites
JavaScript
2
star
12

steemfeed

Atom feed generator for Steemit blog
Python
2
star
13

sdnjammer

Simple jammer for sdn controller
Python
1
star
14

whistle

Whistle to control home
Python
1
star
15

tribela

1
star
16

pybench

Openflow controller benchmarking tool written in Python
Python
1
star
17

elm-fibonacci

Example elm app that produce fibonacci sequence
Elm
1
star
18

bluebirdradio

Bluebird Radio for android.
Java
1
star
19

gitlab-ci-pipeline-queue

Lock gitlab ci pipeline until older pipeline finished
Python
1
star
20

kmastodon-status

Korean mastodon(+fediverse) registration status
Python
1
star
21

yeelight

Yeelight control
Python
1
star
22

parfait.day

Parfait.day mastodon server
Ruby
1
star
23

dokku-updater

Deploy new docker image to dokku git:from-image
Python
1
star
24

mastodon-admin-hook

Python
1
star
25

tribela.github.io

HTML
1
star
26

karaokebook

Karaoke song number finder.
Java
1
star
27

showimg

Show image on 256-coloured terminal
Python
1
star
28

mah-2024-02

Mastodon admin webhook for 2024-02 kuroneko spam
Python
1
star
29

bemusic

Python BMS parse
Python
1
star
30

tweetdeck-open-media

Press "o" to open media
JavaScript
1
star