summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYigit Sever2022-12-14 17:01:15 +0300
committerYigit Sever2022-12-14 17:04:11 +0300
commit083b7bcdc568f3db5bde5adb60f2c8a3d038751a (patch)
tree600cd223260f9432c5882e628c549533189c1982
parentc97fce7e0ae0ac16cf987bd5ea1d3c0ab44e7c06 (diff)
downloaddotfiles-083b7bcdc568f3db5bde5adb60f2c8a3d038751a.tar.gz
dotfiles-083b7bcdc568f3db5bde5adb60f2c8a3d038751a.tar.bz2
dotfiles-083b7bcdc568f3db5bde5adb60f2c8a3d038751a.zip
feat(nvim): use barbar tabline plugin
-rw-r--r--.config/nvim/lua/mappings.lua32
-rw-r--r--.config/nvim/lua/plugin_settings.lua174
-rw-r--r--.config/nvim/lua/plugins.lua3
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)
152vim.keymap.set('v', '`', '<Plug>(leap-forward)', opts) 152vim.keymap.set('v', '`', '<Plug>(leap-forward)', opts)
153vim.keymap.set('v', '<Leader>`', '<Plug>(leap-backward)', opts) 153vim.keymap.set('v', '<Leader>`', '<Plug>(leap-backward)', opts)
154 154
155-- barbar.nvim mappings
156local opts = { noremap = true, silent = true }
157
158-- move to previous/next
159vim.keymap.set('n', '<A-,>', '<Cmd>BufferPrevious<CR>', opts)
160vim.keymap.set('n', '<A-.>', '<Cmd>BufferNext<CR>', opts)
161-- re-order to previous/next
162vim.keymap.set('n', '<A-e>', '<Cmd>BufferMovePrevious<CR>', opts)
163vim.keymap.set('n', '<A-i>', '<Cmd>BufferMoveNext<CR>', opts)
164-- goto buffer in position...
165vim.keymap.set('n', '<A-1>', '<Cmd>BufferGoto 1<CR>', opts)
166vim.keymap.set('n', '<A-2>', '<Cmd>BufferGoto 2<CR>', opts)
167vim.keymap.set('n', '<A-3>', '<Cmd>BufferGoto 3<CR>', opts)
168vim.keymap.set('n', '<A-4>', '<Cmd>BufferGoto 4<CR>', opts)
169vim.keymap.set('n', '<A-5>', '<Cmd>BufferGoto 5<CR>', opts)
170vim.keymap.set('n', '<A-6>', '<Cmd>BufferGoto 6<CR>', opts)
171vim.keymap.set('n', '<A-7>', '<Cmd>BufferGoto 7<CR>', opts)
172vim.keymap.set('n', '<A-8>', '<Cmd>BufferGoto 8<CR>', opts)
173vim.keymap.set('n', '<A-9>', '<Cmd>BufferGoto 9<CR>', opts)
174vim.keymap.set('n', '<A-0>', '<Cmd>BufferLast<CR>', opts)
175-- pin/unpin buffer
176vim.keymap.set('n', '<A-p>', '<Cmd>BufferPin<CR>', opts)
177-- close buffer
178vim.keymap.set('n', '<A-c>', '<Cmd>BufferClose<CR>', opts)
179-- magic buffer-picking mode
180vim.keymap.set('n', '<leader>dg', '<Cmd>BufferPick<CR>', opts)
181-- sort automatically by...
182vim.keymap.set('n', '<Leader>db', '<Cmd>BufferOrderByBufferNumber<CR>', opts)
183vim.keymap.set('n', '<Leader>dd', '<Cmd>BufferOrderByDirectory<CR>', opts)
184vim.keymap.set('n', '<Leader>dl', '<Cmd>BufferOrderByLanguage<CR>', opts)
185vim.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
459require("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 {{{ --
489require 'colorizer'.setup() 451require '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
607require("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
638require'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
719local nvim_tree_events = require('nvim-tree.events')
720local bufferline_api = require('bufferline.api')
721
722local function get_tree_size()
723 return require'nvim-tree.view'.View.width
724end
725
726nvim_tree_events.subscribe('TreeOpen', function()
727 bufferline_api.set_offset(get_tree_size())
728end)
729
730nvim_tree_events.subscribe('Resize', function()
731 bufferline_api.set_offset(get_tree_size())
732end)
733
734nvim_tree_events.subscribe('TreeClose', function()
735 bufferline_api.set_offset(0)
736end)
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