Git Product home page Git Product logo

winbar.nvim's Introduction

Winbar.nvim

winbar2

Reference ChristianChiarulli/nvim

Installation

Note: winbar.nvim requires Neovim nightly

nvim-gps and nvim-web-devicons are optional. nvim-gps for the symbols and web-devicons for file icons.

Packer

use { 'fgheng/winbar.nvim' }

Usage

require('winbar').setup()

Configuration

require('winbar').setup({
    enabled = true,

    show_file_path = true,
    show_symbols = true,

    colors = {
        path = '', -- You can customize colors like #c946fd
        file_name = '',
        symbols = '',
    },

    icons = {
        file_icon_default = '',
        seperator = '>',
        editor_state = '',
        lock_icon = '',
    },

    exclude_filetype = {
        'help',
        'startify',
        'dashboard',
        'packer',
        'neogitstatus',
        'NvimTree',
        'Trouble',
        'alpha',
        'lir',
        'Outline',
        'spectre_panel',
        'toggleterm',
        'qf',
    }
})

Todo

  • Mode support
  • Monitor whether the file is read-only
  • Click support while neovim support click

winbar.nvim's People

Contributors

0xff91 avatar fgheng avatar ttytm 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  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  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  avatar

Watchers

 avatar  avatar  avatar

winbar.nvim's Issues

winbar with color

Hi,

a) I just need a normal winbar without symbols with fullpathname ,
b) I just need to change the color of the winbar.

set winbar=%f%M . It works. But I dont know how to change the color.

I try to use your plugin, but it has lot of spaces between folder names.
Could you help me?

Symbol doesn't work

Report an error

vim.treesitter.query.get_node_text() is deprecated, use vim.treesitter.get_node_text() instead. :help deprecated
stack traceback:
        /usr/share/nvim/runtime/lua/vim/treesitter/query.lua:288: in function 'get_node_text'
        ...im/site/pack/packer/start/nvim-gps/lua/nvim-gps/init.lua:343: in function 'add_node_data'
        ...im/site/pack/packer/start/nvim-gps/lua/nvim-gps/init.lua:375: in function 'get_data'
        ...im/site/pack/packer/start/nvim-gps/lua/nvim-gps/init.lua:421: in function <...im/site/pack/packer/s
tart/nvim-gps/lua/nvim-gps/init.lua:407>
        [C]: in function 'pcall'
        ...site/pack/packer/start/winbar.nvim/lua/winbar/winbar.lua:75: in function 'winbar_gps'
        ...site/pack/packer/start/winbar.nvim/lua/winbar/winbar.lua:124: in function 'show_winbar'
        ...m/site/pack/packer/start/winbar.nvim/lua/winbar/init.lua:13: in function <...m/site/pack/packer/sta
rt/winbar.nvim/lua/winbar/init.lua:12>
Press ENTER or type command to continue

lua/plugins/plugins-setup.lua

use 'nvim-treesitter/nvim-treesitter'
use {'fgheng/winbar.nvim'}
use {'SmiteshP/nvim-gps'}

lua/plugins/winbar.lua

require('winbar').setup({
    enabled = true, -- 是否启动winbar
	
    show_file_path = true, -- 是否显示文件路径
    show_symbols = true, -- 是否显示函数标签

    -- 颜色配置,为空,将使用默认配色
    colors = {
        path = '', -- 路径的颜色,比如#ababab
        file_name = '', -- 文件名称的颜色,比如#acacac
        symbols = '',  -- 函数颜色
    },

    -- 图标配置
    icons = {
        seperator = '>', -- 路径分割符号
        editor_state = '',
        lock_icon = '',
    },

    -- 关闭winbar的窗口
    exclude_filetype = {
        'help',
        'startify',
        'dashboard',
        'packer',
        'neogitstatus',
        'NvimTree',
        'Trouble',
        'alpha',
        'lir',
        'Outline',
        'spectre_panel',
        'toggleterm',
        'qf',
    }
	
})

Can I get symbols without using nvim-gps?

Hi, I would like to use this plugin without nvim-gps but also have the symbols

I have some symbols already

image

is there some way I could define the symbols in the config without using nvim-gps?

Seem symbol doesn't work

What have I missed?
image
I think it suppose to act like my vscode.....
image
here is my config

require('winbar').setup({
    enabled = true,

    show_file_path = true,
    show_symbols = true,

    colors = {
        path = '#c946fd', -- You can customize colors like #c946fd
        file_name = '',
        symbols = '',
    },

    icons = {
        file_icon_default = '',
        seperator = '',
        editor_state = '',
        lock_icon = '',
    },

    exclude_filetype = {
        'help',
        'startify',
        'dashboard',
        'packer',
        'neogitstatus',
        'NvimTree',
        'Trouble',
        'alpha',
        'lir',
        'Outline',
        'spectre_panel',
        'toggleterm',
        'qf',
    }
})

Why is `enabled = false` by default?

I think it should make sense if the plugin is enabled by default. It make me confused a lot when first installing plugin and follow this instruction.

