-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmappings.lua
80 lines (78 loc) · 4.25 KB
/
mappings.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
local cmd = function(command)
return table.concat({ '<CMD>', command, '<CR>' })
end
local astro_utils = require("astronvim.utils")
local builtin = require("telescope.builtin")
local utils = require("telescope.utils")
return {
n = {
-- misc
["<Tab>"] = { "<c-w><c-w>", desc = "Move around" },
["<leader>c"] = {
function()
local bufs = vim.fn.getbufinfo { buflisted = true }
require("astronvim.utils.buffer").close(0)
if require("astronvim.utils").is_available "alpha-nvim" and not bufs[2] then require("alpha").start(true) end
end,
desc = "Close buffer",
},
["<leader>C"] = { cmd "CodeActionMenu", desc = "Code action" },
["<leader>F"] = { function() vim.lsp.buf.format(astronvim.lsp.format_opts) end, desc = "Format code" },
-- cokeline
["-"] = { "<Plug>(cokeline-switch-prev)", desc = "Move buffer left", silent = true },
["="] = { "<Plug>(cokeline-switch-next)", desc = "Move buffer right", silent = true },
["<S-h>"] = { "<Plug>(cokeline-focus-prev)", desc = "Focus left buffer", silent = true },
["<S-l>"] = { "<Plug>(cokeline-focus-next)", desc = "Focus right buffer", silent = true },
-- -- git
["<leader>gd"] = { function() require("gitsigns").diffthis() end, desc = "Git diff" },
["<leader>ge"] = { ":Octo pr edit ", desc = "Edit PR" },
["<leader>gg"] = false,
["<leader>gh"] = false,
["<leader>gl"] = false,
["<leader>gL"] = { cmd "Octo pr list", desc = "List PRs" },
["<leader>gp"] = false,
["<leader>gr"] = { cmd "Octo pr create", desc = "Create PR" },
["<leader>gR"] = { cmd "Octo review start", desc = "Review PR" },
["<leader>gS"] = { cmd "Octo review submit", desc = "Submit review" },
["<leader>gs"] = { function() builtin.git_status() end, desc = "Git status" },
["<leader>gt"] = { function() astro_utils.toggle_term_cmd "lazygit" end, desc = "Toggle lazygit" },
["<leader>gu"] = false,
-- nvim-tree
["<leader>e"] = { cmd "NvimTreeToggle", desc = "Explorer" },
["<leader>o"] = { cmd "NvimTreeFocus", desc = "Focus explorer" },
-- -- search
["<leader>fa"] = { function() builtin.autocommands() end, desc = "Find autocommands" },
["<leader>fH"] = { function() builtin.highlights() end, desc = "Find highlights" },
["<leader>fo"] = { function() builtin.oldfiles() end, desc = "Find all recent files" },
["<leader>fr"] = { function() builtin.oldfiles({ cwd_only = true }) end, desc = "Find recent files" },
["<leader>fs"] = { function() builtin.current_buffer_fuzzy_find() end, desc = "Find string in buffer" },
["<leader>fO"] = { function() builtin.vim_options() end, desc = "Find options" },
-- -- toggle
["<leader>tf"] = { cmd "setlocal foldmethod=indent", desc = "Toggle folding" },
["<leader>tl"] = false,
["<leader>tn"] = false,
["<leader>tp"] = false,
["<leader>ts"] = { function() require("aerial").toggle() end, desc = "Toggle outline" },
["<leader>tt"] = { cmd "terminal", desc = "Toggle terminal buffer" },
["<leader>tu"] = { cmd "UndotreeToggle", desc = "Toggle undotree" },
-- -- window resizing
["<Up>"] = { function() require("smart-splits").resize_up(2) end, desc = "Resize split up" },
["<Down>"] = { function() require("smart-splits").resize_down(2) end, desc = "Resize split down" },
["<Left>"] = { function() require("smart-splits").resize_left(2) end, desc = "Resize split left" },
["<Right>"] = { function() require("smart-splits").resize_right(2) end, desc = "Resize split right" },
["_"] = { function() require("smart-splits").resize_left() end, desc = "Resize split left" },
["+"] = { function() require("smart-splits").resize_right() end, desc = "Resize split right" },
-- -- window zooming
["<leader>ze"] = { cmd "WindowsEqualize", desc = "Equalize" },
["<leader>zh"] = { cmd "WindowsMaximizeHorizontally", desc = "Horizontally" },
["<leader>zm"] = { cmd "WindowsMaximize", desc = "Maximize" },
["<leader>zv"] = { cmd "WindowsMaximizeVertically", desc = "Vertically" },
},
t = {
["jk"] = { "<C-\\><C-n>", desc = "Terminal normal mode" },
["<C-l>"] = false,
},
v = {
["<leader>a"] = { ":EasyAlign ", desc = "Easy align" },
},
}