Some cleanup

This commit is contained in:
Andy Teijelo 2023-06-09 20:53:37 -04:00
parent b883b4be2c
commit 8a7d5a8927
7 changed files with 39 additions and 279 deletions

View file

@ -13,6 +13,7 @@
"gitsigns.nvim": { "branch": "main", "commit": "4455bb5364d29ff86639dfd5533d4fe4b48192d4" }, "gitsigns.nvim": { "branch": "main", "commit": "4455bb5364d29ff86639dfd5533d4fe4b48192d4" },
"lazy.nvim": { "branch": "main", "commit": "f145e6f42a56306c5536e9efbfe41f7efbec285d" }, "lazy.nvim": { "branch": "main", "commit": "f145e6f42a56306c5536e9efbfe41f7efbec285d" },
"leap.nvim": { "branch": "main", "commit": "14b5a65190fe69388a8f59c695ed3394a10d6af8" }, "leap.nvim": { "branch": "main", "commit": "14b5a65190fe69388a8f59c695ed3394a10d6af8" },
"lsp_signature.nvim": { "branch": "master", "commit": "17ff7a405fea8376b015b8ea7910d2e59958bf68" },
"lualine.nvim": { "branch": "master", "commit": "05d78e9fd0cdfb4545974a5aa14b1be95a86e9c9" }, "lualine.nvim": { "branch": "master", "commit": "05d78e9fd0cdfb4545974a5aa14b1be95a86e9c9" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "5230617372e656d4a2e1e236e03bf7e7b4b97273" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "5230617372e656d4a2e1e236e03bf7e7b4b97273" },
"mason.nvim": { "branch": "main", "commit": "7d7efc738e08fc5bee822857db45cb6103f0b0c1" }, "mason.nvim": { "branch": "main", "commit": "7d7efc738e08fc5bee822857db45cb6103f0b0c1" },

View file

