From 45c537c675fe15d06bfb8e460de4019c85cb4fec Mon Sep 17 00:00:00 2001 From: SinTan1729 Date: Wed, 20 Mar 2024 20:48:32 -0500 Subject: [PATCH] chg: Move almost every setting to lua --- laptop/init.lua | 2 +- laptop/keymaps.lua | 35 +++++++++++++++++++++++++++++++++++ laptop/keymaps.vim | 36 ------------------------------------ server/init.lua | 2 +- server/keymaps.lua | 23 +++++++++++++++++++++++ server/keymaps.vim | 21 --------------------- vps/init.lua | 2 +- vps/keymaps.lua | 22 ++++++++++++++++++++++ vps/keymaps.vim | 17 ----------------- 9 files changed, 83 insertions(+), 77 deletions(-) create mode 100644 laptop/keymaps.lua delete mode 100644 laptop/keymaps.vim create mode 100644 server/keymaps.lua delete mode 100644 server/keymaps.vim create mode 100644 vps/keymaps.lua delete mode 100644 vps/keymaps.vim diff --git a/laptop/init.lua b/laptop/init.lua index 83cf54a..403e54e 100644 --- a/laptop/init.lua +++ b/laptop/init.lua @@ -33,7 +33,7 @@ vim.g.loaded_ruby_provider = 0 vim.g.UltiSnipsSnippetDirectories = { "custom-snippets", "UltiSnips" } -- Load keymaps -local keymaps = vim.fn.stdpath("config") .. "/keymaps.vim" +local keymaps = vim.fn.stdpath("config") .. "/keymaps.lua" vim.cmd.source(keymaps) -- Load plugins using paq-nvim diff --git a/laptop/keymaps.lua b/laptop/keymaps.lua new file mode 100644 index 0000000..b1eba34 --- /dev/null +++ b/laptop/keymaps.lua @@ -0,0 +1,35 @@ +-- This file lists all the global keymaps + +-- Change the leader and localleader +vim.g.mapleader = ',' +vim.g.maplocalleader = ';' + +-- Set K to hover +vim.cmd[[command -nargs=+ LspHover lua vim.lsp.buf.hover()]] +vim.opt.keywordprg = ":LspHover" + +-- Use ctrl-[hjkl] to select the active split! +vim.keymap.set('n', '', ":wincmd k", { silent = true }) +vim.keymap.set('n', '', ":wincmd j", { silent = true }) +vim.keymap.set('n', '', ":wincmd h", { silent = true }) +vim.keymap.set('n', '', ":wincmd l", { silent = true }) + +-- Use ,dd for deleting without putting into buffer +vim.keymap.set({ 'v', 'n' }, 'd', '"_d', { remap = false }) +vim.keymap.set('n', 'D', '"_D', { remap = false }) +vim.keymap.set('n', 'x', '"_x', { remap = false }) + +-- Insert a newline in normal mode by ,o +vim.keymap.set('n', 'o', "ok", { remap = false }) +vim.keymap.set('n', 'O', "Oj", { remap = false }) + +-- Use ,u for redo +vim.keymap.set('n', 'u', "", { remap = false }) + +-- Find files using fzf by ,f +vim.keymap.set('n', 'f', ":Files", { remap = false }) + +-- Move around buffers using ,j and ,k +vim.keymap.set('n', 'k', ":bnext", { remap = false }) +vim.keymap.set('n', 'j', ":bprevious", { remap = false }) + diff --git a/laptop/keymaps.vim b/laptop/keymaps.vim deleted file mode 100644 index 90f50c1..0000000 --- a/laptop/keymaps.vim +++ /dev/null @@ -1,36 +0,0 @@ -" This file lists all the global keymaps - -" Set K to hover -command -nargs=+ LspHover lua vim.lsp.buf.hover() -set keywordprg=:LspHover - -" Use ctrl-[hjkl] to select the active split! -nmap :wincmd k -nmap :wincmd j -nmap :wincmd h -nmap :wincmd l - -" Change the leader and localleader -let mapleader="," -let maplocalleader=';' - -" Use ,dd for deleting without putting into buffer -nnoremap d "_d -nnoremap D "_D -nnoremap x "_x -vnoremap d "_d - -" Insert a newline in normal mode by ,o -nnoremap o ok -nnoremap O Oj - -" Use ,u for redo -nnoremap u - -" Find files using fzf by ,f -nnoremap f :Files - -" Move around buffers using ,j and ,k -nnoremap k :bnext -nnoremap k :bprevious - diff --git a/server/init.lua b/server/init.lua index 8ff084c..4c75f54 100644 --- a/server/init.lua +++ b/server/init.lua @@ -27,7 +27,7 @@ vim.g.loaded_node_provider = 0 vim.g.loaded_ruby_provider = 0 -- Load keymaps -local keymaps = vim.fn.stdpath("config") .. "/keymaps.vim" +local keymaps = vim.fn.stdpath("config") .. "/keymaps.lua" vim.cmd.source(keymaps) -- Load plugins using paq-nvim diff --git a/server/keymaps.lua b/server/keymaps.lua new file mode 100644 index 0000000..4081b9c --- /dev/null +++ b/server/keymaps.lua @@ -0,0 +1,23 @@ +-- This file lists all the global keymaps + +-- Change the leader and localleader +vim.g.mapleader = ',' +vim.g.maplocalleader = ';' + + +-- Use ,dd for deleting without putting into buffer +vim.keymap.set({ 'v', 'n' }, 'd', '"_d', { remap = false }) +vim.keymap.set('n', 'D', '"_D', { remap = false }) +vim.keymap.set('n', 'x', '"_x', { remap = false }) + +-- Insert a newline in normal mode by ,o +vim.keymap.set('n', 'o', "ok", { remap = false }) +vim.keymap.set('n', 'O', "Oj", { remap = false }) + +-- Use ,u for redo +vim.keymap.set('n', 'u', "", { remap = false }) + +-- Move around buffers using ,j and ,k +vim.keymap.set('n', 'k', ":bnext", { remap = false }) +vim.keymap.set('n', 'j', ":bprevious", { remap = false }) + diff --git a/server/keymaps.vim b/server/keymaps.vim deleted file mode 100644 index 9cca56f..0000000 --- a/server/keymaps.vim +++ /dev/null @@ -1,21 +0,0 @@ -" Change the leader to a comma -let mapleader = "," -let g:mapleader = "," - -" Use ,dd for deleting without putting into buffer -nnoremap d "_d -nnoremap D "_D -nnoremap x "_x -vnoremap d "_d - -" Insert a newline in normal mode by ,o -nnoremap o ok -nnoremap O Oj - -" Use ,u for redo -nnoremap u - -" Move around buffers using ,j and ,k -nnoremap k :bnext -nnoremap k :bprevious - diff --git a/vps/init.lua b/vps/init.lua index 8ff084c..4c75f54 100644 --- a/vps/init.lua +++ b/vps/init.lua @@ -27,7 +27,7 @@ vim.g.loaded_node_provider = 0 vim.g.loaded_ruby_provider = 0 -- Load keymaps -local keymaps = vim.fn.stdpath("config") .. "/keymaps.vim" +local keymaps = vim.fn.stdpath("config") .. "/keymaps.lua" vim.cmd.source(keymaps) -- Load plugins using paq-nvim diff --git a/vps/keymaps.lua b/vps/keymaps.lua new file mode 100644 index 0000000..6b165f7 --- /dev/null +++ b/vps/keymaps.lua @@ -0,0 +1,22 @@ +-- This file lists all the global keymaps + +-- Change the leader and localleader +vim.g.mapleader = ',' +vim.g.maplocalleader = ';' + +-- Use ,dd for deleting without putting into buffer +vim.keymap.set({ 'v', 'n' }, 'd', '"_d', { remap = false }) +vim.keymap.set('n', 'D', '"_D', { remap = false }) +vim.keymap.set('n', 'x', '"_x', { remap = false }) + +-- Insert a newline in normal mode by ,o +vim.keymap.set('n', 'o', "ok", { remap = false }) +vim.keymap.set('n', 'O', "Oj", { remap = false }) + +-- Use ,u for redo +vim.keymap.set('n', 'u', "", { remap = false }) + +-- Move around buffers using ,j and ,k +vim.keymap.set('n', 'k', ":bnext", { remap = false }) +vim.keymap.set('n', 'j', ":bprevious", { remap = false }) + diff --git a/vps/keymaps.vim b/vps/keymaps.vim deleted file mode 100644 index d5db0f3..0000000 --- a/vps/keymaps.vim +++ /dev/null @@ -1,17 +0,0 @@ -" Change the leader to a comma -let mapleader = "," -let g:mapleader = "," - -" Use ,dd for deleting without putting into buffer -nnoremap d "_d -nnoremap D "_D -nnoremap x "_x -vnoremap d "_d - -" Insert a newline in normal mode by ,o -nnoremap o ok -nnoremap O Oj - -" Use ,u for redo -nnoremap u -