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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
local telescope = require("telescope.builtin")
local wk = require("which-key")
local ufo = require("ufo")
local nt_api = require("nvim-tree.api")
local spider = require("spider")
local lualine = require('lualine')
vim.g.mapleader = " "
vim.api.nvim_command("nnoremap <A-j> :m .+1<CR>==")
vim.api.nvim_command("nnoremap <A-k> :m .-2<CR>==")
vim.api.nvim_command("inoremap <A-k> <Esc>:m .-2<CR>==gi")
vim.api.nvim_command("inoremap <A-j> <Esc>:m .+1<CR>==gi")
vim.api.nvim_command("vnoremap <A-j> :m '>+1<CR>gv=gv")
vim.api.nvim_command("vnoremap <A-k> :m '<-2<CR>gv=gv")
vim.keymap.set("i", "<C-a>", "<Home>")
vim.keymap.set("i", "<C-e>", "<End>")
vim.keymap.set("i", "<A-f>", "<C-Right>")
vim.keymap.set("i", "<A-b>", "<C-Left>")
vim.keymap.set("n", "<Leader>n", nt_api.tree.toggle)
vim.keymap.set("n", "<Leader><CR>", vim.lsp.buf.code_action)
vim.keymap.set("n", "<Leader>K", vim.lsp.buf.hover)
vim.keymap.set({ "n", "v" }, "<Leader>F", vim.lsp.buf.format)
vim.keymap.set("n", "<Leader>d", vim.diagnostic.open_float)
vim.keymap.set("n", "<Leader>J", vim.lsp.buf.signature_help)
vim.keymap.set("n", "<Leader>fF", telescope.find_files)
vim.keymap.set("n", "<Leader>ff", telescope.live_grep)
vim.keymap.set("n", "<Leader><TAB>", telescope.buffers)
vim.keymap.set("n", "<Leader>D", telescope.lsp_definitions)
vim.keymap.set("n", "<Leader>R", telescope.lsp_references)
vim.keymap.set("n", "<Leader>S", telescope.lsp_document_symbols)
vim.keymap.set("n", "<Leader>U", vim.cmd.UndotreeToggle)
vim.keymap.set("n", "<Leader>m", ":MinimapToggle<CR>")
vim.keymap.set("n", "<Leader>b", ":Gitsigns blame_line<CR>")
vim.keymap.set("n", "<Leader>h", ":Gitsigns preview_hunk<CR>")
vim.keymap.set("n", "<Leader>,", ":TroubleToggle<CR>")
vim.keymap.set("n", "<Leader>t", ":belowright split | resize 5 | terminal<CR>")
vim.keymap.set("n", "<Leader>[", ufo.openAllFolds)
vim.keymap.set("n", "<Leader>]", ufo.closeAllFolds)
vim.keymap.set("n", "<Leader>r", vim.lsp.buf.rename)
vim.keymap.set("n", "<Leader>N", ":bnext<CR>")
vim.keymap.set("n", "<Leader>P", ":bprevious<CR>")
vim.keymap.set("n", "<Leader>L", function()
vim.o.number = not (vim.o.number)
vim.o.relativenumber = not (vim.o.relativenumber)
vim.o.cursorline = not (vim.o.cursorline)
vim.o.list = not (vim.o.list)
vim.o.foldenable = not (vim.o.foldenable)
if vim.o.foldcolumn == "1"
then
vim.o.foldcolumn = "0"
else
vim.o.foldcolumn = "1"
end
if vim.g.__plain
then
lualine.hide({ unhide = true })
vim.o.laststatus = 2
vim.diagnostic.enable()
else
lualine.hide()
vim.o.laststatus = 0
vim.diagnostic.disable()
end
vim.cmd [[ MarksToggleSigns ]]
vim.cmd [[ IBLToggle ]]
vim.cmd [[ BufferLineGroupToggle ungrouped ]]
vim.cmd [[ TSContextToggle ]]
vim.g.__plain = not (vim.g.__plain)
end)
local spider_opts = { skipInsignificantPunctuation = true }
vim.keymap.set({ "n", "o", "x" }, "<A-w>",
function() spider.motion("w", spider_opts) end)
vim.keymap.set({ "n", "o", "x" }, "<A-e>",
function() spider.motion("e", spider_opts) end)
vim.keymap.set({ "n", "o", "x" }, "<A-b>",
function() spider.motion("b", spider_opts) end)
vim.keymap.set({ "n", "o", "x" }, "<A-g><A-e>",
function() spider.motion("ge", spider_opts) end)
vim.keymap.set({ "t" }, "<ESC>", "<C-\\><C-n>")
vim.opt.whichwrap = "<,>,h,l,[,]"
wk.register({
["<CR>"] = "Quick Action",
["K"] = "Hover",
["D"] = "Definition",
["S"] = "Symbols",
["F"] = "Format",
["f"] = "Find files",
["<TAB>"] = "Show buffers",
[","] = "Show errors",
["["] = "Open folds",
["]"] = "Close folds",
["r"] = "Rename",
["n"] = "Show file tree",
["m"] = "Toggle Minimap",
["b"] = "Blame line",
["h"] = "Preview hunk",
["d"] = "Show diagnostics",
["t"] = "Open terminal",
["s"] = "Save file",
["q"] = "Quit",
["R"] = "Show References",
["J"] = "Signature help",
["U"] = "Undo tree",
["N"] = "Next tab",
["P"] = "Previous tab",
["L"] = "Toggle plain mode",
}, { prefix = "<leader>" });
|