parent
ce027efbe9
commit
6f0aa376a8
@ -1,6 +1,6 @@
|
|||||||
column_width = 120
|
column_width = 120
|
||||||
line_endings = "Unix"
|
line_endings = "Unix"
|
||||||
indent_type = "Spaces"
|
indent_type = "Spaces"
|
||||||
indent_width = 3
|
indent_width = 2
|
||||||
quote_style = "AutoPreferDouble"
|
quote_style = "AutoPreferDouble"
|
||||||
call_parentheses = "None"
|
call_parentheses = "None"
|
||||||
|
@ -1,387 +1,387 @@
|
|||||||
-- n, v, i, t = mode names
|
-- n, v, i, t = mode names
|
||||||
|
|
||||||
local function termcodes(str)
|
local function termcodes(str)
|
||||||
return vim.api.nvim_replace_termcodes(str, true, true, true)
|
return vim.api.nvim_replace_termcodes(str, true, true, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
M.general = {
|
M.general = {
|
||||||
i = {
|
i = {
|
||||||
|
|
||||||
-- go to beginning and end
|
-- go to beginning and end
|
||||||
["<C-b>"] = { "<ESC>^i", "論 beginning of line" },
|
["<C-b>"] = { "<ESC>^i", "論 beginning of line" },
|
||||||
["<C-e>"] = { "<End>", "壟 end of line" },
|
["<C-e>"] = { "<End>", "壟 end of line" },
|
||||||
|
|
||||||
-- navigate within insert mode
|
-- navigate within insert mode
|
||||||
["<C-h>"] = { "<Left>", " move left" },
|
["<C-h>"] = { "<Left>", " move left" },
|
||||||
["<C-l>"] = { "<Right>", " move right" },
|
["<C-l>"] = { "<Right>", " move right" },
|
||||||
["<C-j>"] = { "<Down>", " move down" },
|
["<C-j>"] = { "<Down>", " move down" },
|
||||||
["<C-k>"] = { "<Up>", " move up" },
|
["<C-k>"] = { "<Up>", " move up" },
|
||||||
},
|
},
|
||||||
|
|
||||||
n = {
|
n = {
|
||||||
|
|
||||||
["<ESC>"] = { "<cmd> noh <CR>", " no highlight" },
|
["<ESC>"] = { "<cmd> noh <CR>", " no highlight" },
|
||||||
|
|
||||||
-- switch between windows
|
-- switch between windows
|
||||||
["<C-h>"] = { "<C-w>h", " window left" },
|
["<C-h>"] = { "<C-w>h", " window left" },
|
||||||
["<C-l>"] = { "<C-w>l", " window right" },
|
["<C-l>"] = { "<C-w>l", " window right" },
|
||||||
["<C-j>"] = { "<C-w>j", " window down" },
|
["<C-j>"] = { "<C-w>j", " window down" },
|
||||||
["<C-k>"] = { "<C-w>k", " window up" },
|
["<C-k>"] = { "<C-w>k", " window up" },
|
||||||
|
|
||||||
-- save
|
-- save
|
||||||
["<C-s>"] = { "<cmd> w <CR>", " save file" },
|
["<C-s>"] = { "<cmd> w <CR>", " save file" },
|
||||||
|
|
||||||
-- Copy all
|
-- Copy all
|
||||||
["<C-c>"] = { "<cmd> %y+ <CR>", " copy whole file" },
|
["<C-c>"] = { "<cmd> %y+ <CR>", " copy whole file" },
|
||||||
|
|
||||||
-- line numbers
|
-- line numbers
|
||||||
["<leader>n"] = { "<cmd> set nu! <CR>", " toggle line number" },
|
["<leader>n"] = { "<cmd> set nu! <CR>", " toggle line number" },
|
||||||
["<leader>rn"] = { "<cmd> set rnu! <CR>", " toggle relative number" },
|
["<leader>rn"] = { "<cmd> set rnu! <CR>", " toggle relative number" },
|
||||||
|
|
||||||
-- update nvchad
|
-- update nvchad
|
||||||
["<leader>uu"] = { "<cmd> :NvChadUpdate <CR>", " update nvchad" },
|
["<leader>uu"] = { "<cmd> :NvChadUpdate <CR>", " update nvchad" },
|
||||||
|
|
||||||
["<leader>tt"] = {
|
["<leader>tt"] = {
|
||||||
function()
|
function()
|
||||||
require("base46").toggle_theme()
|
require("base46").toggle_theme()
|
||||||
end,
|
end,
|
||||||
|
|
||||||
" toggle theme",
|
" toggle theme",
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Allow moving the cursor through wrapped lines with j, k, <Up> and <Down>
|
-- Allow moving the cursor through wrapped lines with j, k, <Up> and <Down>
|
||||||
-- http://www.reddit.com/r/vim/comments/2k4cbr/problem_with_gj_and_gk/
|
-- http://www.reddit.com/r/vim/comments/2k4cbr/problem_with_gj_and_gk/
|
||||||
-- empty mode is same as using <cmd> :map
|
-- empty mode is same as using <cmd> :map
|
||||||
-- also don't use g[j|k] when in operator pending mode, so it doesn't alter d, y or c behaviour
|
-- also don't use g[j|k] when in operator pending mode, so it doesn't alter d, y or c behaviour
|
||||||
["j"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', opts = { expr = true } },
|
["j"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', opts = { expr = true } },
|
||||||
["k"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', opts = { expr = true } },
|
["k"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', opts = { expr = true } },
|
||||||
["<Up>"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', opts = { expr = true } },
|
["<Up>"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', opts = { expr = true } },
|
||||||
["<Down>"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', opts = { expr = true } },
|
["<Down>"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', opts = { expr = true } },
|
||||||
},
|
},
|
||||||
|
|
||||||
t = {
|
t = {
|
||||||
["<C-x>"] = { termcodes "<C-\\><C-N>", " escape terminal mode" },
|
["<C-x>"] = { termcodes "<C-\\><C-N>", " escape terminal mode" },
|
||||||
},
|
},
|
||||||
|
|
||||||
v = {
|
v = {
|
||||||
["j"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', opts = { expr = true } },
|
["j"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', opts = { expr = true } },
|
||||||
["k"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', opts = { expr = true } },
|
["k"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', opts = { expr = true } },
|
||||||
["<Up>"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', opts = { expr = true } },
|
["<Up>"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', opts = { expr = true } },
|
||||||
["<Down>"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', opts = { expr = true } },
|
["<Down>"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', opts = { expr = true } },
|
||||||
-- Don't copy the replaced text after pasting in visual mode
|
-- Don't copy the replaced text after pasting in visual mode
|
||||||
-- https://vim.fandom.com/wiki/Replace_a_word_with_yanked_text#Alternative_mapping_for_paste
|
-- https://vim.fandom.com/wiki/Replace_a_word_with_yanked_text#Alternative_mapping_for_paste
|
||||||
["p"] = { 'p:let @+=@0<CR>:let @"=@0<CR>', opts = { silent = true } },
|
["p"] = { 'p:let @+=@0<CR>:let @"=@0<CR>', opts = { silent = true } },
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
M.tabufline = {
|
M.tabufline = {
|
||||||
|
|
||||||
n = {
|
n = {
|
||||||
-- new buffer
|
-- new buffer
|
||||||
["<S-b>"] = { "<cmd> enew <CR>", "烙 new buffer" },
|
["<S-b>"] = { "<cmd> enew <CR>", "烙 new buffer" },
|
||||||
|
|
||||||
-- cycle through buffers
|
-- cycle through buffers
|
||||||
["<TAB>"] = { "<cmd> Tbufnext <CR>", " goto next buffer" },
|
["<TAB>"] = { "<cmd> Tbufnext <CR>", " goto next buffer" },
|
||||||
["<S-Tab>"] = { "<cmd> Tbufprev <CR> ", " goto prev buffer" },
|
["<S-Tab>"] = { "<cmd> Tbufprev <CR> ", " goto prev buffer" },
|
||||||
|
|
||||||
-- cycle through tabs
|
-- cycle through tabs
|
||||||
["<leader>tp"] = { "<cmd> tabprevious <CR>", " goto next tab" },
|
["<leader>tp"] = { "<cmd> tabprevious <CR>", " goto next tab" },
|
||||||
["<leader>tn"] = { "<cmd> tabnext <CR> ", " goto prev tab" },
|
["<leader>tn"] = { "<cmd> tabnext <CR> ", " goto prev tab" },
|
||||||
|
|
||||||
-- close buffer + hide terminal buffer
|
-- close buffer + hide terminal buffer
|
||||||
["<leader>x"] = {
|
["<leader>x"] = {
|
||||||
function()
|
function()
|
||||||
require("core.utils").close_buffer()
|
require("core.utils").close_buffer()
|
||||||
end,
|
end,
|
||||||
" close buffer",
|
" close buffer",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
M.comment = {
|
M.comment = {
|
||||||
|
|
||||||
-- toggle comment in both modes
|
-- toggle comment in both modes
|
||||||
n = {
|
n = {
|
||||||
["<leader>/"] = {
|
["<leader>/"] = {
|
||||||
function()
|
function()
|
||||||
require("Comment.api").toggle_current_linewise()
|
require("Comment.api").toggle_current_linewise()
|
||||||
end,
|
end,
|
||||||
|
|
||||||
"蘒 toggle comment",
|
"蘒 toggle comment",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
v = {
|
v = {
|
||||||
["<leader>/"] = {
|
["<leader>/"] = {
|
||||||
"<ESC><cmd>lua require('Comment.api').toggle_linewise_op(vim.fn.visualmode())<CR>",
|
"<ESC><cmd>lua require('Comment.api').toggle_linewise_op(vim.fn.visualmode())<CR>",
|
||||||
"蘒 toggle comment",
|
"蘒 toggle comment",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
M.lspconfig = {
|
M.lspconfig = {
|
||||||
-- See `<cmd> :help vim.lsp.*` for documentation on any of the below functions
|
-- See `<cmd> :help vim.lsp.*` for documentation on any of the below functions
|
||||||
|
|
||||||
n = {
|
n = {
|
||||||
["gD"] = {
|
["gD"] = {
|
||||||
function()
|
function()
|
||||||
vim.lsp.buf.declaration()
|
vim.lsp.buf.declaration()
|
||||||
end,
|
end,
|
||||||
" lsp declaration",
|
" lsp declaration",
|
||||||
},
|
},
|
||||||
|
|
||||||
["gd"] = {
|
["gd"] = {
|
||||||
function()
|
function()
|
||||||
vim.lsp.buf.definition()
|
vim.lsp.buf.definition()
|
||||||
end,
|
end,
|
||||||
" lsp definition",
|
" lsp definition",
|
||||||
},
|
},
|
||||||
|
|
||||||
["K"] = {
|
["K"] = {
|
||||||
function()
|
function()
|
||||||
vim.lsp.buf.hover()
|
vim.lsp.buf.hover()
|
||||||
end,
|
end,
|
||||||
" lsp hover",
|
" lsp hover",
|
||||||
},
|
},
|
||||||
|
|
||||||
["gi"] = {
|
["gi"] = {
|
||||||
function()
|
function()
|
||||||
vim.lsp.buf.implementation()
|
vim.lsp.buf.implementation()
|
||||||
end,
|
end,
|
||||||
" lsp implementation",
|
" lsp implementation",
|
||||||
},
|
},
|
||||||
|
|
||||||
["<leader>ls"] = {
|
["<leader>ls"] = {
|
||||||
function()
|
function()
|
||||||
vim.lsp.buf.signature_help()
|
vim.lsp.buf.signature_help()
|
||||||
end,
|
end,
|
||||||
" lsp signature_help",
|
" lsp signature_help",
|
||||||
},
|
},
|
||||||
|
|
||||||
["<leader>D"] = {
|
["<leader>D"] = {
|
||||||
function()
|
function()
|
||||||
vim.lsp.buf.type_definition()
|
vim.lsp.buf.type_definition()
|
||||||
end,
|
end,
|
||||||
" lsp definition type",
|
" lsp definition type",
|
||||||
},
|
},
|
||||||
|
|
||||||
["<leader>ra"] = {
|
["<leader>ra"] = {
|
||||||
function()
|
function()
|
||||||
require("nvchad_ui.renamer").open()
|
require("nvchad_ui.renamer").open()
|
||||||
end,
|
end,
|
||||||
" lsp rename",
|
" lsp rename",
|
||||||
},
|
},
|
||||||
|
|
||||||
["<leader>ca"] = {
|
["<leader>ca"] = {
|
||||||
function()
|
function()
|
||||||
vim.lsp.buf.code_action()
|
vim.lsp.buf.code_action()
|
||||||
end,
|
end,
|
||||||
" lsp code_action",
|
" lsp code_action",
|
||||||
},
|
},
|
||||||
|
|
||||||
["gr"] = {
|
["gr"] = {
|
||||||
function()
|
function()
|
||||||
vim.lsp.buf.references()
|
vim.lsp.buf.references()
|
||||||
end,
|
end,
|
||||||
" lsp references",
|
" lsp references",
|
||||||
},
|
},
|
||||||
|
|
||||||
["<leader>f"] = {
|
["<leader>f"] = {
|
||||||
function()
|
function()
|
||||||
vim.diagnostic.open_float()
|
vim.diagnostic.open_float()
|
||||||
end,
|
end,
|
||||||
" floating diagnostic",
|
" floating diagnostic",
|
||||||
},
|
},
|
||||||
|
|
||||||
["[d"] = {
|
["[d"] = {
|
||||||
function()
|
function()
|
||||||
vim.diagnostic.goto_prev()
|
vim.diagnostic.goto_prev()
|
||||||
end,
|
end,
|
||||||
" goto prev",
|
" goto prev",
|
||||||
},
|
},
|
||||||
|
|
||||||
["d]"] = {
|
["d]"] = {
|
||||||
function()
|
function()
|
||||||
vim.diagnostic.goto_next()
|
vim.diagnostic.goto_next()
|
||||||
end,
|
end,
|
||||||
" goto_next",
|
" goto_next",
|
||||||
},
|
},
|
||||||
|
|
||||||
["<leader>q"] = {
|
["<leader>q"] = {
|
||||||
function()
|
function()
|
||||||
vim.diagnostic.setloclist()
|
vim.diagnostic.setloclist()
|
||||||
end,
|
end,
|
||||||
" diagnostic setloclist",
|
" diagnostic setloclist",
|
||||||
},
|
},
|
||||||
|
|
||||||
["<leader>fm"] = {
|
["<leader>fm"] = {
|
||||||
function()
|
function()
|
||||||
vim.lsp.buf.formatting()
|
vim.lsp.buf.formatting()
|
||||||
end,
|
end,
|
||||||
" lsp formatting",
|
" lsp formatting",
|
||||||
},
|
},
|
||||||
|
|
||||||
["<leader>wa"] = {
|
["<leader>wa"] = {
|
||||||
function()
|
function()
|
||||||
vim.lsp.buf.add_workspace_folder()
|
vim.lsp.buf.add_workspace_folder()
|
||||||
end,
|
end,
|
||||||
" add workspace folder",
|
" add workspace folder",
|
||||||
},
|
},
|
||||||
|
|
||||||
["<leader>wr"] = {
|
["<leader>wr"] = {
|
||||||
function()
|
function()
|
||||||
vim.lsp.buf.remove_workspace_folder()
|
vim.lsp.buf.remove_workspace_folder()
|
||||||
end,
|
end,
|
||||||
" remove workspace folder",
|
" remove workspace folder",
|
||||||
},
|
},
|
||||||
|
|
||||||
["<leader>wl"] = {
|
["<leader>wl"] = {
|
||||||
function()
|
function()
|
||||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||||
end,
|
end,
|
||||||
" list workspace folders",
|
" list workspace folders",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
M.nvimtree = {
|
M.nvimtree = {
|
||||||
|
|
||||||
n = {
|
n = {
|
||||||
-- toggle
|
-- toggle
|
||||||
["<C-n>"] = { "<cmd> NvimTreeToggle <CR>", " toggle nvimtree" },
|
["<C-n>"] = { "<cmd> NvimTreeToggle <CR>", " toggle nvimtree" },
|
||||||
|
|
||||||
-- focus
|
-- focus
|
||||||
["<leader>e"] = { "<cmd> NvimTreeFocus <CR>", " focus nvimtree" },
|
["<leader>e"] = { "<cmd> NvimTreeFocus <CR>", " focus nvimtree" },
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
M.telescope = {
|
M.telescope = {
|
||||||
n = {
|
n = {
|
||||||
-- find
|
-- find
|
||||||
["<leader>ff"] = { "<cmd> Telescope find_files <CR>", " find files" },
|
["<leader>ff"] = { "<cmd> Telescope find_files <CR>", " find files" },
|
||||||
["<leader>fa"] = { "<cmd> Telescope find_files follow=true no_ignore=true hidden=true <CR>", " find all" },
|
["<leader>fa"] = { "<cmd> Telescope find_files follow=true no_ignore=true hidden=true <CR>", " find all" },
|
||||||
["<leader>fw"] = { "<cmd> Telescope live_grep <CR>", " live grep" },
|
["<leader>fw"] = { "<cmd> Telescope live_grep <CR>", " live grep" },
|
||||||
["<leader>fb"] = { "<cmd> Telescope buffers <CR>", " find buffers" },
|
["<leader>fb"] = { "<cmd> Telescope buffers <CR>", " find buffers" },
|
||||||
["<leader>fh"] = { "<cmd> Telescope help_tags <CR>", " help page" },
|
["<leader>fh"] = { "<cmd> Telescope help_tags <CR>", " help page" },
|
||||||
["<leader>fo"] = { "<cmd> Telescope oldfiles <CR>", " find oldfiles" },
|
["<leader>fo"] = { "<cmd> Telescope oldfiles <CR>", " find oldfiles" },
|
||||||
["<leader>tk"] = { "<cmd> Telescope keymaps <CR>", " show keys" },
|
["<leader>tk"] = { "<cmd> Telescope keymaps <CR>", " show keys" },
|
||||||
|
|
||||||
-- git
|
-- git
|
||||||
["<leader>cm"] = { "<cmd> Telescope git_commits <CR>", " git commits" },
|
["<leader>cm"] = { "<cmd> Telescope git_commits <CR>", " git commits" },
|
||||||
["<leader>gt"] = { "<cmd> Telescope git_status <CR>", " git status" },
|
["<leader>gt"] = { "<cmd> Telescope git_status <CR>", " git status" },
|
||||||
|
|
||||||
-- pick a hidden term
|
-- pick a hidden term
|
||||||
["<leader>pt"] = { "<cmd> Telescope terms <CR>", " pick hidden term" },
|
["<leader>pt"] = { "<cmd> Telescope terms <CR>", " pick hidden term" },
|
||||||
|
|
||||||
-- theme switcher
|
-- theme switcher
|
||||||
["<leader>th"] = { "<cmd> Telescope themes <CR>", " nvchad themes" },
|
["<leader>th"] = { "<cmd> Telescope themes <CR>", " nvchad themes" },
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
M.nvterm = {
|
M.nvterm = {
|
||||||
t = {
|
t = {
|
||||||
-- toggle in terminal mode
|
-- toggle in terminal mode
|
||||||
["<A-i>"] = {
|
["<A-i>"] = {
|
||||||
function()
|
function()
|
||||||
require("nvterm.terminal").toggle "float"
|
require("nvterm.terminal").toggle "float"
|
||||||
end,
|
end,
|
||||||
" toggle floating term",
|
" toggle floating term",
|
||||||
},
|
},
|
||||||
|
|
||||||
["<A-h>"] = {
|
["<A-h>"] = {
|
||||||
function()
|
function()
|
||||||
require("nvterm.terminal").toggle "horizontal"
|
require("nvterm.terminal").toggle "horizontal"
|
||||||
end,
|
end,
|
||||||
" toggle horizontal term",
|
" toggle horizontal term",
|
||||||
},
|
},
|
||||||
|
|
||||||
["<A-v>"] = {
|
["<A-v>"] = {
|
||||||
function()
|
function()
|
||||||
require("nvterm.terminal").toggle "vertical"
|
require("nvterm.terminal").toggle "vertical"
|
||||||
end,
|
end,
|
||||||
" toggle vertical term",
|
" toggle vertical term",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
n = {
|
n = {
|
||||||
-- toggle in normal mode
|
-- toggle in normal mode
|
||||||
["<A-i>"] = {
|
["<A-i>"] = {
|
||||||
function()
|
function()
|
||||||
require("nvterm.terminal").toggle "float"
|
require("nvterm.terminal").toggle "float"
|
||||||
end,
|
end,
|
||||||
" toggle floating term",
|
" toggle floating term",
|
||||||
},
|
},
|
||||||
|
|
||||||
["<A-h>"] = {
|
["<A-h>"] = {
|
||||||
function()
|
function()
|
||||||
require("nvterm.terminal").toggle "horizontal"
|
require("nvterm.terminal").toggle "horizontal"
|
||||||
end,
|
end,
|
||||||
" toggle horizontal term",
|
" toggle horizontal term",
|
||||||
},
|
},
|
||||||
|
|
||||||
["<A-v>"] = {
|
["<A-v>"] = {
|
||||||
function()
|
function()
|
||||||
require("nvterm.terminal").toggle "vertical"
|
require("nvterm.terminal").toggle "vertical"
|
||||||
end,
|
end,
|
||||||
" toggle vertical term",
|
" toggle vertical term",
|
||||||
},
|
},
|
||||||
|
|
||||||
-- new
|
-- new
|
||||||
|
|
||||||
["<leader>h"] = {
|
["<leader>h"] = {
|
||||||
function()
|
function()
|
||||||
require("nvterm.terminal").new "horizontal"
|
require("nvterm.terminal").new "horizontal"
|
||||||
end,
|
end,
|
||||||
" new horizontal term",
|
" new horizontal term",
|
||||||
},
|
},
|
||||||
|
|
||||||
["<leader>v"] = {
|
["<leader>v"] = {
|
||||||
function()
|
function()
|
||||||
require("nvterm.terminal").new "vertical"
|
require("nvterm.terminal").new "vertical"
|
||||||
end,
|
end,
|
||||||
" new vertical term",
|
" new vertical term",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
M.whichkey = {
|
M.whichkey = {
|
||||||
n = {
|
n = {
|
||||||
["<leader>wK"] = {
|
["<leader>wK"] = {
|
||||||
function()
|
function()
|
||||||
vim.cmd "WhichKey"
|
vim.cmd "WhichKey"
|
||||||
end,
|
end,
|
||||||
" which-key all keymaps",
|
" which-key all keymaps",
|
||||||
},
|
},
|
||||||
["<leader>wk"] = {
|
["<leader>wk"] = {
|
||||||
function()
|
function()
|
||||||
local input = vim.fn.input "WhichKey: "
|
local input = vim.fn.input "WhichKey: "
|
||||||
vim.cmd("WhichKey " .. input)
|
vim.cmd("WhichKey " .. input)
|
||||||
end,
|
end,
|
||||||
" which-key query lookup",
|
" which-key query lookup",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
M.blankline = {
|
M.blankline = {
|
||||||
n = {
|
n = {
|
||||||
["<leader>bc"] = {
|
["<leader>bc"] = {
|
||||||
function()
|
function()
|
||||||
local ok, start = require("indent_blankline.utils").get_current_context(
|
local ok, start = require("indent_blankline.utils").get_current_context(
|
||||||
vim.g.indent_blankline_context_patterns,
|
vim.g.indent_blankline_context_patterns,
|
||||||
vim.g.indent_blankline_use_treesitter_scope
|
vim.g.indent_blankline_use_treesitter_scope
|
||||||
)
|
)
|
||||||
|
|
||||||
if ok then
|
if ok then
|
||||||
vim.api.nvim_win_set_cursor(vim.api.nvim_get_current_win(), { start, 0 })
|
vim.api.nvim_win_set_cursor(vim.api.nvim_get_current_win(), { start, 0 })
|
||||||
vim.cmd [[normal! _]]
|
vim.cmd [[normal! _]]
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
" Jump to current_context",
|
" Jump to current_context",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
@ -1,59 +1,59 @@
|
|||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
M.bootstrap = function()
|
M.bootstrap = function()
|
||||||
local fn = vim.fn
|
local fn = vim.fn
|
||||||
local install_path = fn.stdpath "data" .. "/site/pack/packer/start/packer.nvim"
|
local install_path = fn.stdpath "data" .. "/site/pack/packer/start/packer.nvim"
|
||||||
|
|
||||||
vim.api.nvim_set_hl(0, "NormalFloat", { bg = "#1e222a" })
|
vim.api.nvim_set_hl(0, "NormalFloat", { bg = "#1e222a" })
|
||||||
|
|
||||||
if fn.empty(fn.glob(install_path)) > 0 then
|
if fn.empty(fn.glob(install_path)) > 0 then
|
||||||
print "Cloning packer .."
|
print "Cloning packer .."
|
||||||
fn.system { "git", "clone", "--depth", "1", "https://github.com/wbthomason/packer.nvim", install_path }
|
fn.system { "git", "clone", "--depth", "1", "https://github.com/wbthomason/packer.nvim", install_path }
|
||||||
|
|
||||||
-- install plugins + compile their configs
|
-- install plugins + compile their configs
|
||||||
vim.cmd "packadd packer.nvim"
|
vim.cmd "packadd packer.nvim"
|
||||||
require "plugins"
|
require "plugins"
|
||||||
vim.cmd "PackerSync"
|
vim.cmd "PackerSync"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
M.options = {
|
M.options = {
|
||||||
auto_clean = true,
|
auto_clean = true,
|
||||||
compile_on_sync = true,
|
compile_on_sync = true,
|
||||||
git = { clone_timeout = 6000 },
|
git = { clone_timeout = 6000 },
|
||||||
display = {
|
display = {
|
||||||
working_sym = "ﲊ",
|
working_sym = "ﲊ",
|
||||||
error_sym = "✗ ",
|
error_sym = "✗ ",
|
||||||
done_sym = " ",
|
done_sym = " ",
|
||||||
removed_sym = " ",
|
removed_sym = " ",
|
||||||
moved_sym = "",
|
moved_sym = "",
|
||||||
open_fn = function()
|
open_fn = function()
|
||||||
return require("packer.util").float { border = "single" }
|
return require("packer.util").float { border = "single" }
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
-- merge overrides if there are any
|
-- merge overrides if there are any
|
||||||
M.options = require("core.utils").load_override(M.options, "wbthomason/packer.nvim")
|
M.options = require("core.utils").load_override(M.options, "wbthomason/packer.nvim")
|
||||||
|
|
||||||
M.run = function(plugins)
|
M.run = function(plugins)
|
||||||
local present, packer = pcall(require, "packer")
|
local present, packer = pcall(require, "packer")
|
||||||
|
|
||||||
if not present then
|
if not present then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Override with chadrc values
|
-- Override with chadrc values
|
||||||
plugins = require("core.utils").remove_default_plugins(plugins)
|
plugins = require("core.utils").remove_default_plugins(plugins)
|
||||||
plugins = require("core.utils").merge_plugins(plugins)
|
plugins = require("core.utils").merge_plugins(plugins)
|
||||||
|
|
||||||
packer.init(M.options)
|
packer.init(M.options)
|
||||||
|
|
||||||
packer.startup(function(use)
|
packer.startup(function(use)
|
||||||
for _, v in pairs(plugins) do
|
for _, v in pairs(plugins) do
|
||||||
use(v)
|
use(v)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
Loading…
Reference in New Issue