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

This plugins prompts the user to pick a window and returns the window id of the picked window

License

NotificationsYou must be signed in to change notification settings

sarmong/nvim-window-picker

 
 

Repository files navigation

hint = 'floating-big-letter'

window-picker-float-demo.mp4

hint = 'statusline-winbar'

window-picker-winbar-demo.mp4

This plugins prompts the user to pick a window and returns the window id of thepicked window.

Install

lazy

{'s1n7ax/nvim-window-picker',name='window-picker',event='VeryLazy',version='2.*',config=function()require'window-picker'.setup()end,}

packer

use {'s1n7ax/nvim-window-picker',tag='v2.*',config=function()require'window-picker'.setup()end,}

How to use

localpicked_window_id=require('window-picker').pick_window()

You can put the picked window id to good use

Configuration

If you want to have custom properties just for one time, you can pass any offollowing directly topick_window() function itself to override the defaultbehaviour.

require'window-picker'.setup({-- type of hints you want to get-- following types are supported-- 'statusline-winbar' | 'floating-big-letter' | 'floating-letter'-- 'statusline-winbar' draw on 'statusline' if possible, if not 'winbar' will be-- 'floating-big-letter' draw big letter on a floating window-- 'floating-letter' draw letter on a floating window-- usedhint='statusline-winbar',-- when you go to window selection mode, status bar will show one of-- following letters on them so you can use that letter to select the windowselection_chars='FJDKSLA;CMRUEIWOQP',-- This section contains picker specific configurationspicker_config= {-- whether should select window by clicking left mouse button on ithandle_mouse_click=false,statusline_winbar_picker= {-- You can change the display string in status bar.-- It supports '%' printf style. Such as `return char .. ': %f'` to display-- buffer file path. See :h 'stl' for details.selection_display=function(char,windowid)return'%='..char..'%='end,-- whether you want to use winbar instead of the statusline-- "always" means to always use winbar,-- "never" means to never use winbar-- "smart" means to use winbar if cmdheight=0 and statusline if cmdheight > 0use_winbar='never',-- "always" | "never" | "smart"        },floating_big_letter= {-- window picker plugin provides bunch of big letter fonts-- fonts will be lazy loaded as they are being requested-- additionally, user can pass in a table of fonts in to font-- property to use insteadfont='ansi-shadow',-- ansi-shadow |        },    },-- whether to show 'Pick window:' promptshow_prompt=true,-- prompt message to show to get the user inputprompt_message='Pick window:',-- if you want to manually filter out the windows, pass in a function that-- takes two parameters. You should return window ids that should be-- included in the selection-- EX:--- function(window_ids, filters)--    -- folder the window_ids--    -- return only the ones you want to include--    return {1000, 1001}-- endfilter_func=nil,-- following filters are only applied when you are using the default filter-- defined by this plugin. If you pass in a function to "filter_func"-- property, you are on your ownfilter_rules= {-- when there is only one window available to pick from, use that window-- without prompting the user to selectautoselect_one=true,-- whether you want to include the window you are currently on to window-- selection or notinclude_current_win=false,-- whether to include windows marked as unfocusableinclude_unfocusable_windows=false,-- filter using buffer optionsbo= {-- if the file type is one of following, the window will be ignoredfiletype= {'NvimTree','neo-tree','notify','snacks_notif'},-- if the file type is one of following, the window will be ignoredbuftype= {'terminal'},        },-- filter using window optionswo= {},-- if the file path contains one of following names, the window-- will be ignoredfile_path_contains= {},-- if the file name contains one of following names, the window will be-- ignoredfile_name_contains= {},    },-- You can pass in the highlight name or a table of content to set as-- highlighthighlights= {enabled=true,statusline= {focused= {fg='#ededed',bg='#e35e4f',bold=true,            },unfocused= {fg='#ededed',bg='#44cc41',bold=true,            },        },winbar= {focused= {fg='#ededed',bg='#e35e4f',bold=true,            },unfocused= {fg='#ededed',bg='#44cc41',bold=true,            },        },    },})
require('window-picker').pick_window({hint='floating-big-letter'})

Theming

If you just want to define the colors using Neovim Highlights, then it's totallypossible. You can set following highlights manually.

  • WindowPickerStatusLine (currently focused window statusline highlights)
  • WindowPickerStatusLineNC (currently unfocused window statusline highlights)
  • WindowPickerWinBar (currently focused window winbar highlights)
  • WindowPickerWinBarNC (currently unfocused window winbar highlights)

Breaking changes in v2.0.0

Before: return value fromselection_display will be wrapped by'%=' and'%=' to fill the empty space of status line or winbar.

After: return value ofselection_display will be passed directly to thestatus line or winbar. This allows all the customizations available fromstatusline syntax. You can check:help statusline for more info.

About

This plugins prompts the user to pick a window and returns the window id of the picked window

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Lua99.9%
  • Vim Script0.1%

[8]ページ先頭

©2009-2025 Movatter.jp