--[[ &&& &##& █████╗ ██╗ ███████╗███╗ ███╗██╗ &##& ██╔══██╗██║ ██╔════╝████╗ ████║██║ BB& ███████║██║ █████╗ ██╔████╔██║██║ &GB & ██╔══██║██║ ██╔══╝ ██║╚██╔╝██║██║ &GB &BGBBBBBBBB###& ██║ ██║███████╗███████╗██║ ╚═╝ ██║██║ GG &GGGGGGGGGGGGGB#& ╚═╝ ╚═╝╚══════╝╚══════╝╚═╝ ╚═╝╚═╝ #P# &&#BGGGGGGGGGGG# nvim keybinds BP& &GGGGGGGGGB# &#BGPP& &#BGGGGGGGB# * keybinds are scoped in methods and &#BGGGGGPP& &&#BGGGGGGB##& only enabled if the relevant plugin &#GPPPGGGGGBPB &&##BGGGGGBB#&& is loaded #PPPPPPPGGPG BP& &&##BBGGGGGGBB#&& * binds are kinda arbitrary, if you PPPPPPPPPPPPGBPG&&& &&&&&&###BBBGGGGGGGBB##&& have good suggestions tell me &BGPPPPPPPPPPPPPPGGGGGGGGGGGGGGGGGGGBBB##&&& about it &&##BBBBGGGGGGGPGBBBBBB####&&&& &#B#& && ###& &G# &&#&&& &&& ]]-- local MAPPINGS = { } --|| GLOBAL KEYBINDS function MAPPINGS:set_global_keys(opts) -- Quick settings vim.keymap.set('n', '', ':set hls!', opts) vim.keymap.set('n', '', ':set wrap!', opts) vim.keymap.set('n', '', ':set list!', opts) vim.keymap.set('n', '', ':set spell!', opts) vim.keymap.set('n', '', ':Hexmode', opts) vim.keymap.set('n', '', ':Telescope oldfiles', opts) -- Files navigation vim.keymap.set('n', '', ':tabnew', opts) vim.keymap.set('n', '', ':tabnew', opts) -- fallback for windows vim.keymap.set('n', '', ':NvimTreeToggle', {noremap=true}) -- Esc goes back to normal mode in terminal vim.keymap.set('t', '', '', opts) end function MAPPINGS:set_navigation_keys(opts) -- lazy arrow scrolling vim.keymap.set('n', '', '', opts) vim.keymap.set('n', '', '', opts) vim.keymap.set('n', '', '', opts) vim.keymap.set('n', '', '', opts) vim.keymap.set('n', '', ':resize +1', opts) vim.keymap.set('n', '', ':resize -1', opts) vim.keymap.set('n', '', ':vertical resize +1', opts) vim.keymap.set('n', '', ':vertical resize -1', opts) end function MAPPINGS:set_lsp_keys(opts) -- Enable completion triggered by vim.api.nvim_buf_set_option(opts.buffer, 'omnifunc', 'v:lua.vim.lsp.omnifunc') -- Enable Lsp tagfunc vim.api.nvim_buf_set_option(opts.buffer, 'tagfunc', 'v:lua.vim.lsp.tagfunc') -- See `:help vim.lsp.*` for documentation on any of the below functions vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts) vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts) vim.keymap.set('n', 'gy', vim.lsp.buf.type_definition, opts) vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts) vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts) vim.keymap.set('n', '', vim.lsp.buf.hover, opts) vim.keymap.set('n', '', vim.lsp.buf.hover, opts) vim.keymap.set('n', '', vim.lsp.buf.signature_help, opts) -- vim.keymap.set('n', 'wa', vim.lsp.buf.add_workspace_folder, opts) -- vim.keymap.set('n', 'wr', vim.lsp.buf.remove_workspace_folder, opts) vim.keymap.set('n', '', vim.lsp.buf.rename, opts) vim.keymap.set('n', '', vim.lsp.buf.code_action, opts) vim.keymap.set('n', '', vim.lsp.buf.formatting, opts) vim.keymap.set('n', '', vim.diagnostic.open_float, opts) vim.keymap.set('n', '', vim.diagnostic.open_float, opts) -- fallback for windows -- It's not really a keybind but whatever vim.api.nvim_create_user_command('Format', ':lua vim.lsp.buf.formatting()', {}) -- TODO if function is passed directly, it doesn't work! end function MAPPINGS:set_telescope_keys(opts) -- File navigation vim.keymap.set('n', '', ':Telescope find_files', opts) vim.keymap.set('n', 'F', ':Telescope find_files', opts) -- fallback for windows vim.keymap.set('n', '', ':Telescope live_grep', opts) vim.keymap.set('n', '', ':Telescope live_grep', opts) -- fallback for windows vim.keymap.set('n', '', ':Telescope lsp_references', opts) vim.keymap.set('n', '', ':Telescope git_bcommits', opts) vim.keymap.set('n', '', ':Telescope git_bcommits', opts) -- fallback for windows -- Marks and buffers with telescope vim.keymap.set('n', '', ':Telescope buffers', opts) vim.keymap.set('n', '', ':Telescope marks', opts) vim.keymap.set('n', '', ':Telescope marks', opts) -- fallback for windows vim.keymap.set('n', '', ':Telescope current_buffer_fuzzy_find', opts) vim.keymap.set('n', '', ':Telescope current_buffer_fuzzy_find', opts) -- fallback for windows -- Symbols with telescope vim.keymap.set('n', '', ':Telescope lsp_document_symbols', opts) vim.keymap.set('n', '', ':Telescope lsp_workspace_symbols', opts) vim.keymap.set('n', '', ':Telescope lsp_workspace_symbols', opts) -- fallback for windows -- Error list with telescope vim.keymap.set('n', '', ':Telescope diagnostics', opts) vim.keymap.set('n', '', ':Telescope diagnostics bufnr=0', opts) end return MAPPINGS