mirror of
https://github.com/sadan4/nvim.git
synced 2025-01-18 03:03:29 -05:00
add vscode split maps and home + end on home row
This commit is contained in:
parent
0578041126
commit
eed2d26842
3 changed files with 91 additions and 9 deletions
15
lua/generateVscodeJson.mjs
Executable file
15
lua/generateVscodeJson.mjs
Executable file
|
@ -0,0 +1,15 @@
|
|||
#!/usr/bin/env node
|
||||
const keys = "lkjhcq34erpo095\\fud";
|
||||
|
||||
/**
|
||||
* @param key {string}
|
||||
*/
|
||||
const makeKeymapping = (key) => {
|
||||
return {
|
||||
key: `ctrl+shift+alt+${key.toLowerCase()}`,
|
||||
command: "vscode-neovim.send",
|
||||
when: "editorTextFocus && neovim.mode !== insert",
|
||||
args: `<M-C-S-${key.toUpperCase()}>`
|
||||
}
|
||||
}
|
||||
console.log(JSON.stringify(keys.split("").map(makeKeymapping)))
|
|
@ -4,6 +4,12 @@ vim.g.mapleader = " "
|
|||
|
||||
vim.keymap.set("n", "<C-b>", "<Nop>");
|
||||
vim.keymap.set("n", "<C-f>", "<Nop>");
|
||||
-- <S-k> is mapped to hover
|
||||
-- unmap <S-j>
|
||||
vim.keymap.set({"v", "n"}, "J", "<Nop>")
|
||||
-- use <S-h> for home and <S-l> for end
|
||||
vim.keymap.set({"n", "v", "o"}, "H", "g^")
|
||||
vim.keymap.set({"n", "v", "o"}, "L", "g_")
|
||||
-- find Files
|
||||
vim.keymap.set("n", "<C-f>f", tb.find_files, {})
|
||||
-- find Text
|
||||
|
|
|
@ -25,7 +25,7 @@ end)
|
|||
vim.keymap.set("n", "<leader>lg", function()
|
||||
vsc.action("lazygit.openLazygit")
|
||||
end)
|
||||
vim.keymap.set({"n", "i", "v"}, "<C-c>", "<CMD>echoe \"Use Caps\"<CR>")
|
||||
vim.keymap.set({ "n", "i", "v" }, "<C-c>", '<CMD>echoe "Use Caps"<CR>')
|
||||
-- for some reason, this plugin does not work with keymaps that start with <C-f>
|
||||
-- they are done through vsc
|
||||
--
|
||||
|
@ -42,7 +42,7 @@ vim.keymap.set("n", "<leader>e", function()
|
|||
-- print((":e " .. string.gsub(vim.fn.expand("%"), '(.*/)(.*)', '%1')));
|
||||
vim.api.nvim_feedkeys((":e " .. string.gsub(vim.fn.expand("%"), "(.*/)(.*)", "%1")), "L", false)
|
||||
end)
|
||||
vim.keymap.set("n", "<leader>c", ":let @+=@\"<CR>")
|
||||
vim.keymap.set("n", "<leader>c", ':let @+=@"<CR>')
|
||||
vim.keymap.set("n", "<C-k>z", function()
|
||||
vsc.action("workbench.action.toggleZenMode")
|
||||
end)
|
||||
|
@ -52,3 +52,64 @@ vim.keymap.set("v", "<leader>h", ":S/", {
|
|||
vim.keymap.set("n", "<leader>h", ":%S/", {
|
||||
noremap = true,
|
||||
})
|
||||
-- unmap <S-j>
|
||||
vim.keymap.set({ "v", "n" }, "J", "<Nop>")
|
||||
-- use <S-h> for home and <S-l> for end
|
||||
vim.keymap.set({ "n", "v", "o" }, "H", "g^")
|
||||
vim.keymap.set({ "n", "v", "o" }, "L", "g_")
|
||||
-- make #, closer to the cursor, fw search and * bw
|
||||
vim.keymap.set("n", "#", "*", {
|
||||
noremap = true,
|
||||
})
|
||||
vim.keymap.set("n", "*", "#", {
|
||||
noremap = true,
|
||||
})
|
||||
local function stupid(mode, lhs, rhs, args)
|
||||
vim.keymap.set(mode, lhs, function()
|
||||
vsc.action("vscode-neovim.send", {
|
||||
args = {
|
||||
rhs,
|
||||
},
|
||||
})
|
||||
end, args)
|
||||
end
|
||||
-- moving bewteen splits
|
||||
vim.cmd("nmap <M-C-S-L> <C-w>l")
|
||||
vim.cmd("nmap <M-C-S-K> <C-w>k")
|
||||
vim.cmd("nmap <M-C-S-J> <C-w>j")
|
||||
vim.cmd("nmap <M-C-S-H> <C-w>h")
|
||||
-- close
|
||||
vim.cmd("nmap <M-C-S-C> <C-w>c")
|
||||
-- quit
|
||||
vim.cmd("nmap <M-C-S-Q> <C-w>q")
|
||||
-- resizing
|
||||
-- 3 lower width, 4 increace width
|
||||
vim.cmd("nmap <M-C-S-3> <C-w><")
|
||||
vim.cmd("nmap <M-C-S-4> <C-w>>")
|
||||
-- e lower height, r increase height
|
||||
vim.cmd("nmap <M-C-S-E> <C-w>>")
|
||||
vim.cmd("nmap <M-C-S-R> <C-w>>")
|
||||
|
||||
-- movement:
|
||||
-- o move left, p move right
|
||||
vim.cmd("nmap <M-C-S-P> <C-w>L")
|
||||
vim.cmd("nmap <M-C-S-O> <C-w>H")
|
||||
|
||||
-- 9 move down, 0 move up
|
||||
vim.cmd("nmap <M-C-S-0> <C-w>K")
|
||||
vim.cmd("nmap <M-C-S-9> <C-w>J")
|
||||
-- ./init.lua
|
||||
vim.cmd("nmap <M-C-S-\\> <C-w>v")
|
||||
vim.cmd("nmap <M-C-S-5> <C-w>s")
|
||||
vim.cmd("imap <M-C-S-\\> <C-w>v")
|
||||
vim.cmd("imap <M-C-S-5> <C-w>s")
|
||||
-- go to file under cursor
|
||||
vim.cmd("nmap <M-C-S-F> <C-w>F")
|
||||
-- only
|
||||
-- makes more sense to use O for moving splits
|
||||
vim.cmd("nmap <M-C-S-U> <C-w><C-o>")
|
||||
-- open Definition in split view
|
||||
vim.cmd("nmap <M-C-S-D> <C-w>}")
|
||||
-- move over folds
|
||||
vim.cmd("nmap j gj")
|
||||
vim.cmd("nmap k gk")
|
||||
|
|
Loading…
Reference in a new issue