From 223357b591a8b6eaf797f7b3644006445dd2cc5b Mon Sep 17 00:00:00 2001 From: juan Date: Mon, 25 Oct 2021 12:10:08 +0800 Subject: [PATCH] various color change, remove dap --- lua/pluginList.lua | 20 +++++---------- lua/plugins/coq.lua | 7 ++++- lua/plugins/dap.lua | 36 -------------------------- lua/plugins/gitsigns.lua | 41 ++++++++++++++++++++++++++++++ lua/plugins/nvim-autopairs.lua | 45 ++++++++++++++++++--------------- lua/plugins/nvim-ts-rainbow.lua | 14 +++++----- lua/plugins/treesitter.lua | 24 ++++++++---------- 7 files changed, 97 insertions(+), 90 deletions(-) delete mode 100644 lua/plugins/dap.lua create mode 100644 lua/plugins/gitsigns.lua diff --git a/lua/pluginList.lua b/lua/pluginList.lua index 0215d90..3c5b068 100644 --- a/lua/pluginList.lua +++ b/lua/pluginList.lua @@ -40,10 +40,10 @@ return require('packer').startup(function(use) after = 'nvim-lspconfig' } - -- tree sitter + -- tree sitter use { 'nvim-treesitter/nvim-treesitter', - event = 'VimEnter', + event = "VimEnter", config = function() require "plugins.treesitter" end, run = ':TSUpdate' } @@ -53,11 +53,11 @@ return require('packer').startup(function(use) config = function() require('spellsitter').setup() end } - -- completer + -- completer use { 'ms-jpq/coq_nvim', branch = 'coq', - after = 'nvim-lspinstall', + after = 'nvim-lspinstall', run = ':COQdeps', config = function() require "plugins.coq" end } @@ -144,12 +144,12 @@ return require('packer').startup(function(use) use { 'lewis6991/gitsigns.nvim', requires = {'nvim-lua/plenary.nvim'}, - config = function() require('gitsigns').setup() end + config = function() require "plugins.gitsigns" end } use { 'p00f/nvim-ts-rainbow', - after = "nvim-treesitter", - config = function() require "plugins.nvim-ts-rainbow" end + after = "nvim-treesitter", + config = function() require "plugins.nvim-ts-rainbow" end } use { 'winston0410/range-highlight.nvim', @@ -165,10 +165,4 @@ return require('packer').startup(function(use) -- integrations use {"tpope/vim-fugitive", cmd = "G"} - use { - "xuhdev/vim-latex-live-preview", - setup = function() vim.g.livepreview_previewer = 'zathura' end, - event = "FileType tex" - } - end) diff --git a/lua/plugins/coq.lua b/lua/plugins/coq.lua index fe30ce2..e426015 100644 --- a/lua/plugins/coq.lua +++ b/lua/plugins/coq.lua @@ -1,2 +1,7 @@ -vim.g.coq_settings = { keymap = { recommended = false }, auto_start = true, clients= {tabnine = { enabled = true}} } +vim.g.coq_settings = { + keymap = {recommended = false, pre_select = true}, + auto_start = true, + clients = {tabnine = {enabled = true}}, + display = {ghost_text = {enabled = false}, icons = {mode = "none"}} +} vim.cmd('COQnow -s') diff --git a/lua/plugins/dap.lua b/lua/plugins/dap.lua deleted file mode 100644 index ae87640..0000000 --- a/lua/plugins/dap.lua +++ /dev/null @@ -1,36 +0,0 @@ -require("dapui").setup({ - icons = {expanded = "▾", collapsed = "▸"}, - mappings = { - -- Use a table to apply multiple mappings - expand = {"", "<2-LeftMouse>"}, - open = "o", - remove = "d", - edit = "e", - repl = "r" - }, - sidebar = { - -- You can change the order of elements in the sidebar - elements = { - -- Provide as ID strings or tables with "id" and "size" keys - { - id = "scopes", - size = 0.25 -- Can be float or integer > 1 - }, {id = "breakpoints", size = 0.25}, {id = "stacks", size = 0.25}, - {id = "watches", size = 00.25} - }, - size = 40, - position = "right" -- Can be "left", "right", "top", "bottom" - }, - tray = { - elements = {"repl"}, - size = 10, - position = "bottom" -- Can be "left", "right", "top", "bottom" - }, - floating = { - max_height = nil, -- These can be integers or a float between 0 and 1. - max_width = nil, -- Floats will be treated as percentage of your screen. - mappings = {close = {"q", ""}} - }, - windows = {indent = 1} -}) - diff --git a/lua/plugins/gitsigns.lua b/lua/plugins/gitsigns.lua new file mode 100644 index 0000000..017d599 --- /dev/null +++ b/lua/plugins/gitsigns.lua @@ -0,0 +1,41 @@ +require('gitsigns').setup { + keymaps = { + -- Default keymap options + buffer = true, + noremap = true, + ["n ]c"] = { + expr = true, + "&diff ? ']c' : 'lua require\"gitsigns\".next_hunk()'" + }, + ["n [c"] = { + expr = true, + "&diff ? '[c' : 'lua require\"gitsigns\".prev_hunk()'" + }, + ["n hs"] = 'lua require"gitsigns".stage_hunk()', + ["n hu"] = 'lua require"gitsigns".undo_stage_hunk()', + ["n hr"] = 'lua require"gitsigns".reset_hunk()', + ["n hp"] = 'lua require"gitsigns".preview_hunk()', + ["n hb"] = 'lua require"gitsigns".blame_line()' + }, + numhl = false, + + sign_priority = 5, + signs = { + add = {hl = "DiffAdd", text = "│", numhl = "GitSignsAddNr"}, + change = {hl = "DiffChange", text = "│", numhl = "GitSignsChangeNr"}, + changedelete = { + hl = "DiffChange", + text = "~", + numhl = "GitSignsChangeNr" + }, + delete = {hl = "DiffDelete", text = "_", numhl = "GitSignsDeleteNr"}, + topdelete = { + hl = "DiffDelete", + text = "‾", + numhl = "GitSignsDeleteNr" + } + }, + + status_formatter = nil, -- Use default + watch_gitdir = {interval = 100} +} diff --git a/lua/plugins/nvim-autopairs.lua b/lua/plugins/nvim-autopairs.lua index d4797bc..fd40cd0 100644 --- a/lua/plugins/nvim-autopairs.lua +++ b/lua/plugins/nvim-autopairs.lua @@ -1,35 +1,40 @@ local remap = vim.api.nvim_set_keymap local npairs = require('nvim-autopairs') -npairs.setup({ map_bs = false }) +npairs.setup({map_bs = false}) -- these mappings are coq recommended mappings unrelated to nvim-autopairs -remap('i', '', [[pumvisible() ? "" : ""]], { expr = true, noremap = true }) -remap('i', '', [[pumvisible() ? "" : ""]], { expr = true, noremap = true }) -remap('i', '', [[pumvisible() ? "" : ""]], { expr = true, noremap = true }) -remap('i', '', [[pumvisible() ? "" : ""]], { expr = true, noremap = true }) +remap('i', '', [[pumvisible() ? "" : ""]], + {expr = true, noremap = true}) +remap('i', '', [[pumvisible() ? "" : ""]], + {expr = true, noremap = true}) +remap('i', '', [[pumvisible() ? "" : ""]], + {expr = true, noremap = true}) +remap('i', '', [[pumvisible() ? "" : ""]], + {expr = true, noremap = true}) -- skip it, if you use another global object -_G.MUtils= {} +_G.MUtils = {} MUtils.CR = function() - if vim.fn.pumvisible() ~= 0 then - if vim.fn.complete_info({ 'selected' }).selected ~= -1 then - return npairs.esc('') + if vim.fn.pumvisible() ~= 0 then + if vim.fn.complete_info({'selected'}).selected ~= -1 then + return npairs.esc('') + else + return npairs.esc('') .. npairs.autopairs_cr() + end else - return npairs.esc('') .. npairs.autopairs_cr() + return npairs.autopairs_cr() end - else - return npairs.autopairs_cr() - end end -remap('i', '', 'v:lua.MUtils.CR()', { expr = true, noremap = true }) +remap('i', '', 'v:lua.MUtils.CR()', {expr = true, noremap = true}) MUtils.BS = function() - if vim.fn.pumvisible() ~= 0 and vim.fn.complete_info({ 'mode' }).mode == 'eval' then - return npairs.esc('') .. npairs.autopairs_bs() - else - return npairs.autopairs_bs() - end + if vim.fn.pumvisible() ~= 0 and vim.fn.complete_info({'mode'}).mode == + 'eval' then + return npairs.esc('') .. npairs.autopairs_bs() + else + return npairs.autopairs_bs() + end end -remap('i', '', 'v:lua.MUtils.BS()', { expr = true, noremap = true }) +remap('i', '', 'v:lua.MUtils.BS()', {expr = true, noremap = true}) diff --git a/lua/plugins/nvim-ts-rainbow.lua b/lua/plugins/nvim-ts-rainbow.lua index 8d917d1..d14965b 100644 --- a/lua/plugins/nvim-ts-rainbow.lua +++ b/lua/plugins/nvim-ts-rainbow.lua @@ -1,10 +1,10 @@ require'nvim-treesitter.configs'.setup { - rainbow = { - enable = true, - extended_mode = true, -- Also highlight non-bracket delimiters like html tags, boolean or table: lang -> boolean - max_file_lines = nil, -- Do not enable for files with more than n lines, int - -- colors = {}, -- table of hex strings - -- termcolors = {} -- table of colour name strings - } + rainbow = { + 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 = { "#84a0c6", "#a093c7", "#89b8c2"}, -- table of hex strings + -- termcolors = {} -- table of colour name strings + } } diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua index aa9ff65..0b5e2a7 100644 --- a/lua/plugins/treesitter.lua +++ b/lua/plugins/treesitter.lua @@ -1,15 +1,13 @@ require'nvim-treesitter.configs'.setup { - ensure_installed = {"lua"}, -- one of "all", "maintained" (parsers with maintainers), or a list of languages - highlight = { - enable = true, -- false will disable the whole extension - -- Setting this to true will run `:h syntax` and tree-sitter at the same time. - -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). - -- Using this option may slow down your editor, and you may see some duplicate highlights. - -- Instead of true it can also be a list of languages - additional_vim_regex_highlighting = false, - use_languagetree = true - }, - indent = { - enable = true - } + ensure_installed = {"lua"}, -- one of "all", "maintained" (parsers with maintainers), or a list of languages + highlight = { + enable = true, -- false will disable the whole extension + -- Setting this to true will run `:h syntax` and tree-sitter at the same time. + -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). + -- Using this option may slow down your editor, and you may see some duplicate highlights. + -- Instead of true it can also be a list of languages + additional_vim_regex_highlighting = false, + use_languagetree = true + }, + indent = {enable = true} }