local cwdopt = '{cwd = require("userfuncs").find_project_root()}' local noremap = {noremap = true} local snoremap = { noremap = true, silent = true } -- up and down between wrapped lines vim.api.nvim_set_keymap('', 'k', 'gk', snoremap) vim.api.nvim_set_keymap('', 'j', 'gj', snoremap) vim.api.nvim_set_keymap('', '', 'gk', snoremap) vim.api.nvim_set_keymap('', '', 'gj', snoremap) vim.api.nvim_set_keymap('i', '', 'gk', snoremap) vim.api.nvim_set_keymap('i', '', 'gj', snoremap) -- file navigation vim.api.nvim_set_keymap('n', '-', 'lua require("telescope").extensions.vinegar.file_browser()', noremap) vim.api.nvim_set_keymap('n', '', 'b#', noremap) vim.api.nvim_set_keymap('n', '-', 'lua require("telescope.builtin").find_files('..cwdopt..')', noremap) vim.api.nvim_set_keymap('n', '_', 'lua require("telescope.builtin").buffers('..cwdopt..')', noremap) vim.api.nvim_set_keymap('n', 'gg', 'lua require("telescope.builtin").live_grep('..cwdopt..')', noremap) -- lsp stuff vim.api.nvim_set_keymap('n', 'fu', 'Telescope lsp_references', noremap) vim.api.nvim_set_keymap('n', 'gd', 'Telescope lsp_definitions', noremap) vim.api.nvim_set_keymap('n', 'rn', 'lua vim.lsp.buf.rename()', noremap) vim.api.nvim_set_keymap('n', 'dn', 'lua vim.diagnostic.goto_next()', noremap) vim.api.nvim_set_keymap('n', 'dN', 'lua vim.diagnostic.goto_prev()', noremap) vim.api.nvim_set_keymap('n', 'xx', 'lua vim.lsp.buf.code_action()', noremap) -- dadbod stuff vim.cmd([[ augroup dadbod_keybindings autocmd! autocmd FileType sql nnoremap :'{,'}DB autocmd FileType sql vnoremap :DB autocmd FileType sql inoremap :'{,'}DB augroup end ]]) -- misc -- f2 gets highlight details of thing under cursor vim.api.nvim_set_keymap('n', '', 'echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . "> trans<" . synIDattr(synID(line("."),col("."),0),"name") . "> lo<" . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">"', noremap) -- f3 for synonym list under cursor vim.api.nvim_set_keymap('n', '', 'lua require("telescope").extensions.dict.synonyms()', noremap) -- replace z= with telescope spell_suggest vim.api.nvim_set_keymap('n', 'z=', 'Telescope spell_suggest', noremap) -- f12 for zen mode vim.api.nvim_set_keymap('n', '', 'TZAtaraxis', noremap) vim.api.nvim_set_keymap('', '', '', noremap) vim.api.nvim_set_keymap('', '', '', noremap) vim.api.nvim_set_keymap('', '', '<2-ScrollWheelLeft>', noremap) vim.api.nvim_set_keymap('', '', '<2-ScrollWheelRight>', noremap) vim.api.nvim_set_keymap('', '', '<3-ScrollWheelLeft>', noremap) vim.api.nvim_set_keymap('', '', '<3-ScrollWheelRight>', noremap) vim.api.nvim_set_keymap('', '', '<4-ScrollWheelLeft>', noremap) vim.api.nvim_set_keymap('', '', '<4-ScrollWheelRight>', noremap) vim.api.nvim_set_keymap('', '', '', noremap) vim.api.nvim_set_keymap('', '', '', noremap) vim.api.nvim_set_keymap('', '', '<2-ScrollWheelLeft>', noremap) vim.api.nvim_set_keymap('', '', '<2-ScrollWheelRight>', noremap) vim.api.nvim_set_keymap('', '', '<3-ScrollWheelLeft>', noremap) vim.api.nvim_set_keymap('', '', '<3-ScrollWheelRight>', noremap) vim.api.nvim_set_keymap('', '', '<4-ScrollWheelLeft>', noremap) vim.api.nvim_set_keymap('', '', '<4-ScrollWheelRight>', noremap)