GithubHelp home page GithubHelp logo

vim-transparent's Introduction

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

vim-transparent's People

Contributors

amjad50 avatar djdv avatar tribela avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.