move some keymaps to the corresponding plugin configs

This commit is contained in:
Oliver Hartmann 2022-12-05 14:44:29 +01:00
parent e111deabc9
commit bce0373dfb
4 changed files with 138 additions and 114 deletions

View File

@ -1,3 +1,13 @@
require('Comment').setup({
mappings = false,
})
require('legendary').keymap(
{
'<c-c>',
{
n = '<Plug>(comment_toggle_linewise_current)',
v = '<Plug>(comment_toggle_linewise_visual)gv'
},
description = 'Toggle comment'
}
)

View File

@ -1,94 +1,36 @@
require('legendary').setup({
default_opts = {
keymaps = { silent = true },
commands = {},
autocmds = {},
},
keymaps = {
{
'<Leader>p',
':Legendary keymaps<CR>',
function()
require("legendary").find()
end,
description = 'legendary keymaps',
mode = { 'n', 'x', 'i' }
},
{
'F2',
'<CMD>tabnew .<CR>',
'<F2>',
':tabnew .<CR>',
description = 'Open a new tab',
},
{
'<C-F2>',
'<CMD>vsplit .<CR>',
':vsplit .<CR>',
description = 'Open a new vertical split',
},
{
'<S-F2>',
'<CMD>split .<CR>',
':split .<CR>',
description = 'Open a new horizontal split',
},
{
'<leader>n',
'<CMD>Neogen<CR>',
description = 'Add comment',
},
{
'<space>p',
'<CMD>Telescope projects<CR>',
description = 'Select project',
},
{
'<leader>f',
'<CMD>lua require("telescope.builtin").find_files({no_ignore=true})<CR>',
description = 'Find file',
},
{
'<leader>g',
'<CMD>lua project_files()<CR>',
description = 'Find git files',
},
{
'<leader>o',
'<CMD>Telescope oldfiles<CR>',
description = 'Find old files',
},
{
'<leader>h',
'<CMD>Telescope command_history<CR>',
description = 'Open command history',
},
{
'<leader>b',
'<CMD>Telescope buffers<CR>',
description = 'Select buffer',
},
{
'<leader>q',
'<CMD>Telescope quickfix<CR>',
description = 'Quickfix list with telescope',
},
{
'<leader>l',
'<CMD>Telescope live_grep<CR>',
description = 'Search in project',
},
{
'<C-y>',
'<CMD>Telescope neoclip<CR>',
description = 'Open clipboard history',
},
{
'<leader>j',
'<CMD>Telescope jumplist<CR>',
description = 'Open jumplist',
},
{
'<c-f>',
'<CMD>Telescope current_buffer_fuzzy_find<CR>',
description = 'Find in buffer',
},
{
'<leader>d',
'<CMD>Telescope grep_string<CR>',
description = 'Find in workspace',
},
{
'<Space>g',
'<CMD>lua _lazygit_toggle()<CR>',
':lua _lazygit_toggle()<CR>',
description = 'Open lazygit',
},
{
@ -111,64 +53,56 @@ require('legendary').setup({
'<Plug>(YankyCycleBackward)',
description = 'Yanky cycle backward',
},
{
'<c-c>',
{
n = '<Plug>(comment_toggle_linewise_current)',
v = '<Plug>(comment_toggle_linewise_visual)gv'
},
description = 'Toggle comment'
},
{
'<leader>s',
'<CMD>AerialToggle<CR>',
':AerialToggle<CR>',
description = 'Symbols outline',
},
},
commands =
{
{
'<CMD>Octo pr list<CR>',
':Octo pr list<CR>',
description = 'Github list PRs',
},
{
'<CMD>Octo pr checkout<CR>',
':Octo pr checkout<CR>',
description = 'Github checkout PR',
},
{
'<CMD>Octo pr browser<CR>',
':Octo pr browser<CR>',
description = 'Github open PR in browser',
},
{
'<CMD>set guifont=JetBrainsMonoNL\\ NF:h12<CR>',
':set guifont=JetBrainsMonoNL\\ NF:h12<CR>',
description = 'Big font size',
},
{
'<CMD>set guifont=JetBrainsMonoNL\\ NF:h9<CR>',
':set guifont=JetBrainsMonoNL\\ NF:h9<CR>',
description = 'Reset font size',
},
{
'<CMD>CMake build_all<CR>',
':CMake build_all<CR>',
description = 'CMake build all',
},
{
'<CMD>CMake configure<CR>',
':CMake configure<CR>',
description = 'CMake configure',
},
{
'<CMD>CMake select_target<CR>',
':CMake select_target<CR>',
description = 'CMake select target',
},
{
'<CMD>CMake clear_cache<CR>',
':CMake clear_cache<CR>',
description = 'CMake clear cache',
},
{
'<CMD>LuaSnipListAvailable<CR>',
':LuaSnipListAvailable<CR>',
description = 'List snippets',
},
{
"<CMD>lua require('telescope.builtin').live_grep({ prompt_title = 'find string in open buffers...', grep_open_files = true })<CR>",
":lua require('telescope.builtin').live_grep({ prompt_title = 'find string in open buffers...', grep_open_files = true })<CR>",
description = 'Search in open files',
},

View File

@ -18,3 +18,12 @@ require('neogen').setup({
},
},
})
require('legendary').keymaps(
{
{
'<leader>n',
':Neogen<CR>',
description = 'Add comment',
}
}
)

View File

@ -53,3 +53,74 @@ require('telescope').setup({
})
require('telescope').load_extension('fzf')
Project_files = function()
local opts = {} -- define here if you want to define something
local ok = pcall(require "telescope.builtin".git_files, opts)
if not ok then require "telescope.builtin".find_files(opts) end
end
require('legendary').keymaps(
{
{
'<space>p',
':Telescope projects<CR>',
description = 'Select project',
},
{
'<leader>f',
':lua require("telescope.builtin").find_files({no_ignore=true})<CR>',
description = 'Find file',
},
{
'<leader>g',
':lua Project_files()<CR>',
description = 'Find git files',
},
{
'<leader>o',
':Telescope oldfiles<CR>',
description = 'Find old files',
},
{
'<leader>h',
':Telescope command_history<CR>',
description = 'Open command history',
},
{
'<leader>b',
':Telescope buffers<CR>',
description = 'Select buffer',
},
{
'<leader>q',
':Telescope quickfix<CR>',
description = 'Quickfix list with telescope',
},
{
'<leader>l',
':Telescope live_grep<CR>',
description = 'Search in project',
},
{
'<C-y>',
':Telescope neoclip<CR>',
description = 'Open clipboard history',
},
{
'<leader>j',
':Telescope jumplist<CR>',
description = 'Open jumplist',
},
{
'<c-f>',
':Telescope current_buffer_fuzzy_find<CR>',
description = 'Find in buffer',
},
{
'<leader>d',
':Telescope grep_string<CR>',
description = 'Find in workspace',
}
}
)