Screenshot 2022-09-10 at 18 41 07

Errors when entering files with unknow file icon

So nice to see plugin development for this new feature, thanks for your efforts mate 🙂.

I need to report some heavy erroring when entering files that have unknown file icons. Is there a chance to get this fixed by adding some conditionality that checks for this or something?

Experienced it when opening files like user-dirs.dirs or user-dirs.defaults and other files with unknown icons, to reproduce just create a similar file.
Following a screenshot of what happens on first entering such a file (sorry for just providing a screenshot, don't know how to concat multiple error messages like that
Workspace 1_029

And on every keypress in such files:

Error executing lua callback: ...site/pack/packer/start/winbar.nvim/lua/winbar/winbar.lua:49: attempt to concatenate upvalue 'file_icon' (a nil value)
stack traceback:
	...site/pack/packer/start/winbar.nvim/lua/winbar/winbar.lua:49: in function 'winbar_file'
	...site/pack/packer/start/winbar.nvim/lua/winbar/winbar.lua:117: in function 'show_winbar'
	...m/site/pack/packer/start/winbar.nvim/lua/winbar/init.lua:13: in function <...m/site/pack/packer/start/winbar.nvim/lua/winbar/init.lua:12>

Edit: Okay, probably the most simple solution is to add the proper filetypes to the excluded list. I didn't check for the actual filetypes of those files and just added its extensions to the excluded list and thought it doesn't work. The troubled fileype was conf. Maybe just adding it to the default excluded_filetype list is enough to close this issue.

exclude_filetype doesn't work for fzf buffers

It seems excluding the fzf filetype still shows a winbar on the fzf floating window:

require('winbar').setup({
  enabled = true,
  exclude_filetype = {
    'help',
    'qf',
    'nerdtree',
    'fzf'
  }
})

nvim_fzf

Thanks for the effort on this plugin, it really makes using winbar quite nice 👍

ml_get error

I often get errors when I use coc to open a new buffer.

[coc.nvim] Error: Vim(sbuffer):E315: ml_get: invalid lnum: 89

When I stopped using this plugin there was no problem.

Only showing path to file, not showing current function

I have just installed this, and it's showing the file I'm in, but not the current function.

I have added:

Plug 'fgheng/winbar.nvim'

and

lua require('winbar').setup({ enabled = true })

I have tested in VueJS, JavaScript, and Rust. All have working language servers installed (does this matter?).

I am using neovim nightly:

NVIM v0.9.0-dev-155+g771824128
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/gcc-10 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -DNVIM_TS_HAS_SET_ALLOCATOR -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-attribute -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/home/runner/work/neovim/neovim/build/cmake.config -I/home/runner/work/neovim/neovim/src -I/home/runner/work/neovim/neovim/.deps/usr/include -I/usr/include -I/home/runner/work/neovim/neovim/build/src/nvim/auto -I/home/runner/work/neovim/neovim/build/include
Compiled by runner@fv-az628-278

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/share/nvim"

winbar start up complain using default setup

I am using nvim 0.8 , installed latest winbar from master.
When using default setup() , start up nvim, got "attempt to index a nil value(opts)" error at line 10.
however if using copy whole default setup opts as setup method argument, it works fine.

checked init.lua source code, line 10
if opts.enabled == true then
maybe need add nil check here for opts

Adding a FOSS license

Hi, I love and use this plug-in every day. It makes so much easier to remember where I am inside of a big file! My workplace is cautious about allowing code without a LICENSE file and it'd be a big help if this plug-in could use a FOSS license. I'm sure others in the same position and would appreciate it too. Could a FOSS license please be added if this plug-in is meant for public use?

Consider alternative filetype for icons

Firstly I wanted to say that I love this plug-in! Often, I find that just the statusline isn't enough space to communicate all that I'd like to see and winbar.nvim has been so helpful. That said I wanted to point out a possible improvement.

I've been working with nvim-dap-ui lately and winbar.nvim looks like this, by default:

Screenshot from 2023-04-23 12-33-45

I wondered why all of the icons were the same and, it turns out, nvim-dap-ui sets each buffer's filetype rather than file extension. winbar.nvim currently only considers the file extension when trying to grab an icon from nvim-web-devicons.

I made a slight tweak to winbar.nvim's source to allow that check

local winbar_file = function()
    local file_path = vim.fn.expand('%:~:.:h')
    local filename = vim.fn.expand('%:t')
    local file_type = vim.fn.expand('%:e')  -- Note, this is actually an extension, not a file type

+   if file_type == ""
+   then
+       file_type = vim.api.nvim_buf_get_option(0, "filetype")
+   end

and now it looks like this

Screenshot from 2023-04-23 12-36-28

It's a minor thing but it'd be cool if this got upstreamed along with an explicit call to webicon's get_icon_by_filetype API function. Either way I can always use my fork. Thanks for making this plug-in!

Unable to setup plugin

E5113: Error while calling lua chunk: ...\pack\packer\start\satellite.nvim/lua/satellite/view.lua:178: unknown option 'winbar'

I have neovim 0.7.2

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.