@ -11,31 +11,6 @@ local opts = { silent = true }
keymap("n", "<Leader>l", "<Nop>", opts) keymap("n", "<Leader>l", "<Nop>", opts)
keymap("n", "<Leader>lz", "<cmd>:Lazy<cr>", { desc = "Lazy" }) keymap("n", "<Leader>lz", "<cmd>:Lazy<cr>", { desc = "Lazy" })
-- --Remap space as leader key
-- keymap("", "<Space>", "<Nop>", opts)
-- vim.g.mapleader = " "
--
-- -- Modes
-- -- normal_mode = "n",
-- -- insert_mode = "i",
-- -- visual_mode = "v",
-- -- visual_block_mode = "x",
-- -- term_mode = "t",
-- -- command_mode = "c",
--
-- -- Normal --
-- -- Better window navigation
-- keymap("n", "<C-h>", "<C-w>h", opts)
-- keymap("n", "<C-j>", "<C-w>j", opts)
-- keymap("n", "<C-k>", "<C-w>k", opts)
-- keymap("n", "<C-l>", "<C-w>l", opts)
--
-- -- Resize with arrows
-- keymap("n", "<C-Up>", ":resize -2<CR>", opts)
-- keymap("n", "<C-Down>", ":resize +2<CR>", opts)
-- keymap("n", "<C-Left>", ":vertical resize -2<CR>", opts)
-- keymap("n", "<C-Right>", ":vertical resize +2<CR>", opts)
--
-- Navigate buffers -- Navigate buffers
keymap("n", "<M-l>", ":BufferLineCycleNext<CR>", opts) keymap("n", "<M-l>", ":BufferLineCycleNext<CR>", opts)
keymap("n", "<M-h>", ":BufferLineCyclePrev<CR>", opts) keymap("n", "<M-h>", ":BufferLineCyclePrev<CR>", opts)
@ -55,79 +30,18 @@ for _, mode in ipairs({ "n", "i", "v" }) do
vim.keymap.set(mode, "<A-4>", "<Cmd>BufferLineGoToBuffer 4<CR>", { noremap = true, silent = true }) vim.keymap.set(mode, "<A-4>", "<Cmd>BufferLineGoToBuffer 4<CR>", { noremap = true, silent = true })
vim.keymap.set(mode, "<A-5>", "<Cmd>BufferLineGoToBuffer 5<CR>", { noremap = true, silent = true }) vim.keymap.set(mode, "<A-5>", "<Cmd>BufferLineGoToBuffer 5<CR>", { noremap = true, silent = true })
end end
--
-- -- Clear highlights
-- -- Clear highlights keymap("n", "<leader>h", "<cmd>nohlsearch<CR>", opts)
-- keymap("n", "<leader>h", "<cmd>nohlsearch<CR>", opts)
--
-- Close buffers -- Close buffers
keymap("n", "<M-q>", "<cmd>Bdelete<CR>", opts) keymap("n", "<M-q>", "<cmd>Bdelete<CR>", opts)
keymap("n", "<M-Q>", "<cmd>Bdelete!<CR>", opts) keymap("n", "<M-Q>", "<cmd>Bdelete!<CR>", opts)
--
-- -- Better paste
-- keymap("x", "p", '"_dP', opts)
--
-- -- Insert --
-- -- Press jk fast to enter
-- --keymap("i", "jk", "<ESC>", opts)
--
-- -- Visual --
-- -- Stay in indent mode
-- keymap("v", "<", "<gv", opts)
-- keymap("v", ">", ">gv", opts)
--
-- search with '-', for my LatinAmerican layout -- search with '-', for my LatinAmerican layout
keymap("n", "-", "/", opts) keymap("n", "-", "/", opts)
keymap("x", "-", "/", opts) keymap("x", "-", "/", opts)
--
-- -- Plugins --
--
-- NvimTree
-- keymap("n", "<leader>e", ":NvimTreeToggle<CR>", opts)
--
-- -- Telescope
-- keymap("n", "<leader>fa", ":Telescope find_files<CR>", opts)
-- keymap("n", "<leader>ff", ":Telescope git_files<CR>", opts)
-- keymap("n", "<leader>ft", ":Telescope live_grep<CR>", opts)
-- keymap("n", "<leader>fp", ":Telescope projects<CR>", opts)
-- keymap("n", "<leader>fb", ":Telescope buffers<CR>", opts)
-- keymap("n", "<leader>fs", ":Telescope grep_string<CR>", opts)
-- keymap("n", "<leader>fr", ":Telescope oldfiles<CR>", opts)
--
-- -- Git
-- --keymap("n", "<leader>gg", "<cmd>lua _LAZYGIT_TOGGLE()<CR>", opts)
--
-- -- Comment
-- keymap("n", "<leader>/", "<cmd>lua require('Comment.api').toggle_current_linewise()<cr>", opts)
-- keymap("x", "<leader>/", '<esc><cmd>lua require("Comment.api").toggle_linewise_op(vim.fn.visualmode())<cr>')
--
-- -- DAP
-- keymap("n", "<F9>", "<cmd>lua require'dap'.toggle_breakpoint()<cr>", opts)
-- keymap("n", "<F5>", "<cmd>lua require'dap'.continue()<cr>", opts)
-- keymap("n", "<F10>", "<cmd>lua require'dap'.step_over()<cr>", opts)
-- keymap("n", "<F11>", "<cmd>lua require'dap'.step_into()<cr>", opts)
-- keymap("n", "<F23>", "<cmd>lua require'dap'.step_out()<cr>", opts)
-- keymap("n", "<leader>dr", "<cmd>lua require'dap'.repl.toggle()<cr>", opts)
-- keymap("n", "<leader>dl", "<cmd>lua require'dap'.run_last()<cr>", opts)
-- keymap("n", "<leader>du", "<cmd>lua require'dapui'.toggle()<cr>", opts)
-- keymap("n", "<F17>", "<cmd>lua require'dap'.terminate()<cr>", opts) -- Shift+F5
--
-- ---- Vimspector
-- --keymap("n", "<F9>", "<Plug>VimspectorToggleBreakpoint", opts)
-- --keymap("n", "<F5>", "<plug>VimspectorContinue", opts)
-- --keymap("n", "<F10>", "<Plug>VimspectorStepOver", opts)
-- --keymap("n", "<F11>", "<Plug>VimspectorStepInto", opts)
-- --keymap("n", "<F23>", "<Plug>VimspectorStepOut", opts)
-- --keymap("n", "<F17>", "<cmd>VimspectorReset<cr>", opts) -- Shift+F5
-- --keymap("n", "<F41>", "<Plug>VimspectorRestart", opts) -- Ctrl+Shift+F5
-- --keymap("n", "<leader>di", "<Plug>VimspectorBalloonEval", opts)
--
-- -- move.nvim
-- keymap('n', '<M-J>', ':MoveLine(1)<cr>', opts)
-- keymap('n', '<M-K>', ':MoveLine(-1)<cr>', opts)
-- keymap('x', '<M-J>', ':MoveBlock(1)<cr>', opts)
-- keymap('x', '<M-K>', ':MoveBlock(-1)<cr>', opts)
--
-- disable arrow keys -- disable arrow keys
keymap("n", "<Right>", "<Nop>", opts) keymap("n", "<Right>", "<Nop>", opts)
keymap("n", "<Left>", "<Nop>", opts) keymap("n", "<Left>", "<Nop>", opts)
@ -137,77 +51,38 @@ keymap("i", "<Right>", "<Nop>", opts)
keymap("i", "<Left>", "<Nop>", opts) keymap("i", "<Left>", "<Nop>", opts)
keymap("i", "<Up>", "<Nop>", opts) keymap("i", "<Up>", "<Nop>", opts)
keymap("i", "<Down>", "<Nop>", opts) keymap("i", "<Down>", "<Nop>", opts)
--
-- -- move through wrapped lines
-- keymap("n", "j", "gj")
-- keymap("n", "k", "gk")
--
-- -- use Alt + ijkl to move in insert mode
-- keymap("i", "<M-l>", "<Right>", opts)
-- keymap("i", "<M-h>", "<Left>", opts)
-- keymap("i", "<M-j>", "<C-o>gj", opts)
-- keymap("i", "<M-k>", "<C-o>gk", opts)
--
-- local function clean_screen()
-- vim.o.number = not vim.o.number;
-- --if not vim.diagnostic.get_next() then return end
-- if vim.o.number then
-- vim.diagnostic.show()
-- vim.opt.signcolumn = "yes"
-- vim.cmd("syntax on")
-- else
-- vim.diagnostic.hide()
-- vim.opt.signcolumn = "no"
-- vim.cmd("syntax off")
-- end
-- end
--
-- keymap("n", "<leader>n", clean_screen, opts)
function vim.getVisualSelection() local function clean_screen()
vim.cmd('noau normal! "vy"') vim.o.number = not vim.o.number
local text = vim.fn.getreg('v') --if not vim.diagnostic.get_next() then return end
vim.fn.setreg('v', {}) if vim.o.number then
vim.diagnostic.show()
text = string.gsub(text, "\n", "") vim.opt.signcolumn = "yes"
if #text > 0 then vim.cmd("syntax on")
return text else
else vim.diagnostic.hide()
return '' vim.opt.signcolumn = "no"
end vim.cmd("syntax off")
end
end end
keymap('v', '<space>sw', function() keymap("n", "<leader>n", clean_screen, opts)
local tb = require('telescope.builtin')
local text = vim.getVisualSelection()
tb.live_grep({ default_text = text })
end, opts)
-- function vim.getVisualSelection()
-- local function otherkeymaps() vim.cmd('noau normal! "vy"')
-- local ok local text = vim.fn.getreg("v")
-- local wk vim.fn.setreg("v", {})
-- local gs
-- ok, wk = pcall(require, "which-key") text = string.gsub(text, "\n", "")
-- if not ok then if #text > 0 then
-- return return text
-- end else
-- ok, gs = pcall(require, "gitsigns") return ""
-- if not ok then end
-- return end
-- end
-- wk.register({ keymap("v", "<space>sw", function()
-- g = { local tb = require("telescope.builtin")
-- name = "gitsigns", local text = vim.getVisualSelection()
-- p = { "<cmd>Gitsigns preview_hunk<cr>", "Preview hunk" }, tb.live_grep({ default_text = text })
-- b = { function() gs.blame_line{full=false} end, "Blame line (short)" }, end, opts)
-- B = { function() gs.blame_line{full=true} end, "Blame line (full)" }
-- },
-- prefix = "<leader>"
-- })
-- end
-- keymap("n", "<leader>lf", "<cmd>lua vim.lsp.buf.format()<cr>", opts)
-- keymap("v", "<leader>lf", "<esc><cmd>'<,'>lua vim.lsp.buf.format{ async = true }<cr>", opts)
-- keymap("x", "<leader>lf", "<esc><cmd>'<,'>lua vim.lsp.buf.format{ async = true }<cr>", opts)
--
-- otherkeymaps()

