From a4f9ba5719f833d6e9c825ad74f0fdd89fd29633 Mon Sep 17 00:00:00 2001 From: juan Date: Sun, 4 Sep 2022 17:05:23 +0800 Subject: [PATCH] Chore | Update colors in ts-rainbow, and optimize startup --- init.lua | 4 +- lua/mappings.lua | 39 ------------------ lua/{pluginList.lua => plugins.lua} | 25 +++++------- lua/plugins/barbar.lua | 63 ----------------------------- lua/plugins/indent-blankline.lua | 2 +- lua/plugins/nvim-ts-rainbow.lua | 3 +- lua/plugins/statusline.lua | 14 +++++-- lua/plugins/zk.lua | 53 ------------------------ 8 files changed, 24 insertions(+), 179 deletions(-) rename lua/{pluginList.lua => plugins.lua} (92%) delete mode 100644 lua/plugins/barbar.lua delete mode 100644 lua/plugins/zk.lua diff --git a/init.lua b/init.lua index 2a4c603..9974eb3 100644 --- a/init.lua +++ b/init.lua @@ -1,6 +1,6 @@ -- source options require('core') --- load plugins and its options -require('pluginList') -- load mappings require('mappings') +-- load plugins and its options +require('plugins') diff --git a/lua/mappings.lua b/lua/mappings.lua index db9a763..06be8a1 100644 --- a/lua/mappings.lua +++ b/lua/mappings.lua @@ -58,42 +58,3 @@ map('', 'l', ':HopWordCurrentLine', {silent = true}) -- telescope stuff map('', 'fd', ':Telescope fd', {silent = true}) map('', 'tb', ':Telescope buffers', {silent = true}) - --- Barbar controls -local opts = {noremap = true, silent = true} --- Move to previous/next -map('n', 'gT', 'BufferPrevious', opts) -map('n', 'gt', 'BufferNext', opts) --- Re-order to previous/next -map('n', '', 'BufferMovePrevious', opts) -map('n', '', 'BufferMoveNext', opts) --- Goto buffer in position... -map('n', '', 'BufferGoto 1', opts) -map('n', '', 'BufferGoto 2', opts) -map('n', '', 'BufferGoto 3', opts) -map('n', '', 'BufferGoto 4', opts) -map('n', '', 'BufferGoto 5', opts) -map('n', '', 'BufferGoto 6', opts) -map('n', '', 'BufferGoto 7', opts) -map('n', '', 'BufferGoto 8', opts) -map('n', '', 'BufferGoto 9', opts) -map('n', '', 'BufferLast', opts) --- Pin/unpin buffer -map('n', '', 'BufferPin', opts) --- Close buffer -map('n', '', 'BufferClose', opts) --- Wipeout buffer --- :BufferWipeout --- Close commands --- :BufferCloseAllButCurrent --- :BufferCloseAllButPinned --- :BufferCloseAllButCurrentOrPinned --- :BufferCloseBuffersLeft --- :BufferCloseBuffersRight --- Magic buffer-picking mode -map('n', '', 'BufferPick', opts) --- Sort automatically by... -map('n', 'bb', 'BufferOrderByBufferNumber', opts) -map('n', 'bd', 'BufferOrderByDirectory', opts) -map('n', 'bl', 'BufferOrderByLanguage', opts) -map('n', 'bw', 'BufferOrderByWindowNumber', opts) diff --git a/lua/pluginList.lua b/lua/plugins.lua similarity index 92% rename from lua/pluginList.lua rename to lua/plugins.lua index 2b2c21e..416aa5e 100644 --- a/lua/pluginList.lua +++ b/lua/plugins.lua @@ -4,9 +4,10 @@ return require('packer').startup(function(use) -- core UI use({ 'juancldcmt/sere-forest', - branch = "dev", config = function() vim.g.everforest_better_performance = 1 + vim.g.everforest_enable_italic = 1 + vim.g.everforest_transparent_background = 1 vim.cmd('colorscheme everforest') end }) @@ -16,13 +17,13 @@ return require('packer').startup(function(use) after = {'nvim-web-devicons'}, config = function() require 'plugins.statusline' end } - use { - 'romgrk/barbar.nvim', - requires = {'kyazdani42/nvim-web-devicons'}, - event = 'BufAdd', - after = {'nvim-web-devicons'}, - config = function() require 'plugins.barbar' end - } + -- use { + -- 'romgrk/barbar.nvim', + -- requires = {'kyazdani42/nvim-web-devicons'}, + -- event = 'BufAdd', + -- after = {'nvim-web-devicons'}, + -- config = function() require 'plugins.barbar' end + -- } -- lsp stuff use {'neovim/nvim-lspconfig', event = 'UIEnter'} @@ -174,14 +175,6 @@ return require('packer').startup(function(use) -- integrations use {'tpope/vim-fugitive', cmd = 'G'} - use { - 'mickael-menu/zk-nvim', - requires = {'nvim-telescope/telescope.nvim'}, - event = 'UIEnter', - after = {'telescope.nvim'}, - ft = {'markdown'}, - config = function() require 'plugins.zk' end - } -- fixes and misc. stuff use {'antoinemadec/FixCursorHold.nvim', event = 'UIEnter'} diff --git a/lua/plugins/barbar.lua b/lua/plugins/barbar.lua deleted file mode 100644 index 44ab3dd..0000000 --- a/lua/plugins/barbar.lua +++ /dev/null @@ -1,63 +0,0 @@ --- Set barbar's options -require'bufferline'.setup { - -- Enable/disable animations - animation = false, - - -- Enable/disable auto-hiding the tab bar when there is a single buffer - auto_hide = false, - - -- Enable/disable current/total tabpages indicator (top right corner) - tabpages = true, - - -- Enable/disable close button - closable = true, - - -- Enables/disable clickable tabs - -- - left-click: go to buffer - -- - middle-click: delete buffer - clickable = true, - - -- Enable/disable icons - -- if set to 'numbers', will show buffer index in the tabline - -- if set to 'both', will show buffer index and icons in the tabline - icons = true, - - -- If set, the icon color will follow its corresponding buffer - -- highlight group. By default, the Buffer*Icon group is linked to the - -- Buffer* group (see Highlighting below). Otherwise, it will take its - -- default value as defined by devicons. - icon_custom_colors = true, - - -- Configure icons on the bufferline. - icon_separator_active = '│', - icon_separator_inactive = '|', - icon_close_tab = '', - icon_close_tab_modified = '●', - icon_pinned = '車', - - -- If true, new buffers will be inserted at the start/end of the list. - -- Default is to insert after current buffer. - insert_at_end = false, - insert_at_start = false, - - -- Sets the maximum padding width with which to surround each tab - maximum_padding = 1, - - -- Sets the maximum buffer name length. - maximum_length = 30, - - -- If set, the letters for each buffer in buffer-pick mode will be - -- assigned based on their name. Otherwise or in case all letters are - -- already assigned, the behavior is to assign letters in order of - -- usability (see order below) - semantic_letters = true, - - -- New buffer letters are assigned in this order. This order is - -- optimal for the qwerty keyboard layout but might need adjustement - -- for other layouts. - letters = 'asdfjkl;ghnmxcvbziowerutyqpASDFJKLGHNMXCVBZIOWERUTYQP', - - -- Sets the name of unnamed buffers. By default format is "[Buffer X]" - -- where X is the buffer number. But only a static string is accepted here. - no_name_title = nil -} diff --git a/lua/plugins/indent-blankline.lua b/lua/plugins/indent-blankline.lua index 92e638d..6c82961 100644 --- a/lua/plugins/indent-blankline.lua +++ b/lua/plugins/indent-blankline.lua @@ -5,5 +5,5 @@ require("indent_blankline").setup { max_indent_increase = 2, show_first_indent_level = false, show_trailing_blankline_indent = false, - use_treesitter = true + use_treesitter = true } diff --git a/lua/plugins/nvim-ts-rainbow.lua b/lua/plugins/nvim-ts-rainbow.lua index 4c4ecc6..76a37ec 100644 --- a/lua/plugins/nvim-ts-rainbow.lua +++ b/lua/plugins/nvim-ts-rainbow.lua @@ -3,8 +3,7 @@ require'nvim-treesitter.configs'.setup { enable = true, extended_mode = true, -- Also highlight non-bracket delimiters like html tags, boolean or table: lang -> boolean max_file_lines = 4096, -- Do not enable for files with more than n lines, int - colors = {"#c1bf89", "#87c095", "#82abbc", "#d39bb6", "#acb765"} -- table of hex strings - -- termcolors = {} -- table of colour name strings + termcolors = {"red", "yellow", "green", "blue"} -- table of colour name strings } } diff --git a/lua/plugins/statusline.lua b/lua/plugins/statusline.lua index 8d031e3..6f49e9a 100644 --- a/lua/plugins/statusline.lua +++ b/lua/plugins/statusline.lua @@ -1,7 +1,7 @@ require'lualine'.setup { options = { icons_enabled = true, - theme = 'auto', + theme = 'everforest', component_separators = {'|', '|'}, section_separators = {'', ''}, disabled_filetypes = {} @@ -9,7 +9,7 @@ require'lualine'.setup { sections = { lualine_a = {'mode'}, lualine_b = {'branch'}, - lualine_c = {'filename'}, + lualine_c = {'filename', 'diagonostics'}, lualine_x = {'encoding', 'fileformat', 'filetype'}, lualine_y = {'progress'}, lualine_z = {'location'} @@ -22,6 +22,14 @@ require'lualine'.setup { lualine_y = {}, lualine_z = {} }, - tabline = {}, + -- Tabline is broken, disable for now. + -- tabline = { + -- lualine_a = {'buffers'}, + -- lualine_b = {}, + -- lualine_c = {}, + -- lualine_x = {}, + -- lualine_y = {}, + -- lualine_z = {'tabs'} + -- }, extensions = {} } diff --git a/lua/plugins/zk.lua b/lua/plugins/zk.lua deleted file mode 100644 index da24d84..0000000 --- a/lua/plugins/zk.lua +++ /dev/null @@ -1,53 +0,0 @@ -require("zk").setup({ - -- can be "telescope", "fzf" or "select" (`vim.ui.select`) - -- it's recommended to use "telescope" or "fzf" - picker = "telescope", - - lsp = { - -- `config` is passed to `vim.lsp.start_client(config)` - config = { - cmd = {"zk", "lsp"}, - name = "zk", - root_dir = vim.loop.cwd() - -- on_attach = ... - -- etc, see `:h vim.lsp.start_client()` - }, - - -- automatically attach buffers in a zk notebook that match the given filetypes - auto_attach = {enabled = true, filetypes = {"markdown"}} - } -}) - --- mappings --- Add the key mappings only for Markdown files in a zk notebook. -if require("zk.util").notebook_root(vim.fn.expand('%:p')) ~= nil then - local map = vim.api.nvim_set_keymap - local opts = {noremap = true, silent = false} - - -- Open the link under the caret. - map("n", "", "lua vim.lsp.buf.definition()", opts) - - -- Create a new note after asking for its title. - -- This overrides the global `zn` mapping to create the note in the same directory as the current buffer. - map("n", "zn", - "ZkNew { dir = vim.fn.expand('%:p:h'), title = vim.fn.input('Title: ') }", - opts) - -- Create a new note in the same directory as the current buffer, using the current selection for title. - map("v", "znt", - ":'<,'>ZkNewFromTitleSelection { dir = vim.fn.expand('%:p:h') }", - opts) - -- Create a new note in the same directory as the current buffer, using the current selection for note content and asking for its title. - map("v", "znc", - ":'<,'>ZkNewFromContentSelection { dir = vim.fn.expand('%:p:h'), title = vim.fn.input('Title: ') }", - opts) - - -- Open notes linking to the current buffer. - map("n", "zb", "ZkBacklinks", opts) - -- Alternative for backlinks using pure LSP and showing the source context. - -- map('n', 'zb', 'lua vim.lsp.buf.references()', opts) - -- Open notes linked by the current buffer. - map("n", "zl", "ZkLinks", opts) - - -- Open the code actions for a visual selection. - map("v", "za", ":'<,'>lua vim.lsp.buf.range_code_action()", opts) -end