Compare commits

..

2 Commits

Author SHA1 Message Date
Ryan
95765a5087 🐛 Neogit and more optimizations
Signed-off-by: Ryan <ryan@alien.gov>
2023-11-28 13:02:36 +08:00
Ryan
5efca0c97c Add trouble
Signed-off-by: Ryan <ryan@alien.gov>
2023-11-28 11:10:12 +08:00
6 changed files with 85 additions and 55 deletions

View File

@ -8,6 +8,7 @@
"cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" },
"cmp-treesitter": { "branch": "master", "commit": "b8bc760dfcc624edd5454f0982b63786a822eed9" }, "cmp-treesitter": { "branch": "master", "commit": "b8bc760dfcc624edd5454f0982b63786a822eed9" },
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
"diffview.nvim": { "branch": "main", "commit": "3dc498c9777fe79156f3d32dddd483b8b3dbd95f" },
"dressing.nvim": { "branch": "master", "commit": "fe3071330a0720ce3695ac915820c8134b22d1b0" }, "dressing.nvim": { "branch": "master", "commit": "fe3071330a0720ce3695ac915820c8134b22d1b0" },
"friendly-snippets": { "branch": "main", "commit": "43727c2ff84240e55d4069ec3e6158d74cb534b6" }, "friendly-snippets": { "branch": "main", "commit": "43727c2ff84240e55d4069ec3e6158d74cb534b6" },
"gitmoji.nvim": { "branch": "main", "commit": "326ddf01cbf3425566a089126ece7e8bd2560601" }, "gitmoji.nvim": { "branch": "main", "commit": "326ddf01cbf3425566a089126ece7e8bd2560601" },
@ -17,23 +18,24 @@
"killersheep.nvim": { "branch": "master", "commit": "506823c47b854df02e78d5fec9468ab0e542dcf5" }, "killersheep.nvim": { "branch": "master", "commit": "506823c47b854df02e78d5fec9468ab0e542dcf5" },
"lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" }, "lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" },
"lualine.nvim": { "branch": "master", "commit": "2248ef254d0a1488a72041cfb45ca9caada6d994" }, "lualine.nvim": { "branch": "master", "commit": "2248ef254d0a1488a72041cfb45ca9caada6d994" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "ab640b38ca9fa50d25d2d249b6606b9456b628d5" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "3d9e06ca604185ea5675d3c2ffd4284e0c2c7ffc" },
"mason-null-ls.nvim": { "branch": "main", "commit": "ae0c5fa57468ac65617f1bf821ba0c3a1e251f0c" }, "mason-null-ls.nvim": { "branch": "main", "commit": "ae0c5fa57468ac65617f1bf821ba0c3a1e251f0c" },
"mason.nvim": { "branch": "main", "commit": "41e75af1f578e55ba050c863587cffde3556ffa6" }, "mason.nvim": { "branch": "main", "commit": "41e75af1f578e55ba050c863587cffde3556ffa6" },
"neogit": { "branch": "master", "commit": "3c4db5d1040909879136ea49ca67d68896f5a3b1" },
"none-ls.nvim": { "branch": "main", "commit": "128f06e169b81bb7244cf64a7abcdd7dc4e268a0" },
"nui.nvim": { "branch": "main", "commit": "c0c8e347ceac53030f5c1ece1c5a5b6a17a25b32" }, "nui.nvim": { "branch": "main", "commit": "c0c8e347ceac53030f5c1ece1c5a5b6a17a25b32" },
"null-ls.nvim": { "branch": "main", "commit": "0010ea927ab7c09ef0ce9bf28c2b573fc302f5a7" },
"nvim-autopairs": { "branch": "master", "commit": "0f04d78619cce9a5af4f355968040f7d675854a1" }, "nvim-autopairs": { "branch": "master", "commit": "0f04d78619cce9a5af4f355968040f7d675854a1" },
"nvim-cmp": { "branch": "main", "commit": "0b751f6beef40fd47375eaf53d3057e0bfa317e4" }, "nvim-cmp": { "branch": "main", "commit": "0b751f6beef40fd47375eaf53d3057e0bfa317e4" },
"nvim-colorizer.lua": { "branch": "master", "commit": "dde3084106a70b9a79d48f426f6d6fec6fd203f7" }, "nvim-colorizer.lua": { "branch": "master", "commit": "dde3084106a70b9a79d48f426f6d6fec6fd203f7" },
"nvim-lspconfig": { "branch": "master", "commit": "553c4e0e667167640c5398573f6f3a488ff8047a" }, "nvim-lspconfig": { "branch": "master", "commit": "553c4e0e667167640c5398573f6f3a488ff8047a" },
"nvim-treesitter": { "branch": "master", "commit": "cd583cfb5b492c4f81edc5e1916c9f59b7b0ef16" }, "nvim-treesitter": { "branch": "master", "commit": "2a5f6c9eb733a5a847bb1890f620658547033515" },
"nvim-treesitter-context": { "branch": "master", "commit": "bf4d15ee4e96ff5201f16a4ed14443670662eb90" }, "nvim-treesitter-context": { "branch": "master", "commit": "bf4d15ee4e96ff5201f16a4ed14443670662eb90" },
"nvim-web-devicons": { "branch": "master", "commit": "cdbcca210cf3655aa9b31ebf2422763ecd85ee5c" }, "nvim-web-devicons": { "branch": "master", "commit": "cdbcca210cf3655aa9b31ebf2422763ecd85ee5c" },
"plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" }, "plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" },
"range-highlight.nvim": { "branch": "master", "commit": "8b5e8ccb3460b2c3675f4639b9f54e64eaab36d9" }, "range-highlight.nvim": { "branch": "master", "commit": "8b5e8ccb3460b2c3675f4639b9f54e64eaab36d9" },
"symbols-outline.nvim": { "branch": "master", "commit": "512791925d57a61c545bc303356e8a8f7869763c" }, "symbols-outline.nvim": { "branch": "master", "commit": "512791925d57a61c545bc303356e8a8f7869763c" },
"telescope.nvim": { "branch": "master", "commit": "18774ec7929c8a8003a91e9e1f69f6c32258bbfe" }, "telescope.nvim": { "branch": "master", "commit": "18774ec7929c8a8003a91e9e1f69f6c32258bbfe" },
"vim-fugitive": { "branch": "master", "commit": "46eaf8918b347906789df296143117774e827616" }, "trouble.nvim": { "branch": "main", "commit": "f1168feada93c0154ede4d1fe9183bf69bac54ea" },
"vim-matchup": { "branch": "master", "commit": "d30b72d20f01478a8486f15a57c89fe3177373db" }, "vim-matchup": { "branch": "master", "commit": "d30b72d20f01478a8486f15a57c89fe3177373db" },
"vim-sandwich": { "branch": "master", "commit": "c5a2cc438ce6ea2005c556dc833732aa53cae21a" } "vim-sandwich": { "branch": "master", "commit": "c5a2cc438ce6ea2005c556dc833732aa53cae21a" }
} }

