-- ┌────────────────────────┐ -- │ ▗ │ -- │▛▚▀▖▝▀▖▛▀▖▛▀▖▄ ▛▀▖▞▀▌▞▀▘│ -- │▌▐ ▌▞▀▌▙▄▘▙▄▘▐ ▌ ▌▚▄▌▝▀▖│ -- │▘▝ ▘▝▀▘▌ ▌ ▀▘▘ ▘▗▄▘▀▀ │ -- └────────────────────────┘ -- -- map helper -- local function map(mode, lhs, rhs, opts) -- local options = {noremap = true, silent = true} -- if opts then options = vim.tbl_extend('force', options, opts) end -- vim.api.nvim_set_keymap(mode, lhs, rhs, options) -- end -- local cmd = vim.cmd -- local M = {} -- brute force deasciify everything vim.keymap.set("n", "tc", "TurkishDeasciifyForce()", { expr = true }) vim.keymap.set("n", "tctc", "TurkishDeasciifyForce() .. '_'", { expr = true }) vim.keymap.set("x", "tc", "TurkishDeasciifyForce()", { expr = true }) -- use turkish-mode to selectively deasciify vim.keymap.set("n", "tr", "TurkishDeasciify()", {expr = true}) vim.keymap.set("n", "trtr", "TurkishDeasciify() .. '_'", {expr = true}) vim.keymap.set("x", "tr", "TurkishDeasciify()", {expr = true}) -- ascii everything vim.keymap.set("n", "rt", "TurkishAsciify()", {expr = true}) vim.keymap.set("n", "rtrt", "TurkishAsciify() .. '_'", {expr = true}) vim.keymap.set("x", "rt", "TurkishAsciify()", {expr = true}) -- https://stackoverflow.com/questions/4256697/vim-search-and-highlight-but-do-not-jump -- search & highlight but do not jump vim.keymap.set("n", "*", ":keepjumps normal! mi*`i") vim.keymap.set("n", "#", ":keepjumps normal! mi#`i") -- save file as sudo on files that require root permission vim.keymap.set("c", "w!!", 'execute "silent! write !sudo tee % >/dev/null" edit!', { silent = false }) -- replace ex mode with gq (format lines) vim.keymap.set('n', 'Q', 'gq') -- set formatprg to sentences, for prose vim.keymap.set('n', 'fp', ":set formatprg=~/.local/bin/sentences", { silent = false }) -- replace all is aliased to S. vim.keymap.set('n', 'S', ':%s//g', { silent = false }) vim.keymap.set('v', 'S', ':s//g', { silent = false }) -- jump to buffer vim.keymap.set('n', 'b', ':ls:b') -- up and down are more logical with g.. vim.keymap.set('n', 'k', '(v:count == 0 ? "gk" : "k")', { expr = true }) vim.keymap.set('n', 'j', '(v:count == 0 ? "gj" : "j")', { expr = true }) vim.keymap.set('i', '', 'gka') vim.keymap.set('i', '', 'gja') -- space used to toggle folds, now it's x (because x is d) vim.keymap.set('n', '', '"_x') -- separate cut and delete vim.keymap.set('n', 'x', 'd') vim.keymap.set('x', 'x', 'd') vim.keymap.set('n', 'xx', 'dd') vim.keymap.set('n', 'X', 'D') -- change into pwd of current directory vim.keymap.set('n', 'cd', ':lcd %:p:h:pwd') -- press \g and start writing prose vim.keymap.set('n', 'g', ':Goyo') -- call CreatePaper on word below cursor vim.keymap.set('n', 'np', 'gewi[[/papers/Ea]]bb:call CreatePaper(expand(""))') -- link paper vim.keymap.set('n', 'lp', 'gewi[[/papers/Ea]]') -- call CreateReference on word below cursor vim.keymap.set('n', 'nr', ':call CreateReference(expand(""))') -- create a new note vim.keymap.set('n', 'nn', ':call CreateNote()') -- :%% to get current file path vim.keymap.set('c', '%%', "getcmdtype() == ':' ? expand('%:h').'/' : '%%'", { expr = true, silent = false }) -- reselect visual selection after indent vim.keymap.set('v', '>', '>gv') vim.keymap.set('v', '<', ' mappings should not be noremap -- -- https://www.reddit.com/r/vim/comments/78izt4/please_help_understand_how_to_use_plug_mapping/ -- local function plugmap(mode, lhs, rhs, opts) -- local options = {noremap = false, silent = true} -- if opts then options = vim.tbl_extend('force', options, opts) end -- vim.api.nvim_set_keymap(mode, lhs, rhs, options) -- end -- sneak using grave, s is for sandwich vim.keymap.set('n', '`', 'Sneak_s') vim.keymap.set('n', '`', 'Sneak_s') vim.keymap.set('n', '`', 'Sneak_S') vim.keymap.set('n', "'", '`') -- use the special yoink paste that rotates vim.keymap.set('n', 'p', '(YoinkPaste_p)') vim.keymap.set('n', 'P', '(YoinkPaste_P)') -- substitute from yank vim.keymap.set('n', 'ys', '(SubversiveSubstitute)') vim.keymap.set('n', 'yss', '(SubversiveSubstituteLine)') vim.keymap.set('n', 'yS', '(SubversiveSubstituteToEndOfLine)') -- substitute over range vim.keymap.set('n', 's', '(SubversiveSubstituteRange)') vim.keymap.set('x', 's', '(SubversiveSubstituteRange)') vim.keymap.set('n', 'ss', '(SubversiveSubstituteWordRange)') -- subvert over range vim.keymap.set('n', 's', '(SubversiveSubvertRange)') vim.keymap.set('x', 's', '(SubversiveSubvertRange)') vim.keymap.set('n', 'ss', '(SubversiveSubvertWordRange)') -- iterate over yank list vim.keymap.set('n', '', '(YoinkPostPasteSwapBack)') vim.keymap.set('n', '', '(YoinkPostPasteSwapForward)') -- checkmarks on vimwiki vim.keymap.set('n', 'v', 'VimwikiToggleListItem') -- add/increase header level vim.keymap.set('n', 'a', 'VimwikiAddHeaderLevel') -- vim-test bindings vim.keymap.set('n', 't', ':TestNearest') vim.keymap.set('n', 't', ':TestFile') vim.keymap.set('n', 't', ':TestSuite') vim.keymap.set('n', 't', ':TestLast') vim.keymap.set('n', 't', ':TestVisit') -- telescope bindings vim.keymap.set('n', 'ff', "lua require('telescope.builtin').find_files()") vim.keymap.set('n', 'fg', "lua require('telescope.builtin').live_grep()") vim.keymap.set('n', 'fb', "lua require('telescope.builtin').buffers()") vim.keymap.set('n', 'fh', "lua require('telescope.builtin').help_tags()") -- vista vim.keymap.set('n', '', ":Vista focus") vim.keymap.set('n', '', ":Vista finder") -- nvim tree mappings vim.keymap.set('n', 'vt', ':NvimTreeToggle') vim.keymap.set('n', 'vr', ':NvimTreeRefresh') vim.keymap.set('n', 'vs', ':NvimTreeFindFile') -- dial.nvim mappings vim.keymap.set("n", "", require("dial.map").inc_normal(), {noremap = true}) vim.keymap.set("n", "", require("dial.map").dec_normal(), {noremap = true}) vim.keymap.set("v", "", require("dial.map").inc_visual(), {noremap = true}) vim.keymap.set("v", "", require("dial.map").dec_visual(), {noremap = true}) vim.keymap.set("v", "g", require("dial.map").inc_gvisual(), {noremap = true}) vim.keymap.set("v", "g", require("dial.map").dec_gvisual(), {noremap = true}) -- }}} plug mappings --