formatting code

This commit is contained in:
krolyxon 2022-09-07 22:43:45 +05:30
parent 8c649c09ba
commit 279e684a60
17 changed files with 1125 additions and 1126 deletions

View File

@ -1,5 +1,5 @@
vim.defer_fn(function() vim.defer_fn(function()
pcall(require, "impatient") pcall(require, "impatient")
end, 0) end, 0)
-- setup packer + plugins -- setup packer + plugins
@ -7,14 +7,14 @@ local fn = vim.fn
local install_path = fn.stdpath "data" .. "/site/pack/packer/opt/packer.nvim" local install_path = fn.stdpath "data" .. "/site/pack/packer/opt/packer.nvim"
if fn.empty(fn.glob(install_path)) > 0 then if fn.empty(fn.glob(install_path)) > 0 then
vim.api.nvim_set_hl(0, "NormalFloat", { bg = "#1e222a" }) vim.api.nvim_set_hl(0, "NormalFloat", { bg = "#1e222a" })
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
local modules = { local modules = {
@ -23,12 +23,12 @@ local modules = {
} }
for _, module in ipairs(modules) do for _, module in ipairs(modules) do
local ok, err = pcall(require, module) local ok, err = pcall(require, module)
if not ok then if not ok then
error("Error loading " .. module .. "\n\n" .. err) error("Error loading " .. module .. "\n\n" .. err)
end end
end end
require ("core.utils").load_mappings() require("core.utils").load_mappings()
vim.api.nvim_command("colorscheme gruvbox-baby") vim.api.nvim_command("colorscheme gruvbox-baby")

View File

@ -5,27 +5,27 @@ local autocmd = vim.api.nvim_create_autocmd
-- This must be used for plugins that need to be loaded just after a file -- This must be used for plugins that need to be loaded just after a file
-- ex : treesitter, lspconfig etc -- ex : treesitter, lspconfig etc
M.lazy_load = function(tb) M.lazy_load = function(tb)
autocmd(tb.events, { autocmd(tb.events, {
group = vim.api.nvim_create_augroup(tb.augroup_name, {}), group = vim.api.nvim_create_augroup(tb.augroup_name, {}),
callback = function() callback = function()
if tb.condition() then if tb.condition() then
vim.api.nvim_del_augroup_by_name(tb.augroup_name) vim.api.nvim_del_augroup_by_name(tb.augroup_name)
-- dont defer for treesitter as it will show slow highlighting -- dont defer for treesitter as it will show slow highlighting
-- This deferring only happens only when we do "nvim filename" -- This deferring only happens only when we do "nvim filename"
if tb.plugin ~= "nvim-treesitter" then if tb.plugin ~= "nvim-treesitter" then
vim.defer_fn(function() vim.defer_fn(function()
require("packer").loader(tb.plugin) require("packer").loader(tb.plugin)
if tb.plugin == "nvim-lspconfig" then if tb.plugin == "nvim-lspconfig" then
vim.cmd "silent! do FileType" vim.cmd "silent! do FileType"
end
end, 0)
else
require("packer").loader(tb.plugin)
end
end end
end, 0) end,
else })
require("packer").loader(tb.plugin)
end
end
end,
})
end end
-- load certain plugins only when there's a file opened in the buffer -- load certain plugins only when there's a file opened in the buffer
@ -33,50 +33,50 @@ end
-- This gives an instant preview of nvim with the file opened -- This gives an instant preview of nvim with the file opened
M.on_file_open = function(plugin_name) M.on_file_open = function(plugin_name)
M.lazy_load { M.lazy_load {
events = { "BufRead", "BufWinEnter", "BufNewFile" }, events = { "BufRead", "BufWinEnter", "BufNewFile" },
augroup_name = "BeLazyOnFileOpen" .. plugin_name, augroup_name = "BeLazyOnFileOpen" .. plugin_name,
plugin = plugin_name, plugin = plugin_name,
condition = function() condition = function()
local file = vim.fn.expand "%" local file = vim.fn.expand "%"
return file ~= "NvimTree_1" and file ~= "[packer]" and file ~= "" return file ~= "NvimTree_1" and file ~= "[packer]" and file ~= ""
end, end,
} }
end end
M.packer_cmds = { M.packer_cmds = {
"PackerSnapshot", "PackerSnapshot",
"PackerSnapshotRollback", "PackerSnapshotRollback",
"PackerSnapshotDelete", "PackerSnapshotDelete",
"PackerInstall", "PackerInstall",
"PackerUpdate", "PackerUpdate",
"PackerSync", "PackerSync",
"PackerClean", "PackerClean",
"PackerCompile", "PackerCompile",
"PackerStatus", "PackerStatus",
"PackerProfile", "PackerProfile",
"PackerLoad", "PackerLoad",
} }
M.treesitter_cmds = { M.treesitter_cmds = {
"TSInstall", "TSInstall",
"TSBufEnable", "TSBufEnable",
"TSBufDisable", "TSBufDisable",
"TSEnable", "TSEnable",
"TSDisable", "TSDisable",
"TSModuleInfo", "TSModuleInfo",
} }
M.gitsigns = function() M.gitsigns = function()
autocmd({ "BufRead" }, { autocmd({ "BufRead" }, {
callback = function() callback = function()
vim.fn.system("git rev-parse " .. vim.fn.expand "%:p:h") vim.fn.system("git rev-parse " .. vim.fn.expand "%:p:h")
if vim.v.shell_error == 0 then if vim.v.shell_error == 0 then
vim.schedule(function() vim.schedule(function()
require("packer").loader "gitsigns.nvim" require("packer").loader "gitsigns.nvim"
end) end)
end end
end, end,
}) })
end end
return M return M

View File

@ -2,312 +2,312 @@ local M = {}
M.general = { M.general = {
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" },
-- new buffer -- new buffer
["<leader>b"] = { "<cmd> enew <CR>", "new buffer" }, ["<leader>b"] = { "<cmd> enew <CR>", "new buffer" },
-- 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.nvimtree = { M.nvimtree = {
plugin = true, plugin = true,
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.nvterm = { M.nvterm = {
plugin = true, plugin = true,
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>"] = {
function()
require("nvterm.terminal").toggle "horizontal"
end,
"toggle horizontal term",
},
["<A-v>"] = {
function()
require("nvterm.terminal").toggle "vertical"
end,
"toggle vertical term",
},
}, },
["<A-h>"] = { n = {
function() -- toggle in normal mode
require("nvterm.terminal").toggle "horizontal" ["<A-i>"] = {
end, function()
"toggle horizontal term", require("nvterm.terminal").toggle "float"
}, end,
"toggle floating term",
},
["<A-v>"] = { ["<A-h>"] = {
function() function()
require("nvterm.terminal").toggle "vertical" require("nvterm.terminal").toggle "horizontal"
end, end,
"toggle vertical term", "toggle horizontal term",
}, },
},
n = { ["<A-v>"] = {
-- toggle in normal mode function()
["<A-i>"] = { require("nvterm.terminal").toggle "vertical"
function() end,
require("nvterm.terminal").toggle "float" "toggle vertical term",
end, },
"toggle floating term",
}, },
["<A-h>"] = {
function()
require("nvterm.terminal").toggle "horizontal"
end,
"toggle horizontal term",
},
["<A-v>"] = {
function()
require("nvterm.terminal").toggle "vertical"
end,
"toggle vertical term",
},
},
} }
M.telescope = { M.telescope = {
plugin = true, plugin = true,
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" },
-- theme switcher -- theme switcher
["<leader>th"] = { "<cmd> Telescope colorscheme<CR>", "colorthemes" }, ["<leader>th"] = { "<cmd> Telescope colorscheme<CR>", "colorthemes" },
}, },
} }
M.whichkey = { M.whichkey = {
plugin = true, plugin = true,
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"] = {
function()
local input = vim.fn.input "WhichKey: "
vim.cmd("WhichKey " .. input)
end,
"which-key query lookup",
},
}, },
["<leader>wk"] = {
function()
local input = vim.fn.input "WhichKey: "
vim.cmd("WhichKey " .. input)
end,
"which-key query lookup",
},
},
} }
M.comment = { M.comment = {
plugin = true, plugin = true,
-- toggle comment in both modes -- toggle comment in both modes
n = { n = {
["<leader>/"] = { ["<leader>/"] = {
function() function()
require("Comment.api").toggle.linewise.current() require("Comment.api").toggle.linewise.current()
end, end,
"toggle comment", "toggle comment",
},
}, },
},
v = { v = {
["<leader>/"] = { ["<leader>/"] = {
"<ESC><cmd>lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<CR>", "<ESC><cmd>lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<CR>",
"toggle comment", "toggle comment",
},
}, },
},
} }
M.lspconfig = { M.lspconfig = {
plugin = true, plugin = true,
-- 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"] = {
function()
vim.lsp.buf.definition()
end,
"lsp definition",
},
["K"] = {
function()
vim.lsp.buf.hover()
end,
"lsp hover",
},
["gi"] = {
function()
vim.lsp.buf.implementation()
end,
"lsp implementation",
},
["<leader>ls"] = {
function()
vim.lsp.buf.signature_help()
end,
"lsp signature_help",
},
["<leader>D"] = {
function()
vim.lsp.buf.type_definition()
end,
"lsp definition type",
},
["<leader>ra"] = {
function()
require("nvchad_ui.renamer").open()
end,
"lsp rename",
},
["<leader>ca"] = {
function()
vim.lsp.buf.code_action()
end,
"lsp code_action",
},
["gr"] = {
function()
vim.lsp.buf.references()
end,
"lsp references",
},
["<leader>f"] = {
function()
vim.diagnostic.open_float()
end,
"floating diagnostic",
},
["[d"] = {
function()
vim.diagnostic.goto_prev()
end,
"goto prev",
},
["d]"] = {
function()
vim.diagnostic.goto_next()
end,
"goto_next",
},
["<leader>q"] = {
function()
vim.diagnostic.setloclist()
end,
"diagnostic setloclist",
},
["<leader>fm"] = {
function()
vim.lsp.buf.formatting {}
end,
"lsp formatting",
},
["<leader>wa"] = {
function()
vim.lsp.buf.add_workspace_folder()
end,
"add workspace folder",
},
["<leader>wr"] = {
function()
vim.lsp.buf.remove_workspace_folder()
end,
"remove workspace folder",
},
["<leader>wl"] = {
function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end,
"list workspace folders",
},
}, },
["gd"] = {
function()
vim.lsp.buf.definition()
end,
"lsp definition",
},
["K"] = {
function()
vim.lsp.buf.hover()
end,
"lsp hover",
},
["gi"] = {
function()
vim.lsp.buf.implementation()
end,
"lsp implementation",
},
["<leader>ls"] = {
function()
vim.lsp.buf.signature_help()
end,
"lsp signature_help",
},
["<leader>D"] = {
function()
vim.lsp.buf.type_definition()
end,
"lsp definition type",
},
["<leader>ra"] = {
function()
require("nvchad_ui.renamer").open()
end,
"lsp rename",
},
["<leader>ca"] = {
function()
vim.lsp.buf.code_action()
end,
"lsp code_action",
},
["gr"] = {
function()
vim.lsp.buf.references()
end,
"lsp references",
},
["<leader>f"] = {
function()
vim.diagnostic.open_float()
end,
"floating diagnostic",
},
["[d"] = {
function()
vim.diagnostic.goto_prev()
end,
"goto prev",
},
["d]"] = {
function()
vim.diagnostic.goto_next()
end,
"goto_next",
},
["<leader>q"] = {
function()
vim.diagnostic.setloclist()
end,
"diagnostic setloclist",
},
["<leader>fm"] = {
function()
vim.lsp.buf.formatting {}
end,
"lsp formatting",
},
["<leader>wa"] = {
function()
vim.lsp.buf.add_workspace_folder()
end,
"add workspace folder",
},
["<leader>wr"] = {
function()
vim.lsp.buf.remove_workspace_folder()
end,
"remove workspace folder",
},
["<leader>wl"] = {
function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end,
"list workspace folders",
},
},
} }
M.rust = { M.rust = {
plugin = true, plugin = true,
n = { n = {
["<leader>rr"] = { "<cmd> RustRun <CR>", "RustRun"}, ["<leader>rr"] = { "<cmd> RustRun <CR>", "RustRun" },
["<leader>rR"] = { "<cmd> RustRunnables <CR>", "RustRunnables"}, ["<leader>rR"] = { "<cmd> RustRunnables <CR>", "RustRunnables" },
["<leader>rd"] = { "<cmd> RustDebuggables <CR>", "RustDebuggables"}, ["<leader>rd"] = { "<cmd> RustDebuggables <CR>", "RustDebuggables" },
["<leader>rha"] = { "<cmd> RustHoverActions <CR>", "RustHoverActions"}, ["<leader>rha"] = { "<cmd> RustHoverActions <CR>", "RustHoverActions" },
["<leader>roc"] = { "<cmd> RustOpenCargo <CR>", "RustOpenCargo"}, ["<leader>roc"] = { "<cmd> RustOpenCargo <CR>", "RustOpenCargo" },
["<leader>rcg"] = { "<cmd> RustViewCrateGraph <CR>", "RustViewCrateGraph"}, ["<leader>rcg"] = { "<cmd> RustViewCrateGraph <CR>", "RustViewCrateGraph" },
}, },
} }
M.blankline = { M.blankline = {
plugin = true, plugin = true,
n = { n = {
["<leader>cc"] = { ["<leader>cc"] = {
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

View File

@ -4,8 +4,8 @@ local g = vim.g
-- use filetype.lua instead of filetype.vim. it's enabled by default in neovim 0.8 (nightly) -- use filetype.lua instead of filetype.vim. it's enabled by default in neovim 0.8 (nightly)
g.vim_version = vim.version().minor g.vim_version = vim.version().minor
if g.vim_version < 8 then if g.vim_version < 8 then
g.did_load_filetypes = 0 g.did_load_filetypes = 0
g.do_filetype_lua = 1 g.do_filetype_lua = 1
end end
opt.laststatus = 3 -- global statusline opt.laststatus = 3 -- global statusline
@ -44,26 +44,26 @@ opt.timeoutlen = 400
-- disable some builtin vim plugins -- disable some builtin vim plugins
local default_plugins = { local default_plugins = {
"2html_plugin", "2html_plugin",
"getscript", "getscript",
"getscriptPlugin", "getscriptPlugin",
"gzip", "gzip",
"logipat", "logipat",
"netrw", "netrw",
"netrwPlugin", "netrwPlugin",
"netrwSettings", "netrwSettings",
"netrwFileHandlers", "netrwFileHandlers",
"matchit", "matchit",
"tar", "tar",
"tarPlugin", "tarPlugin",
"rrhelper", "rrhelper",
"spellfile_plugin", "spellfile_plugin",
"vimball", "vimball",
"vimball_plugin", "vimball_plugin",
"zip", "zip",
"zipPlugin", "zipPlugin",
} }
for _, plugin in pairs(default_plugins) do for _, plugin in pairs(default_plugins) do
g["loaded_" .. plugin ] = 1 g["loaded_" .. plugin] = 1
end end

View File

@ -1,41 +1,41 @@
local M = {} local M = {}
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
local final_table = {}
for key, _ in pairs(plugins) do
plugins[key][1] = key
final_table[#final_table + 1] = plugins[key]
end
packer.init({
auto_clean = true,
compile_on_sync = true,
git = { clone_timeout = 6000 },
display = {
working_sym = "",
error_sym = "",
done_sym = "",
removed_sym = "",
moved_sym = "",
open_fn = function()
return require("packer.util").float { border = "single" }
end,
}
})
packer.startup(function(use)
for _, v in pairs(final_table) do
use(v)
end end
end)
local final_table = {}
for key, _ in pairs(plugins) do
plugins[key][1] = key
final_table[#final_table + 1] = plugins[key]
end
packer.init({
auto_clean = true,
compile_on_sync = true,
git = { clone_timeout = 6000 },
display = {
working_sym = "",
error_sym = "",
done_sym = "",
removed_sym = "",
moved_sym = "",
open_fn = function()
return require("packer.util").float { border = "single" }
end,
}
})
packer.startup(function(use)
for _, v in pairs(final_table) do
use(v)
end
end)
end end
return M return M

View File

@ -2,45 +2,45 @@ local M = {}
local merge_tb = vim.tbl_deep_extend local merge_tb = vim.tbl_deep_extend
M.close_buffer = function(bufnr) M.close_buffer = function(bufnr)
if vim.bo.buftype == "terminal" then if vim.bo.buftype == "terminal" then
vim.cmd(vim.bo.buflisted and "set nobl | enew" or "hide") vim.cmd(vim.bo.buflisted and "set nobl | enew" or "hide")
else else
bufnr = bufnr or vim.api.nvim_get_current_buf() bufnr = bufnr or vim.api.nvim_get_current_buf()
vim.cmd("confirm bd" .. bufnr) vim.cmd("confirm bd" .. bufnr)
end end
end end
M.load_mappings = function(section, mapping_opt) M.load_mappings = function(section, mapping_opt)
local function set_section_map(section_values) local function set_section_map(section_values)
if section_values.plugin then if section_values.plugin then
return return
end
section_values.plugin = nil
for mode, mode_values in pairs(section_values) do
local default_opts = merge_tb("force", { mode = mode }, mapping_opt or {})
for keybind, mapping_info in pairs(mode_values) do
-- merge default + user opts
local opts = merge_tb("force", default_opts, mapping_info.opts or {})
mapping_info.opts, opts.mode = nil, nil
opts.desc = mapping_info[2]
vim.keymap.set(mode, keybind, mapping_info[1], opts)
end
end
end end
section_values.plugin = nil
for mode, mode_values in pairs(section_values) do local mappings = require("core.mappings")
local default_opts = merge_tb("force", { mode = mode }, mapping_opt or {})
for keybind, mapping_info in pairs(mode_values) do
-- merge default + user opts
local opts = merge_tb("force", default_opts, mapping_info.opts or {})
mapping_info.opts, opts.mode = nil, nil if type(section) == "string" then
opts.desc = mapping_info[2] mappings[section]["plugin"] = nil
mappings = { mappings[section] }
vim.keymap.set(mode, keybind, mapping_info[1], opts)
end
end end
end
local mappings = require("core.mappings") for _, sect in pairs(mappings) do
set_section_map(sect)
if type(section) == "string" then end
mappings[section]["plugin"] = nil
mappings = { mappings[section] }
end
for _, sect in pairs(mappings) do
set_section_map(sect)
end
end end
return M return M

View File

@ -1,139 +1,139 @@
local present, cmp = pcall(require, "cmp") local present, cmp = pcall(require, "cmp")
if not present then if not present then
return return
end end
vim.opt.completeopt = "menuone,noselect" vim.opt.completeopt = "menuone,noselect"
local function border(hl_name) local function border(hl_name)
return { return {
{ "", hl_name }, { "", hl_name },
{ "", hl_name }, { "", hl_name },
{ "", hl_name }, { "", hl_name },
{ "", hl_name }, { "", hl_name },
{ "", hl_name }, { "", hl_name },
{ "", hl_name }, { "", hl_name },
{ "", hl_name }, { "", hl_name },
{ "", hl_name }, { "", hl_name },
} }
end end
local cmp_window = require "cmp.utils.window" local cmp_window = require "cmp.utils.window"
cmp_window.info_ = cmp_window.info cmp_window.info_ = cmp_window.info
cmp_window.info = function(self) cmp_window.info = function(self)
local info = self:info_() local info = self:info_()
info.scrollable = false info.scrollable = false
return info return info
end end
local options = { local options = {
window = { window = {
completion = { completion = {
border = border "CmpBorder", border = border "CmpBorder",
winhighlight = "Normal:CmpPmenu,CursorLine:PmenuSel,Search:None", winhighlight = "Normal:CmpPmenu,CursorLine:PmenuSel,Search:None",
},
documentation = {
border = border "CmpDocBorder",
},
}, },
documentation = { snippet = {
border = border "CmpDocBorder", expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
}, },
},
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
},
formatting = { formatting = {
format = function(_, vim_item) format = function(_, vim_item)
local icons = { local icons = {
Namespace = "", Namespace = "",
Text = "", Text = "",
Method = "", Method = "",
Function = "", Function = "",
Constructor = "", Constructor = "",
Field = "", Field = "",
Variable = "", Variable = "",
Class = "", Class = "",
Interface = "", Interface = "",
Module = "", Module = "",
Property = "", Property = "",
Unit = "", Unit = "",
Value = "", Value = "",
Enum = "", Enum = "",
Keyword = "", Keyword = "",
Snippet = "", Snippet = "",
Color = "", Color = "",
File = "", File = "",
Reference = "", Reference = "",
Folder = "", Folder = "",
EnumMember = "", EnumMember = "",
Constant = "", Constant = "",
Struct = "", Struct = "",
Event = "", Event = "",
Operator = "", Operator = "",
TypeParameter = "", TypeParameter = "",
Table = "", Table = "",
Object = "", Object = "",
Tag = "", Tag = "",
Array = "[]", Array = "[]",
Boolean = "", Boolean = "",
Number = "", Number = "",
Null = "", Null = "",
String = "", String = "",
Calendar = "", Calendar = "",
Watch = "", Watch = "",
Package = "", Package = "",
} }
vim_item.kind = string.format("%s %s", icons[vim_item.kind], vim_item.kind) vim_item.kind = string.format("%s %s", icons[vim_item.kind], vim_item.kind)
return vim_item return vim_item
end, end,
}, },
mapping = { mapping = {
["<C-p>"] = cmp.mapping.select_prev_item(), ["<C-p>"] = cmp.mapping.select_prev_item(),
["<C-n>"] = cmp.mapping.select_next_item(), ["<C-n>"] = cmp.mapping.select_next_item(),
["<C-d>"] = cmp.mapping.scroll_docs(-4), ["<C-d>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4), ["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(), ["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.close(), ["<C-e>"] = cmp.mapping.close(),
["<CR>"] = cmp.mapping.confirm { ["<CR>"] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace, behavior = cmp.ConfirmBehavior.Replace,
select = false, select = false,
},
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif require("luasnip").expand_or_jumpable() then
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-expand-or-jump", true, true, true), "")
else
fallback()
end
end, {
"i",
"s",
}),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif require("luasnip").jumpable(-1) then
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-jump-prev", true, true, true), "")
else
fallback()
end
end, {
"i",
"s",
}),
},
sources = {
{ name = "luasnip" },
{ name = "nvim_lsp" },
{ name = "buffer" },
{ name = "nvim_lua" },
{ name = "path" },
{ name = "crates" },
}, },
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif require("luasnip").expand_or_jumpable() then
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-expand-or-jump", true, true, true), "")
else
fallback()
end
end, {
"i",
"s",
}),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif require("luasnip").jumpable(-1) then
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-jump-prev", true, true, true), "")
else
fallback()
end
end, {
"i",
"s",
}),
},
sources = {
{ name = "luasnip" },
{ name = "nvim_lsp" },
{ name = "buffer" },
{ name = "nvim_lua" },
{ name = "path" },
{ name = "crates" },
},
} }
-- check for any override -- check for any override

View File

@ -1,7 +1,7 @@
local present, lspconfig = pcall(require, "lspconfig") local present, lspconfig = pcall(require, "lspconfig")
if not present then if not present then
return return
end end
local M = {} local M = {}
@ -10,110 +10,110 @@ local utils = require "core.utils"
-- export on_attach & capabilities for custom lspconfigs -- export on_attach & capabilities for custom lspconfigs
M.on_attach = function(client, bufnr) M.on_attach = function(client, bufnr)
-- if vim.g.vim_version > 7 then -- if vim.g.vim_version > 7 then
-- -- nightly -- -- nightly
-- client.server_capabilities.documentFormattingProvider = false -- client.server_capabilities.documentFormattingProvider = false
-- client.server_capabilities.documentRangeFormattingProvider = false -- client.server_capabilities.documentRangeFormattingProvider = false
-- else -- else
-- -- stable -- -- stable
-- client.resolved_capabilities.document_formatting = false -- client.resolved_capabilities.document_formatting = false
-- client.resolved_capabilities.document_range_formatting = false -- client.resolved_capabilities.document_range_formatting = false
-- end -- end
utils.load_mappings("lspconfig", { buffer = bufnr }) utils.load_mappings("lspconfig", { buffer = bufnr })
if client.server_capabilities.signatureHelpProvider then if client.server_capabilities.signatureHelpProvider then
local function lspSymbol(name, icon) local function lspSymbol(name, icon)
local hl = "DiagnosticSign" .. name local hl = "DiagnosticSign" .. name
vim.fn.sign_define(hl, { text = icon, numhl = hl, texthl = hl }) vim.fn.sign_define(hl, { text = icon, numhl = hl, texthl = hl })
end
lspSymbol("Error", "")
lspSymbol("Info", "")
lspSymbol("Hint", "")
lspSymbol("Warn", "")
vim.diagnostic.config {
virtual_text = {
prefix = "",
},
signs = true,
underline = true,
update_in_insert = false,
}
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
border = "single",
})
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
border = "single",
focusable = false,
relative = "cursor",
})
-- suppress error messages from lang servers
vim.notify = function(msg, log_level)
if msg:match "exit code" then
return
end
if log_level == vim.log.levels.ERROR then
vim.api.nvim_err_writeln(msg)
else
vim.api.nvim_echo({ { msg } }, true, {})
end
end
-- Borders for LspInfo winodw
local win = require "lspconfig.ui.windows"
local _default_opts = win.default_opts
win.default_opts = function(options)
local opts = _default_opts(options)
opts.border = "single"
return opts
end
end end
lspSymbol("Error", "")
lspSymbol("Info", "")
lspSymbol("Hint", "")
lspSymbol("Warn", "")
vim.diagnostic.config {
virtual_text = {
prefix = "",
},
signs = true,
underline = true,
update_in_insert = false,
}
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
border = "single",
})
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
border = "single",
focusable = false,
relative = "cursor",
})
-- suppress error messages from lang servers
vim.notify = function(msg, log_level)
if msg:match "exit code" then
return
end
if log_level == vim.log.levels.ERROR then
vim.api.nvim_err_writeln(msg)
else
vim.api.nvim_echo({ { msg } }, true, {})
end
end
-- Borders for LspInfo winodw
local win = require "lspconfig.ui.windows"
local _default_opts = win.default_opts
win.default_opts = function(options)
local opts = _default_opts(options)
opts.border = "single"
return opts
end
end
end end
M.capabilities = vim.lsp.protocol.make_client_capabilities() M.capabilities = vim.lsp.protocol.make_client_capabilities()
M.capabilities.textDocument.completion.completionItem = { M.capabilities.textDocument.completion.completionItem = {
documentationFormat = { "markdown", "plaintext" }, documentationFormat = { "markdown", "plaintext" },
snippetSupport = true, snippetSupport = true,
preselectSupport = true, preselectSupport = true,
insertReplaceSupport = true, insertReplaceSupport = true,
labelDetailsSupport = true, labelDetailsSupport = true,
deprecatedSupport = true, deprecatedSupport = true,
commitCharactersSupport = true, commitCharactersSupport = true,
tagSupport = { valueSet = { 1 } }, tagSupport = { valueSet = { 1 } },
resolveSupport = { resolveSupport = {
properties = { properties = {
"documentation", "documentation",
"detail", "detail",
"additionalTextEdits", "additionalTextEdits",
},
}, },
},
} }
lspconfig.sumneko_lua.setup { lspconfig.sumneko_lua.setup {
on_attach = M.on_attach, on_attach = M.on_attach,
capabilities = M.capabilities, capabilities = M.capabilities,
settings = { settings = {
Lua = { Lua = {
diagnostics = { diagnostics = {
globals = { "vim" }, globals = { "vim" },
}, },
workspace = { workspace = {
library = { library = {
[vim.fn.expand "$VIMRUNTIME/lua"] = true, [vim.fn.expand "$VIMRUNTIME/lua"] = true,
[vim.fn.expand "$VIMRUNTIME/lua/vim/lsp"] = true, [vim.fn.expand "$VIMRUNTIME/lua/vim/lsp"] = true,
},
maxPreload = 100000,
preloadFileSize = 10000,
},
}, },
maxPreload = 100000,
preloadFileSize = 10000,
},
}, },
},
} }
-- lspconfig.rust_analyzer.setup { -- lspconfig.rust_analyzer.setup {

View File

@ -1,32 +1,32 @@
local present, mason = pcall(require, "mason") local present, mason = pcall(require, "mason")
if not present then if not present then
return return
end end
local options = { local options = {
ensure_installed = { "lua-language-server" }, -- not an option from mason.nvim ensure_installed = { "lua-language-server" }, -- not an option from mason.nvim
ui = { ui = {
icons = { icons = {
package_pending = "", package_pending = "",
package_installed = "", package_installed = "",
package_uninstalled = "", package_uninstalled = "",
},
keymaps = {
toggle_server_expand = "<CR>",
install_server = "i",
update_server = "u",
check_server_version = "c",
update_all_servers = "U",
check_outdated_servers = "C",
uninstall_server = "X",
cancel_installation = "<C-c>",
},
}, },
keymaps = { max_concurrent_installers = 10,
toggle_server_expand = "<CR>",
install_server = "i",
update_server = "u",
check_server_version = "c",
update_all_servers = "U",
check_outdated_servers = "C",
uninstall_server = "X",
cancel_installation = "<C-c>",
},
},
max_concurrent_installers = 10,
} }
mason.setup(options) mason.setup(options)

View File

@ -1,84 +1,84 @@
local present, nvimtree = pcall(require, "nvim-tree") local present, nvimtree = pcall(require, "nvim-tree")
if not present then if not present then
return return
end end
local options = { local options = {
filters = { filters = {
dotfiles = false, dotfiles = false,
exclude = { vim.fn.stdpath "config" .. "/lua/custom" }, exclude = { vim.fn.stdpath "config" .. "/lua/custom" },
},
disable_netrw = true,
hijack_netrw = true,
open_on_setup = false,
ignore_ft_on_setup = { "alpha" },
hijack_cursor = true,
hijack_unnamed_buffer_when_opening = false,
update_cwd = true,
update_focused_file = {
enable = true,
update_cwd = false,
},
view = {
adaptive_size = true,
side = "left",
width = 25,
hide_root_folder = true,
},
git = {
enable = false,
ignore = true,
},
filesystem_watchers = {
enable = true,
},
actions = {
open_file = {
resize_window = true,
}, },
}, disable_netrw = true,
renderer = { hijack_netrw = true,
highlight_git = false, open_on_setup = false,
highlight_opened_files = "none", ignore_ft_on_setup = { "alpha" },
hijack_cursor = true,
indent_markers = { hijack_unnamed_buffer_when_opening = false,
enable = false, update_cwd = true,
update_focused_file = {
enable = true,
update_cwd = false,
}, },
view = {
icons = { adaptive_size = true,
show = { side = "left",
file = true, width = 25,
folder = true, hide_root_folder = true,
folder_arrow = true, },
git = false, git = {
}, enable = false,
ignore = true,
glyphs = { },
default = "", filesystem_watchers = {
symlink = "", enable = true,
folder = { },
default = "", actions = {
empty = "", open_file = {
empty_open = "", resize_window = true,
open = "", },
symlink = "", },
symlink_open = "", renderer = {
arrow_open = "", highlight_git = false,
arrow_closed = "", highlight_opened_files = "none",
indent_markers = {
enable = false,
},
icons = {
show = {
file = true,
folder = true,
folder_arrow = true,
git = false,
},
glyphs = {
default = "",
symlink = "",
folder = {
default = "",
empty = "",
empty_open = "",
open = "",
symlink = "",
symlink_open = "",
arrow_open = "",
arrow_closed = "",
},
git = {
unstaged = "",
staged = "",
unmerged = "",
renamed = "",
untracked = "",
deleted = "",
ignored = "",
},
},
}, },
git = {
unstaged = "",
staged = "",
unmerged = "",
renamed = "",
untracked = "",
deleted = "",
ignored = "",
},
},
}, },
},
} }
-- check for any override -- check for any override

View File

@ -1,30 +1,30 @@
local present, nvterm = pcall(require, "nvterm") local present, nvterm = pcall(require, "nvterm")
if not present then if not present then
return return
end end
local options = { local options = {
terminals = { terminals = {
list = {}, list = {},
type_opts = { type_opts = {
float = { float = {
relative = "editor", relative = "editor",
row = 0.3, row = 0.3,
col = 0.25, col = 0.25,
width = 0.5, width = 0.5,
height = 0.4, height = 0.4,
border = "single", border = "single",
}, },
horizontal = { location = "rightbelow", split_ratio = 0.4 }, horizontal = { location = "rightbelow", split_ratio = 0.4 },
vertical = { location = "rightbelow", split_ratio = 0.5 }, vertical = { location = "rightbelow", split_ratio = 0.5 },
},
}, },
}, behavior = {
behavior = { close_on_exit = true,
close_on_exit = true, auto_insert = true,
auto_insert = true, },
}, enable_new_mappings = true,
enable_new_mappings = true,
} }
nvterm.setup(options) nvterm.setup(options)

View File

@ -1,72 +1,71 @@
local M = {} local M = {}
M.autopairs = function() M.autopairs = function()
local present1, autopairs = pcall(require, "nvim-autopairs") local present1, autopairs = pcall(require, "nvim-autopairs")
local present2, cmp = pcall(require, "cmp") local present2, cmp = pcall(require, "cmp")
if not (present1 and present2) then if not (present1 and present2) then
return return
end end
local options = { local options = {
fast_wrap = {}, fast_wrap = {},
disable_filetype = { "TelescopePrompt", "vim" }, disable_filetype = { "TelescopePrompt", "vim" },
} }
autopairs.setup(options) autopairs.setup(options)
local cmp_autopairs = require "nvim-autopairs.completion.cmp" local cmp_autopairs = require "nvim-autopairs.completion.cmp"
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done()) cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
end end
M.luasnip = function() M.luasnip = function()
local present, luasnip = pcall(require, "luasnip") local present, luasnip = pcall(require, "luasnip")
if not present then if not present then
return return
end end
local options = { local options = {
history = true, history = true,
updateevents = "TextChanged,TextChangedI", updateevents = "TextChanged,TextChangedI",
} }
luasnip.config.set_config(options) luasnip.config.set_config(options)
require("luasnip.loaders.from_vscode").lazy_load() require("luasnip.loaders.from_vscode").lazy_load()
require("luasnip.loaders.from_vscode").lazy_load { paths = vim.g.luasnippets_path or "" } require("luasnip.loaders.from_vscode").lazy_load { paths = vim.g.luasnippets_path or "" }
vim.api.nvim_create_autocmd("InsertLeave", { vim.api.nvim_create_autocmd("InsertLeave", {
callback = function() callback = function()
if if require("luasnip").session.current_nodes[vim.api.nvim_get_current_buf()]
require("luasnip").session.current_nodes[vim.api.nvim_get_current_buf()] and not require("luasnip").session.jump_active
and not require("luasnip").session.jump_active then
then require("luasnip").unlink_current()
require("luasnip").unlink_current() end
end end,
end, })
})
end end
M.gitsigns = function() M.gitsigns = function()
local present, gitsigns = pcall(require, "gitsigns") local present, gitsigns = pcall(require, "gitsigns")
if not present then if not present then
return return
end end
local options = { local options = {
signs = { signs = {
add = { hl = "GitSignsAdd", text = "", numhl = "GitSignsAddNr", linehl = "GitSignsAddLn" }, add = { hl = "GitSignsAdd", text = "", numhl = "GitSignsAddNr", linehl = "GitSignsAddLn" },
change = { hl = "GitSignsChange", text = "", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" }, change = { hl = "GitSignsChange", text = "", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" },
delete = { hl = "GitSignsDelete", text = "", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" }, delete = { hl = "GitSignsDelete", text = "", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" },
topdelete = { hl = "GitSignsDelete", text = "", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" }, topdelete = { hl = "GitSignsDelete", text = "", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" },
changedelete = { hl = "GitSignsChange", text = "", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" }, changedelete = { hl = "GitSignsChange", text = "", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" },
}, },
} }
gitsigns.setup(options) gitsigns.setup(options)
end end
M.crates = function () M.crates = function()
local present, crates = pcall(require, "crates") local present, crates = pcall(require, "crates")
if not present then if not present then
@ -89,73 +88,73 @@ M.crates = function ()
end end
M.blankline = function() M.blankline = function()
local present, blankline = pcall(require, "indent_blankline") local present, blankline = pcall(require, "indent_blankline")
if not present then if not present then
return return
end end
local options = { local options = {
indentLine_enabled = 1, indentLine_enabled = 1,
char = "", char = "",
filetype_exclude = { filetype_exclude = {
"help", "help",
"terminal", "terminal",
"alpha", "alpha",
"packer", "packer",
"lspinfo", "lspinfo",
"TelescopePrompt", "TelescopePrompt",
"TelescopeResults", "TelescopeResults",
"nvchad_cheatsheet", "nvchad_cheatsheet",
"lsp-installer", "lsp-installer",
"", "",
}, },
buftype_exclude = { "terminal" }, buftype_exclude = { "terminal" },
show_trailing_blankline_indent = false, show_trailing_blankline_indent = false,
show_first_indent_level = false, show_first_indent_level = false,
} }
blankline.setup(options) blankline.setup(options)
end end
M.colorizer = function() M.colorizer = function()
local present, colorizer = pcall(require, "colorizer") local present, colorizer = pcall(require, "colorizer")
if not present then if not present then
return return
end end
local options = { local options = {
filetypes = { filetypes = {
"*", "*",
}, },
user_default_options = { user_default_options = {
RGB = true, -- #RGB hex codes RGB = true, -- #RGB hex codes
RRGGBB = true, -- #RRGGBB hex codes RRGGBB = true, -- #RRGGBB hex codes
names = false, -- "Name" codes like Blue names = false, -- "Name" codes like Blue
RRGGBBAA = false, -- #RRGGBBAA hex codes RRGGBBAA = false, -- #RRGGBBAA hex codes
rgb_fn = false, -- CSS rgb() and rgba() functions rgb_fn = false, -- CSS rgb() and rgba() functions
hsl_fn = false, -- CSS hsl() and hsla() functions hsl_fn = false, -- CSS hsl() and hsla() functions
css = false, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB css = false, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB
css_fn = false, -- Enable all CSS *functions*: rgb_fn, hsl_fn css_fn = false, -- Enable all CSS *functions*: rgb_fn, hsl_fn
mode = "background", -- Set the display mode. mode = "background", -- Set the display mode.
}, },
} }
colorizer.setup(options) colorizer.setup(options)
return vim.tbl_isempty(options.filetypes or {}) or vim.cmd [[do FileType]] return vim.tbl_isempty(options.filetypes or {}) or vim.cmd [[do FileType]]
end end
M.comment = function() M.comment = function()
local present, nvim_comment = pcall(require, "Comment") local present, nvim_comment = pcall(require, "Comment")
if not present then if not present then
return return
end end
local options = {} local options = {}
nvim_comment.setup(options) nvim_comment.setup(options)
end end
return M return M

View File

@ -8,30 +8,30 @@ capabilities = require("cmp_nvim_lsp").update_capabilities(capabilities)
local options = { local options = {
tools = { tools = {
inlay_hints = { inlay_hints = {
auto = true, auto = true,
only_current_line = false, only_current_line = false,
-- whether to show parameter hints with the inlay hints or not -- whether to show parameter hints with the inlay hints or not
-- default: true -- default: true
show_parameter_hints = true, show_parameter_hints = true,
},
on_initialized = function()
-- ih.set_all()
end,
},
server = {
on_attach =
require("plugins.configs.lspconfig").on_attach
}, },
on_initialized = function()
-- ih.set_all()
end,
},
server = {
on_attach =
require("plugins.configs.lspconfig").on_attach
},
settings = { settings = {
["rust-analyzer"] = { ["rust-analyzer"] = {
checkOnSave = { checkOnSave = {
command = "check", command = "check",
} }
} }
} }
} }
rust.setup(options) rust.setup(options)

View File

@ -1,40 +1,40 @@
require('lualine').setup { require('lualine').setup {
options = { options = {
icons_enabled = true, icons_enabled = true,
theme = 'auto', theme = 'auto',
component_separators = { left = '', right = ''}, component_separators = { left = '', right = '' },
section_separators = { left = '', right = ''}, section_separators = { left = '', right = '' },
disabled_filetypes = { disabled_filetypes = {
statusline = {}, statusline = {},
winbar = {}, winbar = {},
},
ignore_focus = {},
always_divide_middle = true,
globalstatus = false,
refresh = {
statusline = 1000,
tabline = 1000,
winbar = 1000,
}
}, },
ignore_focus = {}, sections = {
always_divide_middle = true, lualine_a = { 'mode' },
globalstatus = false, lualine_b = { 'branch', 'diff', 'diagnostics' },
refresh = { lualine_c = { 'filename' },
statusline = 1000, lualine_x = { 'encoding', 'fileformat', 'filetype' },
tabline = 1000, lualine_y = { 'progress' },
winbar = 1000, lualine_z = { 'location' }
} },
}, inactive_sections = {
sections = { lualine_a = {},
lualine_a = {'mode'}, lualine_b = {},
lualine_b = {'branch', 'diff', 'diagnostics'}, lualine_c = { 'filename' },
lualine_c = {'filename'}, lualine_x = { 'location' },
lualine_x = {'encoding', 'fileformat', 'filetype'}, lualine_y = {},
lualine_y = {'progress'}, lualine_z = {}
lualine_z = {'location'} },
}, tabline = {},
inactive_sections = { winbar = {},
lualine_a = {}, inactive_winbar = {},
lualine_b = {}, extensions = {}
lualine_c = {'filename'},
lualine_x = {'location'},
lualine_y = {},
lualine_z = {}
},
tabline = {},
winbar = {},
inactive_winbar = {},
extensions = {}
} }

View File

@ -1,62 +1,62 @@
local present, telescope = pcall(require, "telescope") local present, telescope = pcall(require, "telescope")
if not present then if not present then
return return
end end
vim.g.theme_switcher_loaded = true vim.g.theme_switcher_loaded = true
local options = { local options = {
defaults = { defaults = {
vimgrep_arguments = { vimgrep_arguments = {
"rg", "rg",
"--color=never", "--color=never",
"--no-heading", "--no-heading",
"--with-filename", "--with-filename",
"--line-number", "--line-number",
"--column", "--column",
"--smart-case", "--smart-case",
},
prompt_prefix = "",
selection_caret = " ",
entry_prefix = " ",
initial_mode = "insert",
selection_strategy = "reset",
sorting_strategy = "ascending",
layout_strategy = "horizontal",
layout_config = {
horizontal = {
prompt_position = "top",
preview_width = 0.55,
results_width = 0.8,
},
vertical = {
mirror = false,
},
width = 0.87,
height = 0.80,
preview_cutoff = 120,
},
file_sorter = require("telescope.sorters").get_fuzzy_file,
file_ignore_patterns = { "node_modules" },
generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter,
path_display = { "truncate" },
winblend = 0,
border = {},
borderchars = { "", "", "", "", "", "", "", "" },
color_devicons = true,
set_env = { ["COLORTERM"] = "truecolor" }, -- default = nil,
file_previewer = require("telescope.previewers").vim_buffer_cat.new,
grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new,
qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new,
-- Developer configurations: Not meant for general override
buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker,
mappings = {
n = { ["q"] = require("telescope.actions").close },
},
}, },
prompt_prefix = "",
selection_caret = " ",
entry_prefix = " ",
initial_mode = "insert",
selection_strategy = "reset",
sorting_strategy = "ascending",
layout_strategy = "horizontal",
layout_config = {
horizontal = {
prompt_position = "top",
preview_width = 0.55,
results_width = 0.8,
},
vertical = {
mirror = false,
},
width = 0.87,
height = 0.80,
preview_cutoff = 120,
},
file_sorter = require("telescope.sorters").get_fuzzy_file,
file_ignore_patterns = { "node_modules" },
generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter,
path_display = { "truncate" },
winblend = 0,
border = {},
borderchars = { "", "", "", "", "", "", "", "" },
color_devicons = true,
set_env = { ["COLORTERM"] = "truecolor" }, -- default = nil,
file_previewer = require("telescope.previewers").vim_buffer_cat.new,
grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new,
qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new,
-- Developer configurations: Not meant for general override
buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker,
mappings = {
n = { ["q"] = require("telescope.actions").close },
},
},
extensions_list = { "themes", "terms" }, extensions_list = { "themes", "terms" },
} }
-- check for any override -- check for any override
@ -64,7 +64,7 @@ telescope.setup(options)
-- load extensions -- load extensions
pcall(function() pcall(function()
for _, ext in ipairs(options.extensions_list) do for _, ext in ipairs(options.extensions_list) do
telescope.load_extension(ext) telescope.load_extension(ext)
end end
end) end)

View File

@ -1,37 +1,37 @@
local present, wk = pcall(require, "which-key") local present, wk = pcall(require, "which-key")
if not present then if not present then
return return
end end
local options = { local options = {
icons = { icons = {
breadcrumb = "»", -- symbol used in the command line area that shows your active key combo breadcrumb = "»", -- symbol used in the command line area that shows your active key combo
separator = "", -- symbol used between a key and it's label separator = "", -- symbol used between a key and it's label
group = "+", -- symbol prepended to a group group = "+", -- symbol prepended to a group
}, },
popup_mappings = { popup_mappings = {
scroll_down = "<c-d>", -- binding to scroll down inside the popup scroll_down = "<c-d>", -- binding to scroll down inside the popup
scroll_up = "<c-u>", -- binding to scroll up inside the popup scroll_up = "<c-u>", -- binding to scroll up inside the popup
}, },
window = { window = {
border = "none", -- none/single/double/shadow border = "none", -- none/single/double/shadow
}, },
layout = { layout = {
spacing = 6, -- spacing between columns spacing = 6, -- spacing between columns
}, },
hidden = { "<silent>", "<cmd>", "<Cmd>", "<CR>", "call", "lua", "^:", "^ " }, hidden = { "<silent>", "<cmd>", "<Cmd>", "<CR>", "call", "lua", "^:", "^ " },
triggers_blacklist = { triggers_blacklist = {
-- list of mode / prefixes that should never be hooked by WhichKey -- list of mode / prefixes that should never be hooked by WhichKey
i = { "j", "k" }, i = { "j", "k" },
v = { "j", "k" }, v = { "j", "k" },
}, },
} }
wk.setup(options) wk.setup(options)

View File

@ -2,184 +2,184 @@ vim.cmd "packadd packer.nvim"
local plugins = { local plugins = {
["wbthomason/packer.nvim"] = { ["wbthomason/packer.nvim"] = {
cmd = require("core.lazy_load").packer_cmds, cmd = require("core.lazy_load").packer_cmds,
config = function() config = function()
require "plugins" require "plugins"
end, end,
}, },
["nvim-treesitter/nvim-treesitter"] = { ["nvim-treesitter/nvim-treesitter"] = {
module = "nvim-treesitter", module = "nvim-treesitter",
setup = function() setup = function()
require("core.lazy_load").on_file_open "nvim-treesitter" require("core.lazy_load").on_file_open "nvim-treesitter"
end, end,
cmd = require("core.lazy_load").treesitter_cmds, cmd = require("core.lazy_load").treesitter_cmds,
run = ":TSUpdate", run = ":TSUpdate",
config = function() config = function()
require "plugins.configs.treesitter" require "plugins.configs.treesitter"
end, end,
}, },
-- git -- git
["lewis6991/gitsigns.nvim"] = { ["lewis6991/gitsigns.nvim"] = {
ft = "gitcommit", ft = "gitcommit",
setup = function() setup = function()
require("core.lazy_load").gitsigns() require("core.lazy_load").gitsigns()
end, end,
config = function() config = function()
require("plugins.configs.others").gitsigns() require("plugins.configs.others").gitsigns()
end, end,
}, },
['nvim-lua/plenary.nvim'] = {}, ['nvim-lua/plenary.nvim'] = {},
["nvim-telescope/telescope.nvim"] = { ["nvim-telescope/telescope.nvim"] = {
cmd = "Telescope", cmd = "Telescope",
config = function() config = function()
require "plugins.configs.telescope" require "plugins.configs.telescope"
end,
setup = function ()
require ("core.utils").load_mappings "telescope"
end,
},
-- lsp stuff
["williamboman/mason.nvim"] = {
cmd = require("core.lazy_load").mason_cmds,
config = function()
require "plugins.configs.mason"
end,
},
["neovim/nvim-lspconfig"] = {
opt = true,
setup = function()
require("core.lazy_load").on_file_open "nvim-lspconfig"
end,
config = function()
require "plugins.configs.lspconfig"
end,
},
["simrat39/rust-tools.nvim"] = {
after = "nvim-lspconfig",
config = function ()
require("plugins.configs.rust-tools")
require("core.utils").load_mappings "rust"
end,
},
["Saecki/crates.nvim"] = {
event = { "BufRead Cargo.toml" },
config = function ()
require("plugins.configs.others").crates()
end
},
-- load luasnips + cmp related in insert mode only
["rafamadriz/friendly-snippets"] = {
module = { "cmp", "cmp_nvim_lsp" },
event = "InsertEnter",
},
["hrsh7th/nvim-cmp"] = {
after = "friendly-snippets",
config = function()
require "plugins.configs.cmp"
end,
},
["L3MON4D3/LuaSnip"] = {
wants = "friendly-snippets",
after = "nvim-cmp",
config = function()
require("plugins.configs.others").luasnip()
end,
},
["saadparwaiz1/cmp_luasnip"] = {
after = "LuaSnip",
},
["hrsh7th/cmp-nvim-lua"] = {
after = "cmp_luasnip",
},
["hrsh7th/cmp-nvim-lsp"] = {
after = "cmp-nvim-lua",
},
["hrsh7th/cmp-buffer"] = {
after = "cmp-nvim-lsp",
},
["hrsh7th/cmp-path"] = {
after = "cmp-buffer",
},
-- misc
["windwp/nvim-autopairs"] = {
after = "nvim-cmp",
config = function()
require("plugins.configs.others").autopairs()
end,
},
["numToStr/Comment.nvim"] = {
module = "Comment",
keys = { "gc", "gb" },
config = function()
require("plugins.configs.others").comment()
end,
setup = function()
require("core.utils").load_mappings "comment"
end,
},
-- file managing , picker etc
["kyazdani42/nvim-tree.lua"] = {
ft = "alpha",
cmd = { "NvimTreeToggle", "NvimTreeFocus" },
config = function()
require "plugins.configs.nvimtree"
end,
setup = function()
require("core.utils").load_mappings "nvimtree"
end,
},
["NvChad/nvterm"] = {
module = "nvterm",
config = function()
require "plugins.configs.nvterm"
end,
setup = function()
require("core.utils").load_mappings "nvterm"
end,
},
-- UI stuff
["lukas-reineke/indent-blankline.nvim"] = {
event = "BufRead",
config = function()
require("plugins.configs.others").blankline()
end,
setup = function()
require("core.utils").load_mappings "blankline"
end,
},
["krolyxon/nvim-colorizer.lua"] = {
opt = true,
setup = function ()
require("core.lazy_load").on_file_open "nvim-colorizer.lua"
end, end,
config = function() setup = function()
require("plugins.configs.others").colorizer() require("core.utils").load_mappings "telescope"
end, end,
}, },
-- lsp stuff
["williamboman/mason.nvim"] = {
cmd = require("core.lazy_load").mason_cmds,
config = function()
require "plugins.configs.mason"
end,
},
["neovim/nvim-lspconfig"] = {
opt = true,
setup = function()
require("core.lazy_load").on_file_open "nvim-lspconfig"
end,
config = function()
require "plugins.configs.lspconfig"
end,
},
["simrat39/rust-tools.nvim"] = {
after = "nvim-lspconfig",
config = function()
require("plugins.configs.rust-tools")
require("core.utils").load_mappings "rust"
end,
},
["Saecki/crates.nvim"] = {
event = { "BufRead Cargo.toml" },
config = function()
require("plugins.configs.others").crates()
end
},
-- load luasnips + cmp related in insert mode only
["rafamadriz/friendly-snippets"] = {
module = { "cmp", "cmp_nvim_lsp" },
event = "InsertEnter",
},
["hrsh7th/nvim-cmp"] = {
after = "friendly-snippets",
config = function()
require "plugins.configs.cmp"
end,
},
["L3MON4D3/LuaSnip"] = {
wants = "friendly-snippets",
after = "nvim-cmp",
config = function()
require("plugins.configs.others").luasnip()
end,
},
["saadparwaiz1/cmp_luasnip"] = {
after = "LuaSnip",
},
["hrsh7th/cmp-nvim-lua"] = {
after = "cmp_luasnip",
},
["hrsh7th/cmp-nvim-lsp"] = {
after = "cmp-nvim-lua",
},
["hrsh7th/cmp-buffer"] = {
after = "cmp-nvim-lsp",
},
["hrsh7th/cmp-path"] = {
after = "cmp-buffer",
},
-- misc
["windwp/nvim-autopairs"] = {
after = "nvim-cmp",
config = function()
require("plugins.configs.others").autopairs()
end,
},
["numToStr/Comment.nvim"] = {
module = "Comment",
keys = { "gc", "gb" },
config = function()
require("plugins.configs.others").comment()
end,
setup = function()
require("core.utils").load_mappings "comment"
end,
},
-- file managing , picker etc
["kyazdani42/nvim-tree.lua"] = {
ft = "alpha",
cmd = { "NvimTreeToggle", "NvimTreeFocus" },
config = function()
require "plugins.configs.nvimtree"
end,
setup = function()
require("core.utils").load_mappings "nvimtree"
end,
},
["NvChad/nvterm"] = {
module = "nvterm",
config = function()
require "plugins.configs.nvterm"
end,
setup = function()
require("core.utils").load_mappings "nvterm"
end,
},
-- UI stuff
["lukas-reineke/indent-blankline.nvim"] = {
event = "BufRead",
config = function()
require("plugins.configs.others").blankline()
end,
setup = function()
require("core.utils").load_mappings "blankline"
end,
},
["krolyxon/nvim-colorizer.lua"] = {
opt = true,
setup = function()
require("core.lazy_load").on_file_open "nvim-colorizer.lua"
end,
config = function()
require("plugins.configs.others").colorizer()
end,
},
["nvim-lualine/lualine.nvim"] = { ["nvim-lualine/lualine.nvim"] = {
config = function() config = function()
@ -189,17 +189,17 @@ local plugins = {
-- Only load whichkey after all the gui -- Only load whichkey after all the gui
["folke/which-key.nvim"] = { ["folke/which-key.nvim"] = {
disable = false, disable = false,
module = "which-key", module = "which-key",
keys = "<leader>", keys = "<leader>",
config = function() config = function()
require "plugins.configs.whichkey" require "plugins.configs.whichkey"
end, end,
setup = function() setup = function()
require("core.utils").load_mappings "whichkey" require("core.utils").load_mappings "whichkey"
end, end,
}, },
-- speed up deffered plugins -- speed up deffered plugins
["lewis6991/impatient.nvim"] = {}, ["lewis6991/impatient.nvim"] = {},
} }
require("core.packer").run(plugins) require("core.packer").run(plugins)