From b9f3bf063ec35118931b3d48b9d3e7707c80a264 Mon Sep 17 00:00:00 2001 From: spike Date: Sun, 25 Sep 2022 05:03:21 +0200 Subject: [PATCH] stable update --- after/plugin/theme.lua | 24 +++++++++ lua/core/mappings.lua | 68 +++++++++++++++--------- lua/custom/chadrc.lua | 7 ++- lua/custom/plugins/configs/gonvim.lua | 20 +++++++ lua/custom/plugins/configs/navigator.lua | 21 ++++---- lua/custom/plugins/init.lua | 22 ++++---- lua/plugins/configs/telescope.lua | 6 +-- lua/sp4ke/utils.lua | 6 +++ 8 files changed, 120 insertions(+), 54 deletions(-) create mode 100644 after/plugin/theme.lua create mode 100644 lua/custom/plugins/configs/gonvim.lua diff --git a/after/plugin/theme.lua b/after/plugin/theme.lua new file mode 100644 index 0000000..333c6e5 --- /dev/null +++ b/after/plugin/theme.lua @@ -0,0 +1,24 @@ +local c = require("base46.colors") +local g = vim.g +local M = {} + +local colors = require("base46").get_theme_tb "base_30" +local theme = require("base46").get_theme_tb "base_16" + + +local ts_context_hl = c.change_hex_saturation(colors["yellow"], -20) +local ts_context_hl = c.change_hex_lightness(ts_context_hl, -55) +local highlights = { + TreesitterContext = { + bg = ts_context_hl, + }, +} + +function set_hl() + for hl, col in pairs(highlights) do + vim.api.nvim_set_hl(0, hl, col) + end +end + +-- setup section +set_hl() diff --git a/lua/core/mappings.lua b/lua/core/mappings.lua index 23dda4e..7b08add 100644 --- a/lua/core/mappings.lua +++ b/lua/core/mappings.lua @@ -541,36 +541,36 @@ M.fzf_lua = { --{{{ n = { -- find -- [""] = { " FzfLua files ", "FzfLua find files" }, - [""] = { function () - local ignored_bufs = { - "qf", - } - for _, ignored in ipairs(ignored_bufs) do - if vim.bo.filetype == ignored then - local default_keyseq = termcodes("") - vim.api.nvim_feedkeys(default_keyseq, 'n', false) - return - end - end - vim.cmd "FzfLua files" - end, "FzfLua find files" }, + -- [""] = { function () + -- local ignored_bufs = { + -- "qf", + -- } + -- for _, ignored in ipairs(ignored_bufs) do + -- if vim.bo.filetype == ignored then + -- local default_keyseq = termcodes("") + -- vim.api.nvim_feedkeys(default_keyseq, 'n', false) + -- return + -- end + -- end + -- vim.cmd "FzfLua files" + -- end, "FzfLua find files" }, ["fl"] = { " FzfLua lines ", "FzfLua grep open buffer lines" }, -- grep - ["fw"] = { " FzfLua grep_cword ", "FzfLua grep cword" }, - ["f."] = { " FzfLua live_grep_native ", "FzfLua grep live native" }, - ["ff"] = { " FzfLua grep_project ", "FzfLua grep live project" }, + -- ["fw"] = { " FzfLua grep_cword ", "FzfLua grep cword" }, + -- ["f."] = { " FzfLua live_grep_native ", "FzfLua grep live native" }, + -- ["ff"] = { " FzfLua grep_project ", "FzfLua grep live project" }, ["f*"] = { " FzfLua live_grep_glob ", "FzfLua grep with glob (SPACE-- globs)" }, -- continue - ["fr"] = { " FzfLua resume ", "FzfLua resume last search" }, + -- ["fr"] = { " FzfLua resume ", "FzfLua resume last search" }, -- [";"] = { " FzfLua buffers ", "FzfLua find buffers" }, -- ["fb"] = { " FzfLua builtin ", "FzfLua builtins" }, -- ["fh"] = { " FzfLua help_tags ", "FzfLua find help pages" }, -- ["fm"] = { " FzfLua marks ", "FzfLua marks" }, - ["fo"] = { " FzfLua oldfiles ", "FzfLua find oldfiles" }, + -- ["fo"] = { " FzfLua oldfiles ", "FzfLua find oldfiles" }, -- ["tk"] = { " FzfLua keymaps ", "FzfLua show keymaps" }, } @@ -584,21 +584,37 @@ M.telescope = { --{{{ -- ["ff"] = { " Telescope find_files ", "find files" }, -- [""] = { " Telescope find_files ", "find files" }, -- - -- ["fa"] = { " Telescope find_files follow=true no_ignore=true hidden=true ", "find all" }, - -- ["f*"] = { " Telescope live_grep ", "live grep" }, - [";"] = { " Telescope buffers ", "Telescope find buffers" }, - ["fb"] = { " Telescope builtin ", "Telescope builtins" }, - ["fB"] = { " Telescope vim_bookmarks ", "Telescope bookmarks" }, + ["fa"] = { " Telescope find_files follow=true no_ignore=true hidden=true ", "find all" }, + [""] = { function () + local ignored_bufs = { + "qf", + } + for _, ignored in ipairs(ignored_bufs) do + if vim.bo.filetype == ignored then + local default_keyseq = termcodes("") + vim.api.nvim_feedkeys(default_keyseq, 'n', false) + return + end + end + vim.cmd "Telescope find_files" + end, "FzfLua find files" }, + ["f."] = { " Telescope live_grep ", "telescope live grep" }, + ["fw"] = { " Telescope grep_string ", "telescope grep cword" }, + [";"] = { " Telescope buffers ", "telescope find buffers" }, + ["fb"] = { " Telescope builtin ", "telescope builtins" }, + ["fB"] = { " Telescope vim_bookmarks ", "telescope bookmarks" }, ["fh"] = { " Telescope help_tags ", "help page" }, - -- ["fo"] = { " Telescope oldfiles ", "find oldfiles" }, + ["fo"] = { " Telescope oldfiles ", "telescope find oldfiles" }, ["fm"] = { " Telescope marks ", "Telescope marks" }, ["fM"] = { " Telescope man_pages ", "Telescope marks" }, ["tk"] = { " Telescope keymaps ", "Telescope show keys" }, + ["fr"] = { " Telescope resume ", "telescope resume last search" }, -- git ["fg"] = { " ", "telescope git commands" }, - ["fgc"] = { " Telescope git_commits ", "git commits" }, - ["fgs"] = { " Telescope git_status ", "git status" }, + ["fgc"] = { " Telescope git_commits ", "teles git commits" }, + ["fgs"] = { " Telescope git_status ", "teles git status" }, + ["fgf"] = { " Telescope git_files ", "teles git files" }, -- pick a hidden term -- ["pt"] = { " Telescope terms ", "pick hidden term" }, diff --git a/lua/custom/chadrc.lua b/lua/custom/chadrc.lua index 3e4958a..21be71d 100644 --- a/lua/custom/chadrc.lua +++ b/lua/custom/chadrc.lua @@ -4,6 +4,9 @@ local M = {} -- make sure you maintain the structure of `core/default_config.lua` here, -- example of changing theme: +-- +-- local custom_theme = require("sp4ke.theme") +-- vim.tbl_deep_extend("force", M.ui.hl_add, custom_theme) M.ui = { theme = "monekai", @@ -14,7 +17,7 @@ M.ui = { italic = true, }, St_LspWarning = { - fg = "yello" + fg = "yellow" }, DiagnosticHint = { fg = "purple", @@ -32,7 +35,7 @@ M.ui = { }, hl_add = { Visual = { - bg = "yellow", + bg = "blue", fg = "black", }, BookmarkSign = { diff --git a/lua/custom/plugins/configs/gonvim.lua b/lua/custom/plugins/configs/gonvim.lua new file mode 100644 index 0000000..a0b72cc --- /dev/null +++ b/lua/custom/plugins/configs/gonvim.lua @@ -0,0 +1,20 @@ +local M = {} + +local config = { + -- verbose = true, + run_in_floaterm = true, + icons = false, + -- icons = { breakpoint = "🧘", currentpos = "🏃" }, -- set to false to disable + lsp_cfg = false, -- handled handled instead by navigator + lsp_keymaps = false, -- use navigator + -- lsp_diag_signs = false, + lsp_codelens = false, -- use navigator + textobjects = true, + dap_debug_keymap = false, +} + +function M.setup() + require("go").setup(config) +end + +return M diff --git a/lua/custom/plugins/configs/navigator.lua b/lua/custom/plugins/configs/navigator.lua index bb63982..99cc4e9 100644 --- a/lua/custom/plugins/configs/navigator.lua +++ b/lua/custom/plugins/configs/navigator.lua @@ -10,7 +10,7 @@ local config = { debug = false, transparency = 5, lsp_signature_help = false, -- needs plugin lsp_signature - default_mapping = true, + default_mapping = false, keymaps = { { key = 'gr', func = require('navigator.reference').async_ref, desc = 'lsp async_ref' }, { key = 'gr', func = require('navigator.reference').reference, desc = 'lsp reference' }, -- reference deprecated @@ -31,9 +31,9 @@ local config = { { key = 'gT', func = require('navigator.treesitter').bufs_ts, desc = 'lsp bufs_ts' }, { key = 'ct', func = require('navigator.ctags').ctags, desc = 'lsp ctags' }, { key = 'K', func = vim.lsp.buf.hover, desc = 'lsp hover' }, - { key = 'ca', mode = 'n', func = require('navigator.codeAction').code_action, desc = 'lsp code_action' }, + { key = '', mode = 'n', func = require('navigator.codeAction').code_action, desc = 'lsp code_action' }, { - key = 'ca', + key = '', mode = 'v', func = require('navigator.codeAction').range_code_action, desc = 'lsp range_code_action', @@ -63,13 +63,14 @@ local config = { desc = 'lsp lsp remove_workspace_folder', }, { key = 'ff', func = vim.lsp.buf.format, mode = 'n', desc = 'lsp format' }, - { key = 'ff', func = vim.lsp.buf.range_formatting, mode = 'v', desc = 'lsp range format' }, - { - key = 'gm', - func = require('navigator.formatting').range_format, - mode = 'n', - desc = 'lsp range format operator e.g gmip', - }, + -- { key = 'ff', func = vim.lsp.buf.range_formatting, mode = 'v', desc = 'lsp range format' }, + -- DEPRECATED + -- { + -- key = 'gm', + -- func = require('navigator.formatting').range_format, + -- mode = 'n', + -- desc = 'lsp range format operator e.g gmip', + -- }, { key = 'wl', func = require('navigator.workspace').list_workspace_folders, desc = 'lsp list_workspace_folders' }, { key = 'la', mode = 'n', func = require('navigator.codelens').run_action, desc = 'lsp run code lens action' }, }, diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index 8b58a82..085e81d 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -121,7 +121,8 @@ return { }, ["nvim-telescope/telescope.nvim"] = { - lock = true, + -- lock = true, + tag = "*", disable = false, }, ["tom-anders/telescope-vim-bookmarks.nvim"] = { @@ -136,6 +137,12 @@ return { require("telescope").load_extension("vim_bookmarks") end }, + ["nvim-telescope/telescope-fzf-native.nvim"] = { + opt = true, + module = "telescope", + after = {"telescope.nvim"}, + run = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build', + }, ["ibhagwan/fzf-lua"] = { lock = true, after = "ui", @@ -377,18 +384,7 @@ return { ft = {"go"}, opt = true, config = function() - require("go").setup({ - run_in_floaterm = true, - icons = false, - -- icons = { breakpoint = "🧘", currentpos = "🏃" }, -- set to false to disable - lsp_cfg = false, -- handled by navigator - -- lsp_keymaps = false, -- use navigator - -- lsp_diag_signs = false, - lsp_codelens = false, -- use navigator - textobjects = true, - dap_debug_keymap = false, - - }) + require("custom.plugins.configs.gonvim").setup() end } } diff --git a/lua/plugins/configs/telescope.lua b/lua/plugins/configs/telescope.lua index 03e1467..67b1abb 100644 --- a/lua/plugins/configs/telescope.lua +++ b/lua/plugins/configs/telescope.lua @@ -35,8 +35,8 @@ local options = { vertical = { mirror = false, }, - width = 0.87, - height = 0.80, + width = 0.99, + height = 0.99, preview_cutoff = 120, }, file_sorter = require("telescope.sorters").get_fuzzy_file, @@ -58,7 +58,7 @@ local options = { }, }, - extensions_list = { "themes", "terms" }, + extensions_list = { "themes", "terms", "fzf" }, } -- check for any override diff --git a/lua/sp4ke/utils.lua b/lua/sp4ke/utils.lua index 8af98b3..4632d23 100644 --- a/lua/sp4ke/utils.lua +++ b/lua/sp4ke/utils.lua @@ -19,4 +19,10 @@ M.list_loaded_modules = function () end +M.reload_theme = function() + require("plenary.reload").reload_module("base46") + require("plenary.reload").reload_module("custom.chadrc") + require("base46").load_theme() +end + return M