Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Extensible Neovim Scrollbar

License

NotificationsYou must be signed in to change notification settings

petertriho/nvim-scrollbar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

89 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Extensible Neovim Scrollbar

diagnostics

Features

Requirements

Installation

vim-plug

Plug'petertriho/nvim-scrollbar'

packer.nvim

use("petertriho/nvim-scrollbar")

Setup

require("scrollbar").setup()
Search

search

Setup (Packer)

use {"kevinhwang91/nvim-hlslens",config=function()-- require('hlslens').setup() is not requiredrequire("scrollbar.handlers.search").setup({-- hlslens config overrides    })end,}

OR

use {"kevinhwang91/nvim-hlslens",config=function()require("hlslens").setup({build_position_cb=function(plist,_,_,_)require("scrollbar.handlers.search").handler.show(plist.start_pos)end,    })vim.cmd([[        augroup scrollbar_search_hide            autocmd!            autocmd CmdlineLeave : lua require('scrollbar.handlers.search').handler.hide()        augroup END]])end,}

If you want to leave only search marks and disable virtual text:

require("scrollbar.handlers.search").setup({override_lens=function()end,})
Git Signs
Peek.2022-11-11.12-24.gitsigns.sidebar.mp4

Display git changes in the sidebar. Requiresgitsigns.nvim to be installed.

Setup (Packer)

use {"lewis6991/gitsigns.nvim",config=function()require('gitsigns').setup()require("scrollbar.handlers.gitsigns").setup()end}

Config

Defaults
require("scrollbar").setup({show=true,show_in_active_only=false,set_highlights=true,folds=1000,-- handle folds, set to number to disable folds if no. of lines in buffer exceeds thismax_lines=false,-- disables if no. of lines in buffer exceeds thishide_if_all_visible=false,-- Hides everything if all lines are visiblethrottle_ms=100,handle= {text="",blend=30,-- Integer between 0 and 100. 0 for fully opaque and 100 to full transparent. Defaults to 30.color=nil,color_nr=nil,-- ctermhighlight="CursorColumn",hide_if_all_visible=true,-- Hides handle if all lines are visible    },marks= {Cursor= {text="",priority=0,gui=nil,color=nil,cterm=nil,color_nr=nil,-- ctermhighlight="Normal",        },Search= {text= {"-","="},priority=1,gui=nil,color=nil,cterm=nil,color_nr=nil,-- ctermhighlight="Search",        },Error= {text= {"-","="},priority=2,gui=nil,color=nil,cterm=nil,color_nr=nil,-- ctermhighlight="DiagnosticVirtualTextError",        },Warn= {text= {"-","="},priority=3,gui=nil,color=nil,cterm=nil,color_nr=nil,-- ctermhighlight="DiagnosticVirtualTextWarn",        },Info= {text= {"-","="},priority=4,gui=nil,color=nil,cterm=nil,color_nr=nil,-- ctermhighlight="DiagnosticVirtualTextInfo",        },Hint= {text= {"-","="},priority=5,gui=nil,color=nil,cterm=nil,color_nr=nil,-- ctermhighlight="DiagnosticVirtualTextHint",        },Misc= {text= {"-","="},priority=6,gui=nil,color=nil,cterm=nil,color_nr=nil,-- ctermhighlight="Normal",        },GitAdd= {text="",priority=7,gui=nil,color=nil,cterm=nil,color_nr=nil,-- ctermhighlight="GitSignsAdd",        },GitChange= {text="",priority=7,gui=nil,color=nil,cterm=nil,color_nr=nil,-- ctermhighlight="GitSignsChange",        },GitDelete= {text="",priority=7,gui=nil,color=nil,cterm=nil,color_nr=nil,-- ctermhighlight="GitSignsDelete",        },    },excluded_buftypes= {"terminal",    },excluded_filetypes= {"blink-cmp-menu","dropbar_menu","dropbar_menu_fzf","DressingInput","cmp_docs","cmp_menu","noice","prompt","TelescopePrompt",    },autocmd= {render= {"BufWinEnter","TabEnter","TermEnter","WinEnter","CmdwinLeave","TextChanged","VimResized","WinScrolled",        },clear= {"BufWinLeave","TabLeave","TermLeave","WinLeave",        },    },handlers= {cursor=true,diagnostic=true,gitsigns=false,-- Requires gitsignshandle=true,search=false,-- Requires hlslensale=false,-- Requires ALE    },})

Colors/Highlights

Color takes precedence over highlight i.e. if color is defined, that will beused to define the highlight instead of highlight.

Mark type highlights are in the format ofScrollbar<MarkType> andScrollbar<MarkType>Handle. If you wish to define these yourself, addset_highlights = false to the setup.

  • ScrollbarHandle
  • ScrollbarCursorHandle
  • ScrollbarCursor
  • ScrollbarSearchHandle
  • ScrollbarSearch
  • ScrollbarErrorHandle
  • ScrollbarError
  • ScrollbarWarnHandle
  • ScrollbarWarn
  • ScrollbarInfoHandle
  • ScrollbarInfo
  • ScrollbarHintHandle
  • ScrollbarHint
  • ScrollbarMiscHandle
  • ScrollbarMisc
  • ScrollbarGitAdd
  • ScrollbarGitAddHandle
  • ScrollbarGitChange
  • ScrollbarGitChangeHandle
  • ScrollbarGitDelete
  • ScrollbarGitDeleteHandle

Example config withtokyonight.nvim colors

localcolors=require("tokyonight.colors").setup()require("scrollbar").setup({handle= {color=colors.bg_highlight,    },marks= {Search= {color=colors.orange },Error= {color=colors.error },Warn= {color=colors.warning },Info= {color=colors.info },Hint= {color=colors.hint },Misc= {color=colors.purple },    }})

Custom Handlers

One can define custom handlers consisting of a name and a lua function that returns a list of marks as follows:

require("scrollbar.handlers").register(name,handler_function)

handler_function receives the buffer number as argument and must return a list of tables withline,text,type, andlevel keys. Only theline key is required.

KeyDescription
lineThe line number.Required.
textMarker text. Defaults to global settings depending ontype.
typeThe marker type. Default isMisc.
levelMarker level. Default is1.

E.g. the following marks the first three lines in every buffer.

require("scrollbar.handlers").register("my_marks",function(bufnr)return {        {line=0 },        {line=1,text="x",type="Warn"},        {line=2,type="Error"}    }end)

Acknowledgements

License

MIT

About

Extensible Neovim Scrollbar

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors17

Languages


[8]ページ先頭

©2009-2025 Movatter.jp