diff options
author | Yigit Sever | 2022-12-14 17:01:15 +0300 |
---|---|---|
committer | Yigit Sever | 2022-12-14 17:04:11 +0300 |
commit | 083b7bcdc568f3db5bde5adb60f2c8a3d038751a (patch) | |
tree | 600cd223260f9432c5882e628c549533189c1982 /.config/nvim/lua | |
parent | c97fce7e0ae0ac16cf987bd5ea1d3c0ab44e7c06 (diff) | |
download | dotfiles-083b7bcdc568f3db5bde5adb60f2c8a3d038751a.tar.gz dotfiles-083b7bcdc568f3db5bde5adb60f2c8a3d038751a.tar.bz2 dotfiles-083b7bcdc568f3db5bde5adb60f2c8a3d038751a.zip |
feat(nvim): use barbar tabline plugin
Diffstat (limited to '.config/nvim/lua')
-rw-r--r-- | .config/nvim/lua/mappings.lua | 32 | ||||
-rw-r--r-- | .config/nvim/lua/plugin_settings.lua | 174 | ||||
-rw-r--r-- | .config/nvim/lua/plugins.lua | 3 |
3 files changed, 169 insertions, 40 deletions
diff --git a/.config/nvim/lua/mappings.lua b/.config/nvim/lua/mappings.lua index 1512fee..4bf7cf3 100644 --- a/.config/nvim/lua/mappings.lua +++ b/.config/nvim/lua/mappings.lua | |||
@@ -152,4 +152,36 @@ vim.keymap.set('n', '<Leader>`', '<Plug>(leap-backward)', opts) | |||
152 | vim.keymap.set('v', '`', '<Plug>(leap-forward)', opts) | 152 | vim.keymap.set('v', '`', '<Plug>(leap-forward)', opts) |
153 | vim.keymap.set('v', '<Leader>`', '<Plug>(leap-backward)', opts) | 153 | vim.keymap.set('v', '<Leader>`', '<Plug>(leap-backward)', opts) |
154 | 154 | ||
155 | -- barbar.nvim mappings | ||
156 | local opts = { noremap = true, silent = true } | ||
157 | |||
158 | -- move to previous/next | ||
159 | vim.keymap.set('n', '<A-,>', '<Cmd>BufferPrevious<CR>', opts) | ||
160 | vim.keymap.set('n', '<A-.>', '<Cmd>BufferNext<CR>', opts) | ||
161 | -- re-order to previous/next | ||
162 | vim.keymap.set('n', '<A-e>', '<Cmd>BufferMovePrevious<CR>', opts) | ||
163 | vim.keymap.set('n', '<A-i>', '<Cmd>BufferMoveNext<CR>', opts) | ||
164 | -- goto buffer in position... | ||
165 | vim.keymap.set('n', '<A-1>', '<Cmd>BufferGoto 1<CR>', opts) | ||
166 | vim.keymap.set('n', '<A-2>', '<Cmd>BufferGoto 2<CR>', opts) | ||
167 | vim.keymap.set('n', '<A-3>', '<Cmd>BufferGoto 3<CR>', opts) | ||
168 | vim.keymap.set('n', '<A-4>', '<Cmd>BufferGoto 4<CR>', opts) | ||
169 | vim.keymap.set('n', '<A-5>', '<Cmd>BufferGoto 5<CR>', opts) | ||
170 | vim.keymap.set('n', '<A-6>', '<Cmd>BufferGoto 6<CR>', opts) | ||
171 | vim.keymap.set('n', '<A-7>', '<Cmd>BufferGoto 7<CR>', opts) | ||
172 | vim.keymap.set('n', '<A-8>', '<Cmd>BufferGoto 8<CR>', opts) | ||
173 | vim.keymap.set('n', '<A-9>', '<Cmd>BufferGoto 9<CR>', opts) | ||
174 | vim.keymap.set('n', '<A-0>', '<Cmd>BufferLast<CR>', opts) | ||
175 | -- pin/unpin buffer | ||
176 | vim.keymap.set('n', '<A-p>', '<Cmd>BufferPin<CR>', opts) | ||
177 | -- close buffer | ||
178 | vim.keymap.set('n', '<A-c>', '<Cmd>BufferClose<CR>', opts) | ||
179 | -- magic buffer-picking mode | ||
180 | vim.keymap.set('n', '<leader>dg', '<Cmd>BufferPick<CR>', opts) | ||
181 | -- sort automatically by... | ||
182 | vim.keymap.set('n', '<Leader>db', '<Cmd>BufferOrderByBufferNumber<CR>', opts) | ||
183 | vim.keymap.set('n', '<Leader>dd', '<Cmd>BufferOrderByDirectory<CR>', opts) | ||
184 | vim.keymap.set('n', '<Leader>dl', '<Cmd>BufferOrderByLanguage<CR>', opts) | ||
185 | vim.keymap.set('n', '<Leader>dw', '<Cmd>BufferOrderByWindowNumber<CR>', opts) | ||
186 | |||
155 | -- }}} plug mappings -- | 187 | -- }}} plug mappings -- |
diff --git a/.config/nvim/lua/plugin_settings.lua b/.config/nvim/lua/plugin_settings.lua index d03ad77..d103607 100644 --- a/.config/nvim/lua/plugin_settings.lua +++ b/.config/nvim/lua/plugin_settings.lua | |||
@@ -94,14 +94,7 @@ require'lualine'.setup { | |||
94 | lualine_y = {}, | 94 | lualine_y = {}, |
95 | lualine_z = {} | 95 | lualine_z = {} |
96 | }, | 96 | }, |
97 | tabline = { | 97 | tabline = {}, |
98 | lualine_a = {'buffers'}, | ||
99 | lualine_b = {}, | ||
100 | lualine_c = {}, | ||
101 | lualine_x = {}, | ||
102 | lualine_y = {}, | ||
103 | lualine_z = {} | ||
104 | }, | ||
105 | extensions = {} | 98 | extensions = {} |
106 | } | 99 | } |
107 | 100 | ||
@@ -454,37 +447,6 @@ npairs.add_rule(Rule('/*','*/',"c")) | |||
454 | 447 | ||
455 | -- }}} nvim-autopairs -- | 448 | -- }}} nvim-autopairs -- |
456 | 449 | ||
457 | -- nvim-tree {{{ -- | ||
458 | |||
459 | require("nvim-tree").setup({ | ||
460 | sort_by = "case_sensitive", | ||
461 | diagnostics = { | ||
462 | enable = false, | ||
463 | icons = { | ||
464 | hint = "❔", | ||
465 | info = "❕", | ||
466 | warning = "❗", | ||
467 | error = "❌", | ||
468 | } | ||
469 | }, | ||
470 | view = { | ||
471 | adaptive_size = true, | ||
472 | mappings = { | ||
473 | list = { | ||
474 | { key = "u", action = "dir_up" }, | ||
475 | }, | ||
476 | }, | ||
477 | }, | ||
478 | renderer = { | ||
479 | group_empty = true, | ||
480 | }, | ||
481 | filters = { | ||
482 | dotfiles = true, | ||
483 | }, | ||
484 | }) | ||
485 | |||
486 | -- }}} nvim-tree -- | ||
487 | |||
488 | -- nvim-colorizer {{{ -- | 450 | -- nvim-colorizer {{{ -- |
489 | require 'colorizer'.setup() | 451 | require 'colorizer'.setup() |
490 | -- }}} nvim-colorizer -- | 452 | -- }}} nvim-colorizer -- |
@@ -640,3 +602,137 @@ require("fidget").setup{ | |||
640 | } | 602 | } |
641 | -- }}} fidget.nvim -- | 603 | -- }}} fidget.nvim -- |
642 | 604 | ||
605 | -- nvim-tree {{{ -- | ||
606 | |||
607 | require("nvim-tree").setup({ | ||
608 | sort_by = "case_sensitive", | ||
609 | diagnostics = { | ||
610 | enable = false, | ||
611 | icons = { | ||
612 | hint = "❔", | ||
613 | info = "❕", | ||
614 | warning = "❗", | ||
615 | error = "❌", | ||
616 | } | ||
617 | }, | ||
618 | view = { | ||
619 | adaptive_size = true, | ||
620 | mappings = { | ||
621 | list = { | ||
622 | { key = "u", action = "dir_up" }, | ||
623 | }, | ||
624 | }, | ||
625 | }, | ||
626 | renderer = { | ||
627 | group_empty = true, | ||
628 | }, | ||
629 | filters = { | ||
630 | dotfiles = true, | ||
631 | }, | ||
632 | }) | ||
633 | |||
634 | -- }}} nvim-tree -- | ||
635 | |||
636 | -- barbar.nvim {{{ -- | ||
637 | |||
638 | require'bufferline'.setup { | ||
639 | -- disable animations | ||
640 | animation = false, | ||
641 | |||
642 | -- auto-hide the tab bar when there is a single buffer | ||
643 | auto_hide = true, | ||
644 | |||
645 | -- enable current/total tabpages indicator (top right corner) | ||
646 | tabpages = true, | ||
647 | |||
648 | -- enable close button | ||
649 | closable = true, | ||
650 | |||
651 | -- disable clickable tabs | ||
652 | clickable = false, | ||
653 | |||
654 | -- Enables / disables diagnostic symbols | ||
655 | diagnostics = { | ||
656 | -- `vim.diagnostic.severity` | ||
657 | [vim.diagnostic.severity.ERROR] = {enabled = true, icon = '❌'}, | ||
658 | [vim.diagnostic.severity.WARN] = {enabled = false}, | ||
659 | [vim.diagnostic.severity.INFO] = {enabled = false}, | ||
660 | [vim.diagnostic.severity.HINT] = {enabled = true}, | ||
661 | }, | ||
662 | |||
663 | -- -- Excludes buffers from the tabline | ||
664 | -- exclude_ft = {'javascript'}, | ||
665 | -- exclude_name = {'package.json'}, | ||
666 | |||
667 | -- Hide inactive buffers and file extensions. Other options are `current` and `visible` | ||
668 | -- hide = {extensions = true, inactive = true}, | ||
669 | |||
670 | -- Enable/disable icons | ||
671 | -- if set to 'numbers', will show buffer index in the tabline | ||
672 | -- if set to 'both', will show buffer index and icons in the tabline | ||
673 | icons = true, | ||
674 | |||
675 | -- If set, the icon color will follow its corresponding buffer | ||
676 | -- highlight group. By default, the Buffer*Icon group is linked to the | ||
677 | -- Buffer* group (see Highlighting below). Otherwise, it will take its | ||
678 | -- default value as defined by devicons. | ||
679 | icon_custom_colors = false, | ||
680 | |||
681 | -- Configure icons on the bufferline. | ||
682 | icon_separator_active = '▎', | ||
683 | icon_separator_inactive = '▎', | ||
684 | icon_close_tab = '', | ||
685 | icon_close_tab_modified = '•', | ||
686 | icon_pinned = '車', | ||
687 | |||
688 | -- If true, new buffers will be inserted at the start/end of the list. | ||
689 | -- Default is to insert after current buffer. | ||
690 | insert_at_end = false, | ||
691 | insert_at_start = false, | ||
692 | |||
693 | -- Sets the maximum padding width with which to surround each tab | ||
694 | maximum_padding = 1, | ||
695 | |||
696 | -- Sets the minimum padding width with which to surround each tab | ||
697 | minimum_padding = 1, | ||
698 | |||
699 | -- Sets the maximum buffer name length. | ||
700 | maximum_length = 30, | ||
701 | |||
702 | -- If set, the letters for each buffer in buffer-pick mode will be | ||
703 | -- assigned based on their name. Otherwise or in case all letters are | ||
704 | -- already assigned, the behavior is to assign letters in order of | ||
705 | -- usability (see order below) | ||
706 | semantic_letters = true, | ||
707 | |||
708 | -- New buffer letters are assigned in this order. This order is | ||
709 | -- optimal for the qwerty keyboard layout but might need adjustement | ||
710 | -- for other layouts. | ||
711 | -- letters = 'asdfjkl;ghnmxcvbziowerutyqpASDFJKLGHNMXCVBZIOWERUTYQP', | ||
712 | letters = 'arstneoidhqwfpluy;zxcvkmARSTNEOIDHQWFPLUYZXCVKM', | ||
713 | |||
714 | -- Sets the name of unnamed buffers. By default format is "[Buffer X]" | ||
715 | -- where X is the buffer number. But only a static string is accepted here. | ||
716 | no_name_title = nil, | ||
717 | } | ||
718 | |||
719 | local nvim_tree_events = require('nvim-tree.events') | ||
720 | local bufferline_api = require('bufferline.api') | ||
721 | |||
722 | local function get_tree_size() | ||
723 | return require'nvim-tree.view'.View.width | ||
724 | end | ||
725 | |||
726 | nvim_tree_events.subscribe('TreeOpen', function() | ||
727 | bufferline_api.set_offset(get_tree_size()) | ||
728 | end) | ||
729 | |||
730 | nvim_tree_events.subscribe('Resize', function() | ||
731 | bufferline_api.set_offset(get_tree_size()) | ||
732 | end) | ||
733 | |||
734 | nvim_tree_events.subscribe('TreeClose', function() | ||
735 | bufferline_api.set_offset(0) | ||
736 | end) | ||
737 | |||
738 | -- }}} barbar.nvim -- | ||
diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua index 1a36ce9..0c00437 100644 --- a/.config/nvim/lua/plugins.lua +++ b/.config/nvim/lua/plugins.lua | |||
@@ -29,7 +29,6 @@ return require('packer').startup(function(use) | |||
29 | -- extra rust-analyzer functionality | 29 | -- extra rust-analyzer functionality |
30 | use 'simrat39/rust-tools.nvim' | 30 | use 'simrat39/rust-tools.nvim' |
31 | 31 | ||
32 | |||
33 | -- annotation generator | 32 | -- annotation generator |
34 | use { | 33 | use { |
35 | "danymat/neogen", | 34 | "danymat/neogen", |
@@ -145,6 +144,8 @@ return require('packer').startup(function(use) | |||
145 | 'nvim-lualine/lualine.nvim', | 144 | 'nvim-lualine/lualine.nvim', |
146 | requires = {'kyazdani42/nvim-web-devicons', opt = true} | 145 | requires = {'kyazdani42/nvim-web-devicons', opt = true} |
147 | } | 146 | } |
147 | -- tabline | ||
148 | use {'romgrk/barbar.nvim', wants = 'nvim-web-devicons'} | ||
148 | -- colour theme of the $CURRENT_YEAR | 149 | -- colour theme of the $CURRENT_YEAR |
149 | use 'rose-pine/neovim' | 150 | use 'rose-pine/neovim' |
150 | 151 | ||