View file

@ -21,7 +21,7 @@ return {
opts = { opts = {
window = { window = {
mappings = { mappings = {
["l"] = "open", ["l"] = "open", -- open folders and files with l
}, },
}, },
}, },
@ -41,44 +41,10 @@ return {
opts.mapping = vim.tbl_extend("force", opts.mapping, { opts.mapping = vim.tbl_extend("force", opts.mapping, {
["<C-k>"] = cmp.mapping.select_prev_item(), ["<C-k>"] = cmp.mapping.select_prev_item(),
["<C-j>"] = cmp.mapping.select_next_item(), ["<C-j>"] = cmp.mapping.select_next_item(),
-- ["<C-b>"] = cmp.mapping(cmp.mapping.scroll_docs(-1), { "i", "c" }),
-- ["<C-f>"] = cmp.mapping(cmp.mapping.scroll_docs(1), { "i", "c" }),
["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }), ["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
-- ["<C-e>"] = cmp.mapping({
-- i = cmp.mapping.abort(),
-- c = cmp.mapping.close(),
-- }),
-- Accept currently selected item. If none selected, `select` first item. -- Accept currently selected item. If none selected, `select` first item.
-- Set `select` to `false` to only confirm explicitly selected items. -- Set `select` to `false` to only confirm explicitly selected items.
["<CR>"] = cmp.mapping.confirm({ select = false }), ["<CR>"] = cmp.mapping.confirm({ select = false }),
-- ["<Tab>"] = cmp.mapping(function(fallback)
-- if cmp.visible() then
-- cmp.select_next_item()
-- elseif luasnip.expandable() then
-- luasnip.expand()
-- elseif luasnip.expand_or_jumpable() then
-- luasnip.expand_or_jump()
-- elseif check_backspace() then
-- fallback()
-- else
-- fallback()
-- end
-- end, {
-- "i",
-- "s",
-- }),
-- ["<S-Tab>"] = cmp.mapping(function(fallback)
-- if cmp.visible() then
-- cmp.select_prev_item()
-- elseif luasnip.jumpable(-1) then
-- luasnip.jump(-1)
-- else
-- fallback()
-- end
-- end, {
-- "i",
-- "s",
-- }),
["<Tab>"] = cmp.mapping(function(fallback) ["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then if cmp.visible() then
cmp.select_next_item() cmp.select_next_item()
@ -110,26 +76,6 @@ return {
opts.completion = { opts.completion = {
completeopt = "noselect", completeopt = "noselect",
} }
-- opts.formatting = {
-- fields = { "kind", "abbr", "menu" },
-- -- format = function(entry, vim_item)
-- -- -- vim_item.kind = kind_icons[vim_item.kind]
-- -- vim_item.menu = ({
-- -- nvim_lsp = "",
-- -- nvim_lua = "",
-- -- luasnip = "",
-- -- buffer = "",
-- -- path = "",
-- -- emoji = "",
-- -- })[entry.source.name]
-- -- return vim_item
-- -- end,
-- }
-- opts.confirm_opts = {
-- behavior = cmp.ConfirmBehavior.Replace,
-- select = false,
-- }
end, end,
}, },
} }

View file

@ -7,6 +7,4 @@ return {
{ "rcarriga/nvim-notify", enabled = false }, { "rcarriga/nvim-notify", enabled = false },
{ "ggandor/flit.nvim", enabled = false }, { "ggandor/flit.nvim", enabled = false },
{ "stevearc/dressing.nvim", enabled = false }, { "stevearc/dressing.nvim", enabled = false },
-- { "folke/neodev.nvim", enabled = false },
-- { "nvim-neo-tree/neo-tree.nvim", enabled = false },
} }

View file

@ -1,52 +1,4 @@
return { return {
"folke/noice.nvim", "folke/noice.nvim",
enabled = false, enabled = false,
opts = {
cmdline = {
enabled = true,
view = "cmdline",
format = {
cmdline = false,
search_down = false,
search_up = false,
filter = false,
lua = false,
help = false,
},
},
messages = {
enabled = true,
},
popupmenu = {
enabled = false,
backend = "nui",
},
presets = {
bottom_search = true,
command_palette = false,
long_message_to_split = true,
inc_rename = false,
lsp_doc_border = true,
},
lsp = {
progress = {
enabled = true,
},
},
status = {},
-- views = {
-- popupmenu = {
-- relative = "cursor",
-- position = {
-- row = 0,
-- col = 0,
-- },
-- },
-- },
-- routes = {
-- view = "cmdline",
-- filter = {
-- }
-- }
},
} }

View file

@ -1,8 +0,0 @@
return {
-- {
-- "nvim-tree/nvim-tree.lua",
-- },
-- {
-- "nvim-tree/nvim-web-devicons",
-- },
}

View file

@ -1,9 +1,5 @@
return { return {
{ {
"mg979/vim-visual-multi", "mg979/vim-visual-multi",
-- enabled = true,
-- init = function()
-- require("fidget").setup()
-- end,
}, },
} }