Giter Club home page Giter Club logo

qline.vim's Introduction

qline.vim

The quick, easily-customizable status line plugin written in the cutting-edge Vim9 script.

Demo

Requirement

This plugin supports Vim version 9.0+. This means no supported Vim exists in the world for now. The very latest Vim might make use of this plugin, but it must be a temporary illusion.

This plugin is under development along with Vim9 script, so anything can change. Not for daily use.

Configuration

Every configurations are stored in a dictionary named g:qline_config. Its format is like lightline.vim but with some differences. On loading qline.vim, the dictionary will be "merged" with the default configuration, so you can check g:qline_config to see the current configuration at any time.

The default value is written here.

Click here to show the example configuration (which is part of mine)

Note that some components require followings:

" Define highlight for Git-related components.
highlight Git guibg=#F34F29 guifg=#FFFFFF ctermbg=202 ctermfg=231

" Use :vim9cmd to use Vim9 syntax and compiled lambdas in a legacy Vim script.
vim9cmd g:qline_config = {
# Use the powerline glyphs for separators.
  separator:    {left: "\ue0b0", right: "\ue0b2", margin: ' '},
  subseparator: {left: "\ue0b1", right: "\ue0b3", margin: ' '},
# Specify components in the each sides for active/inactive windows.
# Each modes can also have separate settings.
  active: {
    left: [
      ['mode', 'paste'],
      ['gin_branch', 'gin_traffic', 'filename', 'gitgutter'],
      ['bufstate']
    ],
    right: [
      ['filetype'],
      ['fileinfo'],
      ['%c%-1V', 'searchcount']
    ]
  },
  inactive: {
    left: [['filename', 'gitgutter'], ['bufstate']],
    right: [['filetype'], ['fileinfo']],
    separator: {left: '', right: '', margin: ' '},
    subseparator: {left: '|', right: '|', margin: ' '},
  },
  insert: {
    separator:    {left: "\ue0c0", right: "\ue0c2", margin: ' '},
    subseparator: {left: "\ue0c1", right: "\ue0c3", margin: ' '},
  },
  replace: {
    separator:    {left: "\ue0c0", right: "\ue0c2", margin: ' '},
    subseparator: {left: "\ue0c1", right: "\ue0c3", margin: ' '},
  },
  # Define components. You can overwrite or append to the default definitions.
  # If its content is a Funcref, it is evaluated before parsing the statusline.
  # The component is collapsed when visible_condition results in Falsy, when
  # the content results in empty string, or when the evaluation fails. Funcrefs
  # are evaluated in the context of the window of the drawing status line.
  component: {
    fileinfo: {
      content: () =>
        $'{&fenc ?? &enc} {nerdfont#fileformat#find()}{&bomb ? "\U1f4a3" : ''}',
      visible_condition: () => !&buftype,
    },
    bufstate: {
      content: () =>
        $'{&readonly ? "\uf023" : ''}{&modifiable ? '' : "\uf05e"}{&modified ? "\uf040" : ''}',
    },
    filetype: {
      content: () => nerdfont#find(),
    },
    gin_branch: {
      content: () => substitute(gin#component#branch#ascii(), '^\(\S\+\).*', '\1', ''),
      highlight: 'Git',
    },
    gin_traffic: {
      content: () => gin#component#traffic#unicode(),
      highlight: 'Git',
    },
    gitgutter: {
      content: () =>
        g:GitGutterGetHunkSummary()
          ->mapnew((idx, val) => !val ? '' : ['+', '~', '-'][idx] .. val)
          ->filter((_, val) => !!val)
          ->join(),
      visible_condition: () => g:GitGutterGetHunks(),
    },
  },
}

Colorschemes?

Currently the only default colorscheme is bundled. However, you can import colorschemes from vim-airline and lightline.vim. To import, you need to install those plugins and disable them.

Plug 'Bakudankun/qline.vim'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'itchyny/lightline.vim'

let g:loaded_airline = 1
let g:loaded_lightline = 1

Then you can use their colorschemes by adding colorscheme item to the config:

let g:qline_config.colorscheme = 'airline:cool'

or use :QlineColorscheme to change the colorscheme after startup.

Troubleshooting

qline.vim has been disabled for some reason.

When qline.vim runs into an error, qline.vim may be disabled forcibly by Vim. :call qline#Enable() to re-enable.

qline.vim's People

Contributors

bakudankun avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

greeschenko

qline.vim's Issues

highlight error

I got a error: E716: Key not present in Dictionary: "guibg" when I tried to set highlight, here is my config:

vim9script

highlight Git guibg=#F34F29 guifg=#FFFFFF ctermbg=202 ctermfg=231

g:qline_config = {
  separator:    {left: "\ue0b0", right: "\ue0b2", margin: ' '},
  subseparator: {left: "\ue0b1", right: "\ue0b3", margin: ' '},
  active: {
    left: [
      ['mode', 'paste'],
      ['git_branch', 'filename', 'gitgutter'],
      ['bufstate']
    ],
    right: [
      ['filetype'],
      ['fileinfo'],
      ['%c%-1V', 'searchcount']
    ]
  },
  inactive: {
    left: [['filename', 'gitgutter'], ['bufstate']],
    right: [['filetype'], ['fileinfo']],
    separator: {left: '', right: '', margin: ' '},
    subseparator: {left: '|', right: '|', margin: ' '},
  },
  insert: {
    separator:    {left: "\ue0c0", right: "\ue0c2", margin: ' '},
    subseparator: {left: "\ue0c1", right: "\ue0c3", margin: ' '},
  },
  replace: {
    separator:    {left: "\ue0c0", right: "\ue0c2", margin: ' '},
    subseparator: {left: "\ue0c1", right: "\ue0c3", margin: ' '},
  },
  component: {
    fileinfo: {
      content: () =>
        $'{&fenc ?? &enc} {nerdfont#fileformat#find()}{&bomb ? "\U1f4a3" : ''}',
      visible_condition: () => !&buftype,
    },
    bufstate: {
      content: () =>
        $'{&readonly ? "\uf023" : ''}{&modifiable ? '' : "\uf05e"}{&modified ? "\uf040" : ''}',
    },
    filetype: {
      content: () => nerdfont#find(),
    },
    git_branch: {
      content: () => substitute(g:FugitiveHead(), '^\(\S\+\).*', '\1', ''),
      highlight: 'Git',
    },
    # gin_traffic: {
    #   content: () => gin#component#traffic#unicode(),
    #   highlight: 'Git',
    # },
    gitgutter: {
      content: () =>
        g:GitGutterGetHunkSummary()
          ->mapnew((idx, val) => !val ? '' : ['+', '~', '-'][idx] .. val)
          ->filter((_, val) => !!val)
          ->join(),
      visible_condition: () => g:GitGutterGetHunks(),
    },
  },
}

TODO

  • Move import/* to private/* not to be imported from other plugins?
  • How can I implement %< (truncation) component?
  • Per-tier separator
  • Vim9 may not support :import-ing dynamic paths. Consider another method for colorscheme API
  • Provide config presets that can be imported by g:qline_config.using list
  • tabline
  • Remove mode-specific config in favor of g:qline_config.override list to override config in any conditions

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.