View File

@ -95,7 +95,13 @@ local plugins = {
}, },
{ {
"Dynge/gitmoji.nvim", "Dynge/gitmoji.nvim",
ft = "gitcommit", ft = { "gitcommit", "NeogitCommitMessage" },
opts = {
filetypes = { "gitcommit", "octo", "NeogitCommitMessage" },
completion = {
append_space = true,
},
},
dependencies = "hrsh7th/nvim-cmp" dependencies = "hrsh7th/nvim-cmp"
}, },
{ {
@ -129,7 +135,7 @@ local plugins = {
event = { "BufReadPre", "BufNewFile" }, event = { "BufReadPre", "BufNewFile" },
dependencies = { dependencies = {
"williamboman/mason.nvim", "williamboman/mason.nvim",
"jose-elias-alvarez/null-ls.nvim" "nvimtools/none-ls.nvim"
} }
}, },
-- Code editing -- Code editing
@ -139,6 +145,7 @@ local plugins = {
}, },
{ {
"numToStr/Comment.nvim", "numToStr/Comment.nvim",
event = "ModeChanged",
keys = "g", keys = "g",
config = function() config = function()
require("Comment").setup() require("Comment").setup()
@ -152,13 +159,40 @@ local plugins = {
"nvim-telescope/telescope.nvim", "nvim-telescope/telescope.nvim",
dependencies = { 'nvim-lua/plenary.nvim' }, dependencies = { 'nvim-lua/plenary.nvim' },
event = "CmdlineEnter", event = "CmdlineEnter",
keys = {
vim.keymap.set('', '<leader>fd', ':Telescope fd<cr>'),
vim.keymap.set('', '<leader>bf', ':Telescope buffers<cr>'),
},
config = function() config = function()
require("plugins.telescope") require("plugins.telescope")
end end
}, },
{ {
"tpope/vim-fugitive", "NeogitOrg/neogit",
event = "CmdlineEnter" dependencies = {
"nvim-lua/plenary.nvim", -- required
"nvim-telescope/telescope.nvim", -- optional
"sindrets/diffview.nvim", -- optional
},
event = "CmdlineEnter",
config = true
},
{
-- TODO: add events, keys and cmds
"folke/trouble.nvim",
lazy = true,
cmd = "Troubletoggle",
keys = {
vim.keymap.set("n", "<leader>xx", function() require("trouble").toggle() end),
vim.keymap.set("n", "<leader>xw",
function() require("trouble").toggle("workspace_diagnostics") end),
vim.keymap.set("n", "<leader>xd",
function() require("trouble").toggle("document_diagnostics") end),
vim.keymap.set("n", "<leader>xq", function() require("trouble").toggle("quickfix") end),
vim.keymap.set("n", "<leader>xl", function() require("trouble").toggle("loclist") end),
vim.keymap.set("n", "<leader>gr", function() require("trouble").toggle("lsp_references") end)
},
dependencies = { "nvim-tree/nvim-web-devicons" },
}, },
-- Eye candy UI -- Eye candy UI
@ -178,6 +212,9 @@ local plugins = {
{ {
'simrat39/symbols-outline.nvim', 'simrat39/symbols-outline.nvim',
cmd = { 'SymbolsOutline', 'SymbolsOutlineOpen' }, cmd = { 'SymbolsOutline', 'SymbolsOutlineOpen' },
keys = {
vim.keymap.set('n', '<leader>o', ':SymbolsOutline<cr>'),
},
opts = { autofold_depth = 12 } opts = { autofold_depth = 12 }
}, },
{ {
@ -216,7 +253,10 @@ local plugins = {
} }
local vscode_plugins = { local vscode_plugins = {
{
"machakann/vim-sandwich", "machakann/vim-sandwich",
keys = "s"
},
{ {
"numToStr/Comment.nvim", "numToStr/Comment.nvim",
event = "BufEnter", event = "BufEnter",
@ -224,7 +264,6 @@ local vscode_plugins = {
require("Comment").setup() require("Comment").setup()
end end
}, },
"tpope/vim-fugitive"
} }
if vim.g.vscode then if vim.g.vscode then

View File

@ -1,11 +1,12 @@
local map = vim.api.nvim_set_keymap -- TODO: Use vim.keymap.set()
local map = vim.keymap.set
-- vscode -- vscode
if vim.g.vscode then if vim.g.vscode then
-- undo/REDO via vscode -- undo/REDO via vscode
map("n", "u", "<Cmd>call VSCodeNotify('undo')<CR>", {}) map("n", "u", "<Cmd>call VSCodeNotify('undo')<CR>")
map("n", "<C-r>", "<Cmd>call VSCodeNotify('redo')<CR>", {}) map("n", "<C-r>", "<Cmd>call VSCodeNotify('redo')<CR>")
map("n", "gf", "<Cmd>call VSCodeCall('editor.action.openLink')<CR>", { silent = true, noremap = true }) map("n", "gf", "<Cmd>call VSCodeCall('editor.action.openLink')<CR>", { noremap = true })
end end
-- generic mappings -- generic mappings
@ -16,28 +17,22 @@ map('n', 'n', 'nzzzv', { noremap = true })
map('n', 'N', 'Nzzzv', { noremap = true }) map('n', 'N', 'Nzzzv', { noremap = true })
-- Shortcutting split navigation -- Shortcutting split navigation
map('', '<A-h>', '<C-w>h', {}) map('', '<A-h>', '<C-w>h')
map('', '<A-j>', '<C-w>j', {}) map('', '<A-j>', '<C-w>j')
map('', '<A-k>', '<C-w>k', {}) map('', '<A-k>', '<C-w>k')
map('', '<A-l>', '<C-w>l', {}) map('', '<A-l>', '<C-w>l')
map('', '<A-H>', '<C-w>H', {}) map('', '<A-H>', '<C-w>H')
map('', '<A-J>', '<C-w>J', {}) map('', '<A-J>', '<C-w>J')
map('', '<A-K>', '<C-w>K', {}) map('', '<A-K>', '<C-w>K')
map('', '<A-L>', '<C-w>L', {}) map('', '<A-L>', '<C-w>L')
map('', '<M-S-.>', '<C-w>>', {}) map('', '<M-S-.>', '<C-w>>')
map('', '<M-S-,>', '<C-w><', {}) map('', '<M-S-,>', '<C-w><')
map('', '<M-S-=>', '<C-w>+', {}) map('', '<M-S-=>', '<C-w>+')
map('', '<M-->', '<C-w>-', {}) map('', '<M-->', '<C-w>-')
map('', '<A-T>', '<C-w>T', {}) map('', '<A-T>', '<C-w>T')
-- undo to the last , . or ! -- undo to the last , . or !
map('i', ',', ',<c-g>u', { noremap = true }) map('i', ',', ',<c-g>u', { noremap = true })
map('i', '.', '.<c-g>u', { noremap = true }) map('i', '.', '.<c-g>u', { noremap = true })
map('i', '!', '!<c-g>u', { noremap = true }) map('i', '!', '!<c-g>u', { noremap = true })
map('i', '?', '?<c-g>u', { noremap = true }) map('i', '?', '?<c-g>u', { noremap = true })
-- plugin mappings
-- symbols outline
map('n', '<leader>o', ':SymbolsOutline<cr>', { silent = true })
-- telescope
map('', '<leader>fd', ':Telescope fd<cr>', { silent = true })
map('', '<leader>bf', ':Telescope buffers<cr>', { silent = true })

View File

@ -57,7 +57,7 @@ cmp.setup({
{ name = 'nvim_lua' }, { name = 'nvim_lua' },
{ name = "treesitter" }, { name = "treesitter" },
{ name = "async_path" }, { name = "async_path" },
{ name = "git" }, { name = "gitmoji" },
{ name = "buffer" }, { name = "buffer" },
}), }),
completion = { completion = {
@ -75,16 +75,6 @@ cmp.setup.cmdline({ '/', '?' }, {
}, },
}) })
-- Set configuration for specific filetype.
cmp.setup.filetype('gitcommit', {
sources = cmp.config.sources(
{
{ name = 'buffer' },
}, {
{ name = 'gitmoji' }
})
})
-- `:` cmdline setup. -- `:` cmdline setup.
cmp.setup.cmdline(':', { cmp.setup.cmdline(':', {
mapping = cmp.mapping.preset.cmdline(), mapping = cmp.mapping.preset.cmdline(),
@ -97,7 +87,7 @@ cmp.setup.cmdline(':', {
{ {
name = 'cmdline', name = 'cmdline',
option = { option = {
ignore_cmds = { 'Man', '!' } ignore_cmds = {}
} }
} }
}) })

View File

@ -3,7 +3,6 @@
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float) vim.keymap.set('n', '<space>e', vim.diagnostic.open_float)
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev) vim.keymap.set('n', '[d', vim.diagnostic.goto_prev)
vim.keymap.set('n', ']d', vim.diagnostic.goto_next) vim.keymap.set('n', ']d', vim.diagnostic.goto_next)
vim.keymap.set('n', '<space>qf', vim.diagnostic.setloclist)
-- Use LspAttach autocommand to only map the following keys -- Use LspAttach autocommand to only map the following keys
-- after the language server attaches to the current buffer -- after the language server attaches to the current buffer
@ -29,7 +28,6 @@ vim.api.nvim_create_autocmd('LspAttach', {
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, opts) vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, opts)
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, opts) vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, opts)
vim.keymap.set({ 'n', 'v' }, '<space>ca', vim.lsp.buf.code_action, opts) vim.keymap.set({ 'n', 'v' }, '<space>ca', vim.lsp.buf.code_action, opts)
vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts)
vim.keymap.set('n', '<space>fm', function() vim.keymap.set('n', '<space>fm', function()
vim.lsp.buf.format { async = true } vim.lsp.buf.format { async = true }
end, opts) end, opts)

View File

@ -1,6 +1,12 @@
require('telescope').setup { local trouble = require("trouble.providers.telescope")
defaults = {layout_strategy = 'vertical', layout_config = {height = 0.95}},
pickers = {},
extensions = {}
}
require('telescope').setup {
defaults = { layout_strategy = 'vertical',
layout_config = { height = 0.95 },
mappings = {
i = { ["<c-t>"] = trouble.open_with_trouble },
n = { ["<c-t>"] = trouble.open_with_trouble },
},
},
}