🐛 Neogit and more optimizations

Signed-off-by: Ryan <ryan@alien.gov>
This commit is contained in:
Ryan 2023-11-28 13:02:36 +08:00
parent 5efca0c97c
commit 95765a5087
3 changed files with 41 additions and 41 deletions

View File

@ -95,7 +95,13 @@ local plugins = {
},
{
"Dynge/gitmoji.nvim",
ft = "gitcommit",
ft = { "gitcommit", "NeogitCommitMessage" },
opts = {
filetypes = { "gitcommit", "octo", "NeogitCommitMessage" },
completion = {
append_space = true,
},
},
dependencies = "hrsh7th/nvim-cmp"
},
{
@ -151,8 +157,12 @@ local plugins = {
},
{
"nvim-telescope/telescope.nvim",
dependencies = { 'nvim-lua/plenary.nvim'},
dependencies = { 'nvim-lua/plenary.nvim' },
event = "CmdlineEnter",
keys = {
vim.keymap.set('', '<leader>fd', ':Telescope fd<cr>'),
vim.keymap.set('', '<leader>bf', ':Telescope buffers<cr>'),
},
config = function()
require("plugins.telescope")
end
@ -202,6 +212,9 @@ local plugins = {
{
'simrat39/symbols-outline.nvim',
cmd = { 'SymbolsOutline', 'SymbolsOutlineOpen' },
keys = {
vim.keymap.set('n', '<leader>o', ':SymbolsOutline<cr>'),
},
opts = { autofold_depth = 12 }
},
{
@ -240,7 +253,10 @@ local plugins = {
}
local vscode_plugins = {
"machakann/vim-sandwich",
{
"machakann/vim-sandwich",
keys = "s"
},
{
"numToStr/Comment.nvim",
event = "BufEnter",
@ -248,7 +264,6 @@ local vscode_plugins = {
require("Comment").setup()
end
},
"tpope/vim-fugitive"
}
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
if vim.g.vscode then
-- undo/REDO via vscode
map("n", "u", "<Cmd>call VSCodeNotify('undo')<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", "u", "<Cmd>call VSCodeNotify('undo')<CR>")
map("n", "<C-r>", "<Cmd>call VSCodeNotify('redo')<CR>")
map("n", "gf", "<Cmd>call VSCodeCall('editor.action.openLink')<CR>", { noremap = true })
end
-- generic mappings
@ -16,28 +17,22 @@ map('n', 'n', 'nzzzv', { noremap = true })
map('n', 'N', 'Nzzzv', { noremap = true })
-- Shortcutting split navigation
map('', '<A-h>', '<C-w>h', {})
map('', '<A-j>', '<C-w>j', {})
map('', '<A-k>', '<C-w>k', {})
map('', '<A-l>', '<C-w>l', {})
map('', '<A-H>', '<C-w>H', {})
map('', '<A-J>', '<C-w>J', {})
map('', '<A-K>', '<C-w>K', {})
map('', '<A-L>', '<C-w>L', {})
map('', '<M-S-.>', '<C-w>>', {})
map('', '<M-S-,>', '<C-w><', {})
map('', '<M-S-=>', '<C-w>+', {})
map('', '<M-->', '<C-w>-', {})
map('', '<A-T>', '<C-w>T', {})
map('', '<A-h>', '<C-w>h')
map('', '<A-j>', '<C-w>j')
map('', '<A-k>', '<C-w>k')
map('', '<A-l>', '<C-w>l')
map('', '<A-H>', '<C-w>H')
map('', '<A-J>', '<C-w>J')
map('', '<A-K>', '<C-w>K')
map('', '<A-L>', '<C-w>L')
map('', '<M-S-.>', '<C-w>>')
map('', '<M-S-,>', '<C-w><')
map('', '<M-S-=>', '<C-w>+')
map('', '<M-->', '<C-w>-')
map('', '<A-T>', '<C-w>T')
-- 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 })
-- 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 = "treesitter" },
{ name = "async_path" },
{ name = "git" },
{ name = "gitmoji" },
{ name = "buffer" },
}),
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.
cmp.setup.cmdline(':', {
mapping = cmp.mapping.preset.cmdline(),
@ -97,7 +87,7 @@ cmp.setup.cmdline(':', {
{
name = 'cmdline',
option = {
ignore_cmds = { 'Man', '!' }
ignore_cmds = {}
}
}
})
@ -108,6 +98,6 @@ cmp.setup.cmdline(':', {
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
local cmp = require('cmp')
cmp.event:on(
'confirm_done',
cmp_autopairs.on_confirm_done()
'confirm_done',
cmp_autopairs.on_confirm_done()
)