refactor: clean up some mappings and lazy loading
This commit is contained in:
parent
66f29d878b
commit
0aef3f630b
4 changed files with 17 additions and 20 deletions
|
@ -5,14 +5,19 @@ map('n', '<leader>ck', ':cexpr []<cr>')
|
||||||
map('n', '<leader>cc', ':cclose <cr>')
|
map('n', '<leader>cc', ':cclose <cr>')
|
||||||
map('n', '<leader>co', ':copen <cr>')
|
map('n', '<leader>co', ':copen <cr>')
|
||||||
map('n', '<leader>cf', ':cfdo %s/')
|
map('n', '<leader>cf', ':cfdo %s/')
|
||||||
|
map('n', '<leader>cp', ':cprev<cr>zz')
|
||||||
|
map('n', '<leader>cn', ':cnext<cr>zz')
|
||||||
|
|
||||||
-- Resize with arrows
|
-- buffer navigation
|
||||||
|
map('n', '<leader>bp', ':bprev<cr>')
|
||||||
|
map('n', '<leader>bn', ':bnext<cr>')
|
||||||
|
|
||||||
|
-- tab navigation
|
||||||
|
map('n', '<leader>tp', ':tabprevious<cr>')
|
||||||
|
map('n', '<leader>tn', ':tabnext<cr>')
|
||||||
|
|
||||||
|
-- resize with arrows
|
||||||
map('n', '<C-Up>', ':resize -2<CR>')
|
map('n', '<C-Up>', ':resize -2<CR>')
|
||||||
map('n', '<C-Down>', ':resize +2<CR>')
|
map('n', '<C-Down>', ':resize +2<CR>')
|
||||||
map('n', '<C-Left>', ':vertical resize -2<CR>')
|
map('n', '<C-Left>', ':vertical resize -2<CR>')
|
||||||
map('n', '<C-Right>', ':vertical resize +2<CR>')
|
map('n', '<C-Right>', ':vertical resize +2<CR>')
|
||||||
|
|
||||||
require('cosmic.plugins.auto-session.mappings')
|
|
||||||
require('cosmic.plugins.telescope.mappings').init()
|
|
||||||
require('cosmic.plugins.nvim-tree.mappings')
|
|
||||||
require('cosmic.plugins.terminal.mappings')
|
|
||||||
|
|
|
@ -61,6 +61,7 @@ return packer.startup(function()
|
||||||
'kyazdani42/nvim-tree.lua',
|
'kyazdani42/nvim-tree.lua',
|
||||||
config = function()
|
config = function()
|
||||||
require('cosmic.plugins.nvim-tree')
|
require('cosmic.plugins.nvim-tree')
|
||||||
|
require('cosmic.plugins.nvim-tree.mappings')
|
||||||
end,
|
end,
|
||||||
opt = true,
|
opt = true,
|
||||||
cmd = {
|
cmd = {
|
||||||
|
@ -168,9 +169,10 @@ return packer.startup(function()
|
||||||
use({
|
use({
|
||||||
'voldikss/vim-floaterm',
|
'voldikss/vim-floaterm',
|
||||||
opt = true,
|
opt = true,
|
||||||
cmd = { 'FloatermToggle', 'FloatermNew', 'FloatermSend' },
|
event = 'BufWinEnter',
|
||||||
config = function()
|
config = function()
|
||||||
require('cosmic.plugins.terminal')
|
require('cosmic.plugins.terminal')
|
||||||
|
require('cosmic.plugins.terminal.mappings')
|
||||||
end,
|
end,
|
||||||
disable = vim.tbl_contains(user_plugins.disable, 'terminal'),
|
disable = vim.tbl_contains(user_plugins.disable, 'terminal'),
|
||||||
})
|
})
|
||||||
|
@ -187,6 +189,7 @@ return packer.startup(function()
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
|
require('cosmic.plugins.telescope.mappings').init()
|
||||||
require('cosmic.plugins.telescope')
|
require('cosmic.plugins.telescope')
|
||||||
end,
|
end,
|
||||||
event = 'BufWinEnter',
|
event = 'BufWinEnter',
|
||||||
|
@ -206,6 +209,7 @@ return packer.startup(function()
|
||||||
'rmagatti/auto-session',
|
'rmagatti/auto-session',
|
||||||
config = function()
|
config = function()
|
||||||
require('cosmic.plugins.auto-session')
|
require('cosmic.plugins.auto-session')
|
||||||
|
require('cosmic.plugins.auto-session.mappings')
|
||||||
end,
|
end,
|
||||||
disable = vim.tbl_contains(user_plugins.disable, 'auto-session'),
|
disable = vim.tbl_contains(user_plugins.disable, 'auto-session'),
|
||||||
})
|
})
|
||||||
|
|
|
@ -6,5 +6,5 @@ map('n', '<leader>ss', '<cmd>SaveSession<cr>')
|
||||||
map(
|
map(
|
||||||
'n',
|
'n',
|
||||||
'<leader>si',
|
'<leader>si',
|
||||||
'<cmd>lua require("cosmic.utils.logger"):log(require("auto-session-library").current_session_name())<cr>'
|
'<cmd>lua require("cosmic.utils.logger"):log("Session name: " .. require("auto-session-library").current_session_name())<cr>'
|
||||||
)
|
)
|
||||||
|
|
|
@ -20,18 +20,6 @@ M.init = function()
|
||||||
-- git navigation
|
-- git navigation
|
||||||
map('n', '<leader>ggc', ':Telescope git_commits<cr>')
|
map('n', '<leader>ggc', ':Telescope git_commits<cr>')
|
||||||
map('n', '<leader>ggs', ':Telescope git_status<cr>')
|
map('n', '<leader>ggs', ':Telescope git_status<cr>')
|
||||||
|
|
||||||
-- quickfix navigation
|
|
||||||
map('n', '<leader>cp', ':cprev<cr>zz')
|
|
||||||
map('n', '<leader>cn', ':cnext<cr>zz')
|
|
||||||
|
|
||||||
-- buffer navigation
|
|
||||||
map('n', '<leader>bp', ':bprev<cr>')
|
|
||||||
map('n', '<leader>bn', ':bnext<cr>')
|
|
||||||
|
|
||||||
-- tab navigation
|
|
||||||
map('n', '<leader>tp', ':tabprevious<cr>')
|
|
||||||
map('n', '<leader>tn', ':tabnext<cr>')
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
Loading…
Add table
Reference in a new issue