summaryrefslogtreecommitdiff
path: root/.config
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2023-11-07 04:01:31 +0100
committerThomas Voss <mail@thomasvoss.com> 2023-11-07 04:01:31 +0100
commit5a0c981679093abe6185fc9782a172bfc41f8252 (patch)
tree05a7bc6bad08cced66382be4b0e937c6a0fdd919 /.config
parent2653fc8a4946863324b279fa4087707d0bffecb7 (diff)
nvim: Rework sorting and transposition
Diffstat (limited to '.config')
-rw-r--r--.config/nvim/lua/mango/packer.lua1
-rw-r--r--.config/nvim/lua/mango/remap.lua19
2 files changed, 5 insertions, 15 deletions
diff --git a/.config/nvim/lua/mango/packer.lua b/.config/nvim/lua/mango/packer.lua
index 83e0ff3..02aa11a 100644
--- a/.config/nvim/lua/mango/packer.lua
+++ b/.config/nvim/lua/mango/packer.lua
@@ -23,6 +23,7 @@ return require('packer').startup(function(use)
use 'kylechui/nvim-surround'
use 'mattn/emmet-vim'
use 'tpope/vim-commentary'
+ use 'christoomey/vim-sort-motion'
-- Git integration
use 'tpope/vim-fugitive'
diff --git a/.config/nvim/lua/mango/remap.lua b/.config/nvim/lua/mango/remap.lua
index 824ad53..2c41cfc 100644
--- a/.config/nvim/lua/mango/remap.lua
+++ b/.config/nvim/lua/mango/remap.lua
@@ -42,18 +42,10 @@ remap('i', '<C-+>', '"+pa')
remap('nv', "'", '`')
remap('nv', '`', "'")
--- Transpose characters without clobbering registers
-local function transpose_chars(rev)
- lib.save_regs('a', function()
- vim.cmd.normal('"a' .. (rev and 'X' or 'x') .. '"ap')
- end)
-end
-
--- Transpose characters
-remap('n', '<leader>t', transpose_chars)
-remap('n', '<leader>T', function()
- transpose_chars(true)
-end)
+-- Transpose characters; for some reason it has a noticable delay if I just give
+-- a string instead of lambda functions
+remap('n', '<leader>t', function() vim.cmd.normal('"zx"zp') end)
+remap('n', '<leader>T', function() vim.cmd.normal('"zX"zp') end)
-- Open netrw quickly
remap('n', '-', ':Ex<CR>')
@@ -63,6 +55,3 @@ remap('n', '-', ':Ex<CR>')
-- bottom instead of the left or top
remap('n', '–', ':vsplit | Ex<CR>')
remap('n', 'g–', ':split | Ex<CR>')
-
--- Sort lines in selection
-remap('v', 's', ':sort<CR>')