update
This commit is contained in:
parent
dc612b402c
commit
87f59ae9dd
36
lua/core/G.lua
Normal file
36
lua/core/G.lua
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
local G = {}
|
||||||
|
|
||||||
|
G.g = vim.g
|
||||||
|
G.b = vim.b
|
||||||
|
G.o = vim.o
|
||||||
|
G.fn = vim.fn
|
||||||
|
G.api = vim.api
|
||||||
|
|
||||||
|
function G.map(maps)
|
||||||
|
for _,map in pairs(maps) do
|
||||||
|
G.api.nvim_set_keymap(map[1], map[2], map[3], map[4])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function G.hi(hls)
|
||||||
|
for group,color in pairs(hls) do
|
||||||
|
local fg = color.fg and ' ctermfg=' .. color.fg or ' ctermfg=NONE'
|
||||||
|
local bg = color.bg and ' ctermbg=' .. color.bg or ' ctermbg=NONE'
|
||||||
|
local sp = color.sp and ' cterm=' .. color.sp or ''
|
||||||
|
G.api.nvim_command('highlight ' .. group .. fg .. bg .. sp)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function G.cmd(cmd)
|
||||||
|
G.api.nvim_command(cmd)
|
||||||
|
end
|
||||||
|
|
||||||
|
function G.exec(c)
|
||||||
|
G.api.nvim_exec(c)
|
||||||
|
end
|
||||||
|
|
||||||
|
function G.eval(c)
|
||||||
|
return G.api.nvim_eval(c)
|
||||||
|
end
|
||||||
|
|
||||||
|
return G
|
@ -1,63 +1,63 @@
|
|||||||
local map = vim.api.nvim_set_keymap
|
local G,opt = require("G"), {noremap = true}
|
||||||
|
|
||||||
map('n', '<leader>y', '"+y', {noremap = true})
|
G.map({
|
||||||
map('n', '<leader>p', '"+p', {noremap = true})
|
{'n', '<leader>y', '"+y', opt},
|
||||||
map('n', '<leader>d', '"+d', {noremap = true})
|
{'n', '<leader>p', '"+p', opt},
|
||||||
|
{'n', '<leader>d', '"+d', opt},
|
||||||
|
|
||||||
map('v', '<leader>y', '"+y', {noremap = true})
|
{'v', '<leader>y', '"+y', opt},
|
||||||
map('v', '<leader>p', '"+p', {noremap = true})
|
{'v', '<leader>p', '"+p', opt},
|
||||||
map('v', '<leader>d', '"+d', {noremap = true})
|
{'v', '<leader>d', '"+d', opt},
|
||||||
|
|
||||||
map('n', '<leader>nh', ':nohlsearch<CR>', {noremap = true})
|
{'n', '<leader>nh', ':nohlsearch<CR>', opt},
|
||||||
map('n', '<leader>rp',':%s/',{noremap = true})
|
{'n', '<leader>rp',':%s/',opt},
|
||||||
|
|
||||||
map('n', 'L', '$', {noremap = true})
|
{'v', 'L', '$', opt},
|
||||||
map('n', 'H', '^', {noremap = true})
|
{'v', 'H', '^', opt},
|
||||||
map('n', '>', '>>', {noremap = true})
|
{'n', 'L', '$', opt},
|
||||||
map('n', '<', '<<', {noremap = true})
|
{'n', 'H', '^', opt},
|
||||||
map('n', 'Q', ':q!<CR>', {noremap = true})
|
|
||||||
map('n', '?', ':set hlsearch<CR>?', {noremap = true})
|
|
||||||
map('n', '/', ':set hlsearch<CR>/', {noremap = true})
|
|
||||||
|
|
||||||
map('n', '<A-l>', ':tabn<CR>', {noremap = true})
|
{'n', '>', '>>', opt},
|
||||||
map('n', '<A-h>', ':tabp<CR>', {noremap = true})
|
{'n', '<', '<<', opt},
|
||||||
|
{'n', 'Q', ':q!<CR>', opt},
|
||||||
|
{'n', '?', ':set hlsearch<CR>?', opt},
|
||||||
|
{'n', '/', ':set hlsearch<CR>/', opt},
|
||||||
|
|
||||||
|
{'n', '<A-l>', ':tabn<CR>', opt},
|
||||||
|
{'n', '<A-h>', ':tabp<CR>', opt},
|
||||||
|
|
||||||
|
|
||||||
map('n', '<c-j>', '<c-w>j', {noremap = true})
|
{'n', '<c-j>', '<c-w>j', opt},
|
||||||
map('n', '<c-h>', '<c-w>h', {noremap = true})
|
{'n', '<c-h>', '<c-w>h', opt},
|
||||||
map('n', '<c-k>', '<c-w>k', {noremap = true})
|
{'n', '<c-k>', '<c-w>k', opt},
|
||||||
map('n', '<c-l>', '<c-w>l', {noremap = true})
|
{'n', '<c-l>', '<c-w>l', opt},
|
||||||
map('n', '<c-c>', ':wq<CR>', {noremap = true})
|
{'n', '<c-c>', ':wq<CR>', opt},
|
||||||
|
|
||||||
|
|
||||||
map('n', '<leader><leader>y', 'ggyG', {noremap = true})
|
{'n', '<leader><leader>y', 'ggyG', opt},
|
||||||
map('n', '<leader><leader>p', 'ggpG', {noremap = true})
|
{'n', '<leader><leader>p', 'ggpG', opt},
|
||||||
map('n', '<leader><leader>v', 'ggVG', {noremap = true})
|
{'n', '<leader><leader>v', 'ggVG', opt},
|
||||||
|
|
||||||
map('n', '<up>', ':res -5<CR>', {noremap = true})
|
{'n', '<up>', ':res -5<CR>', opt},
|
||||||
map('n', '<down>', ':res +5<CR>', {noremap = true})
|
{'n', '<down>', ':res +5<CR>', opt},
|
||||||
map('n', '<left>', ':vertical resize -5<CR>', {noremap = true})
|
{'n', '<left>', ':vertical resize -5<CR>', opt},
|
||||||
map('n', '<right>', ':vertical resize +5<CR>', {noremap = true})
|
{'n', '<right>', ':vertical resize +5<CR>', opt},
|
||||||
|
|
||||||
-- 快速注释
|
|
||||||
map('n', '<leader>/', '<leader>c<spaces>', {noremap = false})
|
|
||||||
|
|
||||||
|
|
||||||
-- easymotion
|
|
||||||
map('v', '<leader>f', '<Plug>(easymotion-bd-f)', {})
|
|
||||||
map('n', '<leader>f', '<Plug>(easymotion-overwin-f)', {})
|
|
||||||
map('n', 's', '<Plug>(easymotion-overwin-f2)',{})
|
|
||||||
|
|
||||||
-- lazygit
|
-- lazygit
|
||||||
map('n', '<leader>g', ':w<CR>:LazyGit<CR>', {})
|
{'n', '<leader>g', ':w<CR>:LazyGit<CR>', {}},
|
||||||
|
|
||||||
|
|
||||||
--EasyAlign
|
--EasyAlign
|
||||||
map("v", "ga", ":EasyAlign<CR>", {silent = true})
|
{"v", "ga", ":EasyAlign<CR>", {silent = true}},
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
G.map({
|
||||||
|
-- easymotion
|
||||||
|
{'v', '<leader>f', '<Plug>(easymotion-bd-f)', {}},
|
||||||
|
{'n', '<leader>f', '<Plug>(easymotion-overwin-f)', {}},
|
||||||
|
{'n', 's', '<Plug>(easymotion-overwin-f2)',{}},
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user