From ca8f7771bd78c75527c46149fb7def6833e903db Mon Sep 17 00:00:00 2001 From: Ruthenic Date: Wed, 3 Nov 2021 11:32:28 -0400 Subject: [PATCH] Switch to cokeline. --- init.lua | 2 +- lua/keybinds.lua | 6 +++--- lua/plugins.lua | 49 ++++++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 51 insertions(+), 6 deletions(-) diff --git a/init.lua b/init.lua index f673d4c..d12ff36 100644 --- a/init.lua +++ b/init.lua @@ -13,7 +13,7 @@ Plug 'joshdick/onedark.vim' Plug 'nvim-treesitter/nvim-treesitter' Plug('ms-jpq/coq_nvim', {branch = 'coq'}) Plug('ms-jpq/coq.artifacts', {branch = 'artifacts'}) -Plug 'akinsho/bufferline.nvim' +Plug 'noib3/cokeline.nvim' Plug 'numtostr/FTerm.nvim' Plug 'andweeb/presence.nvim' Plug 'tpope/vim-fugitive' diff --git a/lua/keybinds.lua b/lua/keybinds.lua index 65b37b1..232a7c9 100644 --- a/lua/keybinds.lua +++ b/lua/keybinds.lua @@ -7,8 +7,8 @@ map('v', '', 'p', {noremap=true, silent=true}) map('i', '', 'ui', {noremap=true, silent=true}) map('i', '', ':redi', {noremap=true, silent=true}) map('i', '', ':wi', {noremap=true}) -map('n', '', ':BufferLineCyclePrev', {noremap=true}) -map('n', '', ':BufferLineCycleNext', {noremap=true}) -map('n', '', ':Telescope find_files', {noremap=true}) +map('n', '', '(cokeline-focus-prev)', {noremap=false}) +map('n', '', '(cokeline-focus-next)', {noremap=false}) +map('n', '', 'Telescope find_files', {noremap=true}) map('n', '', 'lua require("FTerm").toggle()', {noremap=true, silent=true}) map('i', '', 'copilot#Accept("")', {noremap=true, silent=true, expr=true}) diff --git a/lua/plugins.lua b/lua/plugins.lua index 6cbc6dd..bcf9417 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -1,3 +1,4 @@ +local get_hex = require('cokeline/utils').get_hex local gps = require("nvim-gps") local coq = require "coq" gps.setup() @@ -28,7 +29,7 @@ require('lualine').setup { lualine_a = {'mode'}, lualine_b = {'branch'}, lualine_c = {'filename', { gps.get_location, condition = gps.is_available }}, - lualine_x = {'encoding', 'fileformat', 'filetype'}, + lualine_x = {'fileformat', 'filetype'}, lualine_y = {'progress'}, lualine_z = {'location'} }, @@ -44,4 +45,48 @@ require('lualine').setup { extensions = {} } -require("bufferline").setup({}) +-- Credit to the original author of cokeline for creating most of this config +require('cokeline').setup({ + default_hl = { + focused = { + fg = get_hex('Normal', 'fg'), + bg = get_hex('ColorColumn', 'bg'), + }, + unfocused = { + fg = get_hex('Comment', 'fg'), + bg = get_hex('ColorColumn', 'bg'), + }, + }, + + components = { + { + text = function(buffer) + if buffer.is_focused then + return '│ ' .. buffer.devicon.icon + else + return '| ' .. buffer.devicon.icon + end + end, + hl = { + fg = function(buffer) return buffer.devicon.color end, + }, + }, + { + text = function(buffer) return buffer.unique_prefix end, + hl = { + fg = get_hex('Comment', 'fg'), + style = 'italic', + }, + }, + { + text = function(buffer) return buffer.filename .. ' ' end, + }, + { + text = 'X', + delete_buffer_on_left_click = true, + }, + { + text = ' ', + } + }, +})