diff --git a/lua/mappings.lua b/lua/mappings.lua index 815bf4d..364a021 100644 --- a/lua/mappings.lua +++ b/lua/mappings.lua @@ -18,14 +18,17 @@ map("v", "x", [=[ "_x ]=], opt) this line too ]] -- --- escape with 'jk' mapping -vim.api.nvim_set_keymap("i", "jk", "", {}) -vim.api.nvim_set_keymap("v", "jk", "", {}) -vim.api.nvim_set_keymap("t", "jk", "", {}) - -- Don't copy the replaced text after pasting in visual mode map("v", "p", '"_dP', opt) +-- Allow moving the cursor through wrapped lines with j, k, and +-- http://www.reddit.com/r/vim/comments/2k4cbr/problem_with_gj_and_gk/ +-- empty mode is same as using :map +map("", "j", 'v:count ? "j" : "gj"', {expr = true}) +map("", "k", 'v:count ? "k" : "gk"', {expr = true}) +map("", "", 'v:count ? "j" : "gj"', {expr = true}) +map("", "", 'v:count ? "k" : "gk"', {expr = true}) + -- OPEN TERMINALS -- map("n", "", ":vnew +terminal | setlocal nobuflisted ", opt) -- term over right map("n", "", ":10new +terminal | setlocal nobuflisted ", opt) -- term bottom diff --git a/lua/pluginList.lua b/lua/pluginList.lua index 6d476af..b7b79d8 100644 --- a/lua/pluginList.lua +++ b/lua/pluginList.lua @@ -16,6 +16,14 @@ return packer.startup( event = "VimEnter" } + use { + "jdhao/better-escape.vim", + event = "InsertEnter", + config = function() + require "plugins.others".escape() + end + } + use { "akinsho/nvim-bufferline.lua", after = "nvim-base16.lua", @@ -247,7 +255,7 @@ return packer.startup( use { "tpope/vim-fugitive", cmd = { - "Git" + "Git" } } end diff --git a/lua/plugins/others.lua b/lua/plugins/others.lua index 2278d09..0a060a6 100644 --- a/lua/plugins/others.lua +++ b/lua/plugins/others.lua @@ -15,6 +15,11 @@ M.comment = function() end end +M.escape = function() + vim.g.better_escape_interval = 300 + vim.g.better_escape_shortcut = {"jk"} +end + M.lspkind = function() local present, lspkind = pcall(require, "lspkind") if present then