move neovim config here
This commit is contained in:
commit
8df1114f70
41 changed files with 1374 additions and 0 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
plugin
|
11
LICENSE
Normal file
11
LICENSE
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||||
|
Version 2, December 2004
|
||||||
|
|
||||||
|
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
|
||||||
|
|
||||||
|
Everyone is permitted to copy and distribute verbatim or modified copies of this license document, and changing it is allowed as long as the name is changed.
|
||||||
|
|
||||||
|
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||||
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
|
0. You just DO WHAT THE FUCK YOU WANT TO.
|
7
README.md
Normal file
7
README.md
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
# Neovim Config
|
||||||
|
To use this neovim config, run `git clone https://code.relms.dev/Relms/neovim-config ~/.config/nvim` to clone the config to your .config folder.
|
||||||
|
|
||||||
|
When you open the config for the first time, you will get a packer.nvim window to open which will open all the required plugins. After that, close Neovim again and reopen it. It will then proceed to install a bunch of treesitter parsers. That is normal.
|
||||||
|
|
||||||
|
## Using GitHub copilot
|
||||||
|
- TODO
|
27
init.lua
Normal file
27
init.lua
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
require("user.options")
|
||||||
|
require("user.keymaps")
|
||||||
|
require("user.plugins")
|
||||||
|
require("user.notify")
|
||||||
|
require("user.cmp")
|
||||||
|
require("user.lsp")
|
||||||
|
require("user.colorscheme")
|
||||||
|
require("user.telescope")
|
||||||
|
require("user.treesitter")
|
||||||
|
require("user.autopairs")
|
||||||
|
require("user.comment")
|
||||||
|
require("user.gitsigns")
|
||||||
|
require("user.nvimtree")
|
||||||
|
require("user.bufferline")
|
||||||
|
require("user.whitespace")
|
||||||
|
require("user.lualine")
|
||||||
|
require("user.toggleterm")
|
||||||
|
require("user.impatient")
|
||||||
|
require("user.indentline")
|
||||||
|
require("user.alpha")
|
||||||
|
require("user.whichkey")
|
||||||
|
require("user.trouble")
|
||||||
|
require("user.colorizer")
|
||||||
|
require("user.discord")
|
||||||
|
require("user.spectre")
|
||||||
|
require("user.dap")
|
||||||
|
require("user.copilot")
|
36
lua/user/alpha.lua
Normal file
36
lua/user/alpha.lua
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
local status_ok, alpha = pcall(require, "alpha")
|
||||||
|
if not status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local dashboard = require("alpha.themes.dashboard")
|
||||||
|
dashboard.section.header.val = {
|
||||||
|
" ▟▙",
|
||||||
|
" ▝▘",
|
||||||
|
"██▃▅▇█▆▖ ▗▟████▙▖ ▄████▄ ██▄ ▄██ ██ ▗▟█▆▄▄▆█▙▖",
|
||||||
|
"██▛▔ ▝██ ██▄▄▄▄██ ██▛▔▔▜██ ▝██ ██▘ ██ ██▛▜██▛▜██",
|
||||||
|
"██ ██ ██▀▀▀▀▀▘ ██▖ ▗██ ▜█▙▟█▛ ██ ██ ██ ██",
|
||||||
|
"██ ██ ▜█▙▄▄▄▟▊ ▀██▙▟██▀ ▝████▘ ██ ██ ██ ██",
|
||||||
|
"▀▀ ▀▀ ▝▀▀▀▀▀ ▀▀▀▀ ▀▀ ▀▀ ▀▀ ▀▀ ▀▀",
|
||||||
|
}
|
||||||
|
dashboard.section.buttons.val = {
|
||||||
|
dashboard.button("f", " Find file", ":Telescope find_files <CR>"),
|
||||||
|
dashboard.button("e", " New file", ":ene <BAR> startinsert <CR>"),
|
||||||
|
dashboard.button("r", " Recently used files", ":Telescope oldfiles <CR>"),
|
||||||
|
dashboard.button("t", " Find text", ":Telescope live_grep <CR>"),
|
||||||
|
dashboard.button("c", " Configuration", ":e ~/.config/nvim/init.lua <CR>"),
|
||||||
|
dashboard.button("q", " Quit Neovim", ":qa<CR>"),
|
||||||
|
}
|
||||||
|
|
||||||
|
local function footer()
|
||||||
|
return "I use Arch BTW"
|
||||||
|
end
|
||||||
|
|
||||||
|
dashboard.section.footer.val = footer()
|
||||||
|
|
||||||
|
dashboard.section.footer.opts.hl = "Type"
|
||||||
|
dashboard.section.header.opts.hl = "Include"
|
||||||
|
dashboard.section.buttons.opts.hl = "Keyword"
|
||||||
|
|
||||||
|
dashboard.opts.opts.noautocmd = true
|
||||||
|
alpha.setup(dashboard.opts)
|
46
lua/user/autocommands.lua
Normal file
46
lua/user/autocommands.lua
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
-- Use 'q' to quit from common plugins
|
||||||
|
vim.api.nvim_create_autocmd({ "FileType" }, {
|
||||||
|
pattern = { "qf", "help", "man", "lspinfo", "spectre_panel", "lir" },
|
||||||
|
callback = function()
|
||||||
|
vim.cmd([[
|
||||||
|
nnoremap <silent> <buffer> q :close<CR>
|
||||||
|
set nobuflisted
|
||||||
|
]])
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Remove statusline and tabline when in Alpha
|
||||||
|
vim.api.nvim_create_autocmd({ "User" }, {
|
||||||
|
pattern = { "AlphaReady" },
|
||||||
|
callback = function()
|
||||||
|
vim.cmd([[
|
||||||
|
set showtabline=0 | autocmd BufUnload <buffer> set showtabline=2
|
||||||
|
set laststatus=0 | autocmd BufUnload <buffer> set laststatus=3
|
||||||
|
]])
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Set wrap and spell in markdown and gitcommit
|
||||||
|
vim.api.nvim_create_autocmd({ "FileType" }, {
|
||||||
|
pattern = { "gitcommit", "markdown" },
|
||||||
|
callback = function()
|
||||||
|
vim.opt_local.wrap = true
|
||||||
|
vim.opt_local.spell = true
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.cmd("autocmd BufEnter * ++nested if winnr('$') == 1 && bufname() == 'NvimTree_' . tabpagenr() | quit | endif")
|
||||||
|
|
||||||
|
-- Fixes Autocomment
|
||||||
|
vim.api.nvim_create_autocmd({ "BufWinEnter" }, {
|
||||||
|
callback = function()
|
||||||
|
vim.cmd("set formatoptions-=cro")
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Highlight Yanked Text
|
||||||
|
vim.api.nvim_create_autocmd({ "TextYankPost" }, {
|
||||||
|
callback = function()
|
||||||
|
vim.highlight.on_yank({ higroup = "Visual", timeout = 200 })
|
||||||
|
end,
|
||||||
|
})
|
17
lua/user/autopairs.lua
Normal file
17
lua/user/autopairs.lua
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
-- Setup nvim-cmp.
|
||||||
|
local status_ok, npairs = pcall(require, "nvim-autopairs")
|
||||||
|
if not status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
npairs.setup({
|
||||||
|
check_ts = true, -- treesitter integration
|
||||||
|
disable_filetype = { "TelescopePrompt" },
|
||||||
|
})
|
||||||
|
|
||||||
|
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
|
||||||
|
local cmp_status_ok, cmp = pcall(require, "cmp")
|
||||||
|
if not cmp_status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done({}))
|
34
lua/user/bufferline.lua
Normal file
34
lua/user/bufferline.lua
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
local status_ok, bufferline = pcall(require, "bufferline")
|
||||||
|
if not status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
bufferline.setup({
|
||||||
|
options = {
|
||||||
|
numbers = "ordinal",
|
||||||
|
close_command = "Bdelete! %d",
|
||||||
|
right_mouse_command = "Bdelete! %d",
|
||||||
|
left_mouse_command = "buffer %d",
|
||||||
|
middle_mouse_command = nil,
|
||||||
|
indicator_icon = "▎",
|
||||||
|
buffer_close_icon = "",
|
||||||
|
modified_icon = "●",
|
||||||
|
close_icon = "",
|
||||||
|
left_trunc_marker = "",
|
||||||
|
right_trunc_marker = "",
|
||||||
|
max_name_length = 30,
|
||||||
|
max_prefix_length = 30,
|
||||||
|
tab_size = 21,
|
||||||
|
diagnostics = "nvim_lsp",
|
||||||
|
diagnostics_update_in_insert = true,
|
||||||
|
offsets = { { filetype = "NvimTree", text = "", padding = 1 } },
|
||||||
|
show_buffer_icons = true,
|
||||||
|
show_buffer_close_icons = true,
|
||||||
|
show_close_icon = true,
|
||||||
|
show_tab_indicators = true,
|
||||||
|
persist_buffer_sort = true,
|
||||||
|
separator_style = "thin",
|
||||||
|
enforce_regular_tabs = true,
|
||||||
|
always_show_bufferline = true,
|
||||||
|
},
|
||||||
|
})
|
152
lua/user/cmp.lua
Normal file
152
lua/user/cmp.lua
Normal file
|
@ -0,0 +1,152 @@
|
||||||
|
local cmp_status_ok, cmp = pcall(require, "cmp")
|
||||||
|
if not cmp_status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local npm_status_ok, npm = pcall(require, "cmp-npm")
|
||||||
|
if not npm_status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local snip_status_ok, luasnip = pcall(require, "luasnip")
|
||||||
|
if not snip_status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
require("luasnip/loaders/from_vscode").lazy_load()
|
||||||
|
|
||||||
|
local check_backspace = function()
|
||||||
|
local col = vim.fn.col(".") - 1
|
||||||
|
return col == 0 or vim.fn.getline("."):sub(col, col):match("%s")
|
||||||
|
end
|
||||||
|
|
||||||
|
npm.setup({})
|
||||||
|
|
||||||
|
local kind_icons = {
|
||||||
|
Text = "",
|
||||||
|
Method = "m",
|
||||||
|
Function = "",
|
||||||
|
Constructor = "",
|
||||||
|
Field = "",
|
||||||
|
Variable = "",
|
||||||
|
Class = "",
|
||||||
|
Interface = "",
|
||||||
|
Module = "",
|
||||||
|
Property = "",
|
||||||
|
Unit = "",
|
||||||
|
Value = "",
|
||||||
|
Enum = "",
|
||||||
|
Keyword = "",
|
||||||
|
Snippet = "",
|
||||||
|
Color = "",
|
||||||
|
File = "",
|
||||||
|
Reference = "",
|
||||||
|
Folder = "",
|
||||||
|
EnumMember = "",
|
||||||
|
Constant = "",
|
||||||
|
Struct = "",
|
||||||
|
Event = "",
|
||||||
|
Operator = "",
|
||||||
|
TypeParameter = "",
|
||||||
|
}
|
||||||
|
|
||||||
|
cmp.setup({
|
||||||
|
snippet = {
|
||||||
|
expand = function(args)
|
||||||
|
luasnip.lsp_expand(args.body)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
mapping = {
|
||||||
|
["<C-k>"] = cmp.mapping.select_prev_item(),
|
||||||
|
["<C-j>"] = cmp.mapping.select_next_item(),
|
||||||
|
["<C-b>"] = cmp.mapping(cmp.mapping.scroll_docs(-1), { "i", "c" }),
|
||||||
|
["<C-f>"] = cmp.mapping(cmp.mapping.scroll_docs(1), { "i", "c" }),
|
||||||
|
["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
|
||||||
|
["<C-y>"] = cmp.config.disable,
|
||||||
|
["<C-e>"] = cmp.mapping({
|
||||||
|
i = cmp.mapping.abort(),
|
||||||
|
c = cmp.mapping.close(),
|
||||||
|
}),
|
||||||
|
["<CR>"] = cmp.mapping.confirm({ select = true }),
|
||||||
|
["<Tab>"] = cmp.mapping(function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_next_item()
|
||||||
|
elseif luasnip.expandable() then
|
||||||
|
luasnip.expand()
|
||||||
|
elseif luasnip.expand_or_jumpable() then
|
||||||
|
luasnip.expand_or_jump()
|
||||||
|
elseif check_backspace() then
|
||||||
|
fallback()
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end, {
|
||||||
|
"i",
|
||||||
|
"s",
|
||||||
|
}),
|
||||||
|
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_prev_item()
|
||||||
|
elseif luasnip.jumpable(-1) then
|
||||||
|
luasnip.jump(-1)
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end, {
|
||||||
|
"i",
|
||||||
|
"s",
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
formatting = {
|
||||||
|
fields = { "abbr", "kind", "menu" },
|
||||||
|
format = function(entry, vim_item)
|
||||||
|
vim_item.kind = string.format("%s", kind_icons[vim_item.kind])
|
||||||
|
vim_item.menu = ({
|
||||||
|
nvim_lsp = "[LSP]",
|
||||||
|
copilot = "[COPILOT]",
|
||||||
|
npm = "[NPM]",
|
||||||
|
nvim_lua = "[NVIM_LUA]",
|
||||||
|
luasnip = "[SNIPPET]",
|
||||||
|
buffer = "[BUFFER]",
|
||||||
|
path = "[PATH6]",
|
||||||
|
})[entry.source.name]
|
||||||
|
return vim_item
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
sources = {
|
||||||
|
{ name = "copilot" },
|
||||||
|
{ name = "nvim_lsp" },
|
||||||
|
{ name = "npm" },
|
||||||
|
{ name = "nvim_lua" },
|
||||||
|
{ name = "luasnip" },
|
||||||
|
{ name = "buffer" },
|
||||||
|
{ name = "path" },
|
||||||
|
},
|
||||||
|
confirm_opts = {
|
||||||
|
behavior = cmp.ConfirmBehavior.Replace,
|
||||||
|
select = false,
|
||||||
|
},
|
||||||
|
window = {
|
||||||
|
documentation = {
|
||||||
|
border = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
experimental = {
|
||||||
|
ghost_text = true,
|
||||||
|
native_menu = false,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
cmp.setup.cmdline("/", {
|
||||||
|
sources = {
|
||||||
|
{ name = "buffer" },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
cmp.setup.cmdline(":", {
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = "path" },
|
||||||
|
}, {
|
||||||
|
{ name = "cmdline" },
|
||||||
|
}),
|
||||||
|
})
|
17
lua/user/colorizer.lua
Normal file
17
lua/user/colorizer.lua
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
local status_ok, colorizer = pcall(require, "colorizer")
|
||||||
|
if not status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
colorizer.setup({ "*" }, {
|
||||||
|
RGB = true, -- #RGB hex codes
|
||||||
|
RRGGBB = true, -- #RRGGBB hex codes
|
||||||
|
names = false, -- "Name" codes like Blue oe blue
|
||||||
|
RRGGBBAA = true, -- #RRGGBBAA hex codes
|
||||||
|
rgb_fn = true, -- CSS rgb() and rgba() functions
|
||||||
|
hsl_fn = true, -- CSS hsl() and hsla() functions
|
||||||
|
css = false, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB
|
||||||
|
css_fn = false, -- Enable all CSS *functions*: rgb_fn, hsl_fn
|
||||||
|
-- Available modes: foreground, background, virtualtext
|
||||||
|
mode = "background", -- Set the display mode.)
|
||||||
|
})
|
5
lua/user/colorscheme.lua
Normal file
5
lua/user/colorscheme.lua
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
vim.g.nord_italic = false
|
||||||
|
vim.g.nord_contrast = true
|
||||||
|
vim.g.nord_borders = true
|
||||||
|
require("nord").set()
|
||||||
|
require("lsp-colors").setup()
|
22
lua/user/comment.lua
Normal file
22
lua/user/comment.lua
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
local status_ok, comment = pcall(require, "Comment")
|
||||||
|
if not status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
comment.setup({
|
||||||
|
pre_hook = function(ctx)
|
||||||
|
local U = require("Comment.utils")
|
||||||
|
|
||||||
|
local location = nil
|
||||||
|
if ctx.ctype == U.ctype.block then
|
||||||
|
location = require("ts_context_commentstring.utils").get_cursor_location()
|
||||||
|
elseif ctx.cmotion == U.cmotion.v or ctx.cmotion == U.cmotion.V then
|
||||||
|
location = require("ts_context_commentstring.utils").get_visual_start_location()
|
||||||
|
end
|
||||||
|
|
||||||
|
return require("ts_context_commentstring.internal").calculate_commentstring({
|
||||||
|
key = ctx.ctype == U.ctype.line and "__default" or "__multiline",
|
||||||
|
location = location,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
})
|
6
lua/user/copilot.lua
Normal file
6
lua/user/copilot.lua
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
local status_ok, copilot = pcall(require, "copilot")
|
||||||
|
if not status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
copilot.setup({})
|
12
lua/user/dap.lua
Normal file
12
lua/user/dap.lua
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
local dapui_status_ok, dapui = pcall(require, "dapui")
|
||||||
|
if not dapui_status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local vtest_status_ok, vtest = pcall(require, "nvim-dap-virtual-text")
|
||||||
|
if not vtest_status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
dapui.setup()
|
||||||
|
vtest.setup()
|
6
lua/user/discord.lua
Normal file
6
lua/user/discord.lua
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
local status_ok, discord = pcall(require, "presence")
|
||||||
|
if not status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
discord:setup({})
|
52
lua/user/gitsigns.lua
Normal file
52
lua/user/gitsigns.lua
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
local status_ok, gitsigns = pcall(require, "gitsigns")
|
||||||
|
if not status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
gitsigns.setup({
|
||||||
|
signs = {
|
||||||
|
add = { hl = "GitSignsAdd", text = "▎", numhl = "GitSignsAddNr", linehl = "GitSignsAddLn" },
|
||||||
|
change = { hl = "GitSignsChange", text = "▎", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" },
|
||||||
|
delete = { hl = "GitSignsDelete", text = "契", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" },
|
||||||
|
topdelete = { hl = "GitSignsDelete", text = "契", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" },
|
||||||
|
changedelete = {
|
||||||
|
hl = "GitSignsChange",
|
||||||
|
text = "▎",
|
||||||
|
numhl = "GitSignsChangeNr",
|
||||||
|
linehl = "GitSignsChangeLn",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
signcolumn = true,
|
||||||
|
numhl = false,
|
||||||
|
linehl = false,
|
||||||
|
word_diff = false,
|
||||||
|
watch_gitdir = {
|
||||||
|
interval = 1000,
|
||||||
|
follow_files = true,
|
||||||
|
},
|
||||||
|
attach_to_untracked = true,
|
||||||
|
current_line_blame = true,
|
||||||
|
current_line_blame_opts = {
|
||||||
|
virt_text = true,
|
||||||
|
virt_text_pos = "eol",
|
||||||
|
delay = 1000,
|
||||||
|
ignore_whitespace = false,
|
||||||
|
},
|
||||||
|
current_line_blame_formatter_opts = {
|
||||||
|
relative_time = false,
|
||||||
|
},
|
||||||
|
sign_priority = 6,
|
||||||
|
update_debounce = 100,
|
||||||
|
status_formatter = nil,
|
||||||
|
max_file_length = 40000,
|
||||||
|
preview_config = {
|
||||||
|
border = "single",
|
||||||
|
style = "minimal",
|
||||||
|
relative = "cursor",
|
||||||
|
row = 0,
|
||||||
|
col = 1,
|
||||||
|
},
|
||||||
|
yadm = {
|
||||||
|
enable = false,
|
||||||
|
},
|
||||||
|
})
|
3
lua/user/illuminate.lua
Normal file
3
lua/user/illuminate.lua
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
vim.g.Illuminate_ftblacklist = {'alpha', 'NvimTree'}
|
||||||
|
vim.api.nvim_set_keymap('n', '<a-n>', '<cmd>lua require"illuminate".next_reference{wrap=true}<cr>', {noremap=true})
|
||||||
|
vim.api.nvim_set_keymap('n', '<a-p>', '<cmd>lua require"illuminate".next_reference{reverse=true,wrap=true}<cr>', {noremap=true})
|
6
lua/user/impatient.lua
Normal file
6
lua/user/impatient.lua
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
local status_ok, impatient = pcall(require, "impatient")
|
||||||
|
if not status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
impatient.enable_profile()
|
16
lua/user/indentline.lua
Normal file
16
lua/user/indentline.lua
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
local status_ok, indent_blankline = pcall(require, "indent_blankline")
|
||||||
|
if not status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.g.indent_blankline_filetype_exclude = {
|
||||||
|
"help",
|
||||||
|
"packer",
|
||||||
|
"NvimTree",
|
||||||
|
"Trouble",
|
||||||
|
"alpha",
|
||||||
|
}
|
||||||
|
|
||||||
|
indent_blankline.setup({
|
||||||
|
show_current_context = true,
|
||||||
|
})
|
125
lua/user/keymaps.lua
Normal file
125
lua/user/keymaps.lua
Normal file
|
@ -0,0 +1,125 @@
|
||||||
|
local opts = { noremap = true, silent = true }
|
||||||
|
|
||||||
|
local term_opts = { silent = true }
|
||||||
|
|
||||||
|
-- Shorten function name
|
||||||
|
local keymap = vim.api.nvim_set_keymap
|
||||||
|
|
||||||
|
--Remap space as leader key
|
||||||
|
keymap("", "<Space>", "<Nop>", opts)
|
||||||
|
vim.g.mapleader = " "
|
||||||
|
vim.g.maplocalleader = " "
|
||||||
|
|
||||||
|
-- Modes
|
||||||
|
-- normal_mode = "n",
|
||||||
|
-- insert_mode = "i",
|
||||||
|
-- visual_mode = "v",
|
||||||
|
-- visual_block_mode = "x",
|
||||||
|
-- term_mode = "t",
|
||||||
|
-- command_mode = "c",
|
||||||
|
|
||||||
|
-- Normal --
|
||||||
|
-- Better window navigation
|
||||||
|
keymap("n", "<C-h>", "<C-w>h", opts)
|
||||||
|
keymap("n", "<C-j>", "<C-w>j", opts)
|
||||||
|
keymap("n", "<C-k>", "<C-w>k", opts)
|
||||||
|
keymap("n", "<C-l>", "<C-w>l", opts)
|
||||||
|
|
||||||
|
-- Resize with arrows
|
||||||
|
keymap("n", "<C-Up>", ":resize +2<CR>", opts)
|
||||||
|
keymap("n", "<C-Down>", ":resize -2<CR>", opts)
|
||||||
|
keymap("n", "<C-Left>", ":vertical resize -2<CR>", opts)
|
||||||
|
keymap("n", "<C-Right>", ":vertical resize +2<CR>", opts)
|
||||||
|
|
||||||
|
-- Navigate buffers
|
||||||
|
keymap("n", "<S-l>", ":bnext<CR>", opts)
|
||||||
|
keymap("n", "<S-h>", ":bprevious<CR>", opts)
|
||||||
|
|
||||||
|
-- Telescope
|
||||||
|
keymap("n", "<leader>ff", ":Telescope frecency<CR>", opts)
|
||||||
|
keymap("n", "<leader>fg", ":Telescope live_grep<CR>", opts)
|
||||||
|
keymap("n", "<leader>fb", ":Telescope buffers<CR>", opts)
|
||||||
|
keymap("n", "<leader>fe", ":Telescope emoji<CR>", opts)
|
||||||
|
keymap("n", "<leader>fp", ":Telescope project<CR>", opts)
|
||||||
|
keymap("n", "<leader>fd", ":Telescope dap commands<CR>", opts)
|
||||||
|
|
||||||
|
-- Comment
|
||||||
|
keymap("n", "<leader>/", ":lua require('Comment').toggle()<CR>", opts)
|
||||||
|
|
||||||
|
-- Nvim-Tree
|
||||||
|
keymap("n", "<leader>e", ":NvimTreeToggle<CR>", opts)
|
||||||
|
|
||||||
|
-- Trouble
|
||||||
|
keymap("n", "<leader>xx", ":Trouble<CR>", opts)
|
||||||
|
keymap("n", "<leader>xw", ":Trouble workspace_diagnostics<CR>", opts)
|
||||||
|
keymap("n", "<leader>xd", ":Trouble document_diagnostics<CR>", opts)
|
||||||
|
keymap("n", "<leader>xl", ":Trouble loclist<CR>", opts)
|
||||||
|
keymap("n", "<leader>xq", ":Trouble quickfix<CR>", opts)
|
||||||
|
|
||||||
|
-- DAP
|
||||||
|
keymap("n", "<F4>", ":lua require('dapui').toggle()<CR>", opts)
|
||||||
|
keymap("n", "<F5>", ":lua require('dap').toggle_breakpoint()<CR>", opts)
|
||||||
|
keymap("n", "<F9>", ":lua require('dap').continue()<CR>", opts)
|
||||||
|
keymap("n", "<F1>", ":lua require('dap').step_over()<CR>", opts)
|
||||||
|
keymap("n", "<F2>", ":lua require('dap').step_into()<CR>", opts)
|
||||||
|
keymap("n", "<F3>", ":lua require('dap').step_out()<CR>", opts)
|
||||||
|
keymap("n", "<leader>dsc", ":lua require('dap').continue()<CR>", opts)
|
||||||
|
keymap("n", "<leader>dsv", ":lua require('dap').step_over()<CR>", opts)
|
||||||
|
keymap("n", "<leader>dsi", ":lua require('dap').step_into()<CR>", opts)
|
||||||
|
keymap("n", "<leader>dso", ":lua require('dap').step_out()<CR>", opts)
|
||||||
|
keymap("n", "<leader>dhh", ":lua require('dap.ui.variables').hover()<CR>", opts)
|
||||||
|
keymap("v", "<leader>dhv", ":lua require('dap.ui.variables').visual_hover()<CR>", opts)
|
||||||
|
keymap("n", "<leader>duh", ":lua require('dap.ui.widgets').hover()<CR>", opts)
|
||||||
|
keymap(
|
||||||
|
"n",
|
||||||
|
"<leader>duf",
|
||||||
|
":lua local widgets=require('dap.ui.widgets');widgets.centered_float(widgets.scopes)<CR>",
|
||||||
|
opts
|
||||||
|
)
|
||||||
|
keymap("n", "<leader>dro", ":lua require('dap').repl.open()<CR>", opts)
|
||||||
|
keymap("n", "<leader>drl", ":lua require('dap').repl.run_last()<CR>", opts)
|
||||||
|
keymap("n", "<leader>dbc", ":lua require('dap').set_breakpoint(vim.fn.input('Breakpoint condition: '))<CR>", opts)
|
||||||
|
keymap(
|
||||||
|
"n",
|
||||||
|
"<leader>dbm",
|
||||||
|
":lua require('dap').set_breakpoint({ nil, nil, vim.fn.input('Log point message: ') })<CR>",
|
||||||
|
opts
|
||||||
|
)
|
||||||
|
keymap("n", "<leader>dbt", ":lua require('dap').toggle_breakpoint()<CR>", opts)
|
||||||
|
keymap("n", "<leader>dc", ":lua require('dap.ui.variables').scopes()<CR>", opts)
|
||||||
|
keymap("n", "<leader>di", ":lua require('dapui').toggle()<CR>", opts)
|
||||||
|
|
||||||
|
-- Spectre
|
||||||
|
keymap("n", "<leader>S", ":lua require('spectre').open()<CR>", opts)
|
||||||
|
keymap("n", "<leader>sw", ":lua require('spectre').open_visual({select_word=true})<CR>", opts)
|
||||||
|
keymap("n", "<leader>s", ":lua require('spectre').open_visual()<CR>", opts)
|
||||||
|
keymap("n", "<leader>sp", ":lua require('spectre').open_file_search()<CR>", opts)
|
||||||
|
|
||||||
|
-- Insert --
|
||||||
|
|
||||||
|
-- Visual --
|
||||||
|
-- Stay in indent mode
|
||||||
|
keymap("v", "<", "<gv", opts)
|
||||||
|
keymap("v", ">", ">gv", opts)
|
||||||
|
|
||||||
|
-- Move text up and down
|
||||||
|
keymap("v", "<A-j>", ":m .+1<CR>==", opts)
|
||||||
|
keymap("v", "<A-k>", ":m .-2<CR>==", opts)
|
||||||
|
keymap("v", "p", '"_dP', opts)
|
||||||
|
|
||||||
|
-- Comment
|
||||||
|
keymap("v", "<leader>/", ':lua require("Comment.api").gc(vim.fn.visualmode())<CR>', opts)
|
||||||
|
|
||||||
|
-- Visual Block --
|
||||||
|
-- Move text up and down
|
||||||
|
keymap("x", "J", ":move '>+1<CR>gv-gv", opts)
|
||||||
|
keymap("x", "K", ":move '<-2<CR>gv-gv", opts)
|
||||||
|
keymap("x", "<A-j>", ":move '>+1<CR>gv-gv", opts)
|
||||||
|
keymap("x", "<A-k>", ":move '<-2<CR>gv-gv", opts)
|
||||||
|
|
||||||
|
-- Terminal --
|
||||||
|
-- Better terminal navigation
|
||||||
|
keymap("t", "<C-h>", "<C-\\><C-N><C-w>h", term_opts)
|
||||||
|
keymap("t", "<C-j>", "<C-\\><C-N><C-w>j", term_opts)
|
||||||
|
keymap("t", "<C-k>", "<C-\\><C-N><C-w>k", term_opts)
|
||||||
|
keymap("t", "<C-l>", "<C-\\><C-N><C-w>l", term_opts)
|
91
lua/user/lsp/handlers.lua
Normal file
91
lua/user/lsp/handlers.lua
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.setup = function()
|
||||||
|
local signs = {
|
||||||
|
{ name = "DiagnosticSignError", text = "" },
|
||||||
|
{ name = "DiagnosticSignWarn", text = "" },
|
||||||
|
{ name = "DiagnosticSignHint", text = "" },
|
||||||
|
{ name = "DiagnosticSignInfo", text = "" },
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, sign in ipairs(signs) do
|
||||||
|
vim.fn.sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = "" })
|
||||||
|
end
|
||||||
|
|
||||||
|
local config = {
|
||||||
|
virtual_text = false,
|
||||||
|
signs = {
|
||||||
|
active = signs,
|
||||||
|
},
|
||||||
|
update_in_insert = true,
|
||||||
|
underline = true,
|
||||||
|
severity_sort = true,
|
||||||
|
float = {
|
||||||
|
focusable = false,
|
||||||
|
style = "minimal",
|
||||||
|
border = "rounded",
|
||||||
|
source = "always",
|
||||||
|
header = "",
|
||||||
|
prefix = "",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
vim.diagnostic.config(config)
|
||||||
|
|
||||||
|
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
|
||||||
|
border = "rounded",
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
|
||||||
|
border = "rounded",
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
local function lsp_highlight_document(client)
|
||||||
|
local status_ok, illuminate = pcall(require, "illuminate")
|
||||||
|
if not status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
illuminate.on_attach(client)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function lsp_keymaps(bufnr)
|
||||||
|
local opts = { noremap = true, silent = true }
|
||||||
|
|
||||||
|
vim.api.nvim_buf_set_keymap(bufnr, "n", "gD", ":lua vim.lsp.buf.declaration()<CR>", opts)
|
||||||
|
vim.api.nvim_buf_set_keymap(bufnr, "n", "gd", ":lua vim.lsp.buf.definition()<CR>", opts)
|
||||||
|
vim.api.nvim_buf_set_keymap(bufnr, "n", "K", ":lua vim.lsp.buf.hover()<CR>", opts)
|
||||||
|
vim.api.nvim_buf_set_keymap(bufnr, "n", "gi", ":lua vim.lsp.buf.implementation()<CR>", opts)
|
||||||
|
vim.api.nvim_buf_set_keymap(bufnr, "n", "<C-k>", ":lua vim.lsp.buf.signature_help()<CR>", opts)
|
||||||
|
vim.api.nvim_buf_set_keymap(bufnr, "n", "grn", ":lua vim.lsp.buf.rename()<CR>", opts)
|
||||||
|
vim.api.nvim_buf_set_keymap(bufnr, "n", "gr", ":lua vim.lsp.buf.references()<CR>", opts)
|
||||||
|
vim.api.nvim_buf_set_keymap(bufnr, "n", "gca", ":lua vim.lsp.buf.code_action()<CR>", opts)
|
||||||
|
vim.api.nvim_buf_set_keymap(bufnr, "n", "gl", ":lua vim.diagnostic.open_float()<CR>", opts)
|
||||||
|
vim.api.nvim_buf_set_keymap(bufnr, "n", "[d", ':lua vim.diagnostic.goto_prev({ border = "rounded" })<CR>', opts)
|
||||||
|
vim.api.nvim_buf_set_keymap(bufnr, "n", "]d", ':lua vim.diagnostic.goto_next({ border = "rounded" })<CR>', opts)
|
||||||
|
vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>q", "<cmd>lua vim.diagnostic.setloclist()<CR>", opts)
|
||||||
|
vim.cmd([[ command! Format execute 'lua vim.lsp.buf.formatting()' ]])
|
||||||
|
end
|
||||||
|
|
||||||
|
M.on_attach = function(client, bufnr)
|
||||||
|
lsp_keymaps(bufnr)
|
||||||
|
lsp_highlight_document(client)
|
||||||
|
|
||||||
|
if client.server_capabilities.documentSymbolProvider then
|
||||||
|
local navic = require("nvim-navic")
|
||||||
|
navic.attach(client, bufnr)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||||
|
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||||
|
|
||||||
|
local status_ok, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp")
|
||||||
|
|
||||||
|
if not status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
M.capabilities = cmp_nvim_lsp.update_capabilities(capabilities)
|
||||||
|
|
||||||
|
return M
|
4
lua/user/lsp/init.lua
Normal file
4
lua/user/lsp/init.lua
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
require("user.lsp.handlers").setup()
|
||||||
|
require("user.lsp.mason")
|
||||||
|
require("user.lsp.nullls")
|
||||||
|
require("user.lsp.signature")
|
20
lua/user/lsp/mason.lua
Normal file
20
lua/user/lsp/mason.lua
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
local status_ok, mason = pcall(require, "mason")
|
||||||
|
if not status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local lspconfig = require("lspconfig")
|
||||||
|
|
||||||
|
mason.setup()
|
||||||
|
require("mason-lspconfig").setup({
|
||||||
|
automatic_installation = true,
|
||||||
|
})
|
||||||
|
|
||||||
|
lspconfig.util.default_config = vim.tbl_extend("force", lspconfig.util.default_config, {
|
||||||
|
on_attach = require("user.lsp.handlers").on_attach,
|
||||||
|
capabilities = require("user.lsp.handlers").capabilities,
|
||||||
|
})
|
||||||
|
|
||||||
|
require("user.lsp.settings.sumneko_lua")
|
||||||
|
require("user.lsp.settings.jsonls")
|
||||||
|
require("user.lsp.settings.tsserver")
|
28
lua/user/lsp/nullls.lua
Normal file
28
lua/user/lsp/nullls.lua
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
local null_ls_status_ok, null_ls = pcall(require, "null-ls")
|
||||||
|
if not null_ls_status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local formatting = null_ls.builtins.formatting
|
||||||
|
local code_actions = null_ls.builtins.code_actions
|
||||||
|
local diagnostics = null_ls.builtins.diagnostics
|
||||||
|
|
||||||
|
null_ls.setup({
|
||||||
|
debug = false,
|
||||||
|
sources = {
|
||||||
|
formatting.stylua,
|
||||||
|
code_actions.eslint_d,
|
||||||
|
diagnostics.eslint_d,
|
||||||
|
formatting.eslint_d,
|
||||||
|
},
|
||||||
|
on_attach = function(client)
|
||||||
|
if client.server_capabilities.documentFormattingProvider then
|
||||||
|
vim.cmd([[
|
||||||
|
augroup LspFormatting
|
||||||
|
autocmd! * <buffer>
|
||||||
|
autocmd BufWritePre <buffer> lua vim.lsp.buf.format()
|
||||||
|
augroup END
|
||||||
|
]])
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
18
lua/user/lsp/settings/jsonls.lua
Normal file
18
lua/user/lsp/settings/jsonls.lua
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
local status_ok, lspconfig = pcall(require, "lspconfig")
|
||||||
|
if not status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local schemastore_status_ok, schemastore = pcall(require, "schemastore")
|
||||||
|
if not schemastore_status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
lspconfig.jsonls.setup({
|
||||||
|
settings = {
|
||||||
|
json = {
|
||||||
|
schemas = schemastore.json.schemas(),
|
||||||
|
validate = { enable = true },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
11
lua/user/lsp/settings/sumneko_lua.lua
Normal file
11
lua/user/lsp/settings/sumneko_lua.lua
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
local lspconfig = require("lspconfig")
|
||||||
|
|
||||||
|
lspconfig.sumneko_lua.setup({
|
||||||
|
settings = {
|
||||||
|
Lua = {
|
||||||
|
diagnostics = {
|
||||||
|
globals = { "vim" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
6
lua/user/lsp/settings/tsserver.lua
Normal file
6
lua/user/lsp/settings/tsserver.lua
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
local status_ok, lspconfig = pcall(require, "lspconfig")
|
||||||
|
if not status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
lspconfig.tsserver.setup({})
|
11
lua/user/lsp/signature.lua
Normal file
11
lua/user/lsp/signature.lua
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
local status_ok, signature = pcall(require, "lsp_signature")
|
||||||
|
if not status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local cfg = {
|
||||||
|
floating_window = false, -- show hint in a floating window, set to false for virtual text only mode
|
||||||
|
}
|
||||||
|
|
||||||
|
signature.setup(cfg) -- no need to specify bufnr if you don't use toggle_key
|
||||||
|
signature.on_attach(cfg) -- no need to specify bufnr if you don't use toggle_key
|
38
lua/user/lualine.lua
Normal file
38
lua/user/lualine.lua
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
local status_ok, lualine = pcall(require, "lualine")
|
||||||
|
if not status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
lualine.setup({
|
||||||
|
options = {
|
||||||
|
icons_enabled = true,
|
||||||
|
theme = "auto",
|
||||||
|
component_separators = { left = "", right = "" },
|
||||||
|
section_separators = { left = "", right = "" },
|
||||||
|
disabled_filetypes = { "alpha", "NvimTree" },
|
||||||
|
always_divide_middle = true,
|
||||||
|
},
|
||||||
|
sections = {
|
||||||
|
lualine_a = { "mode" },
|
||||||
|
lualine_b = { "branch", "diff", "diagnostics" },
|
||||||
|
lualine_c = { "filename", "filesize" },
|
||||||
|
lualine_x = { "encoding", "fileformat", "filetype" },
|
||||||
|
lualine_y = { "progress" },
|
||||||
|
lualine_z = { "location" },
|
||||||
|
},
|
||||||
|
inactive_sections = {
|
||||||
|
lualine_a = {},
|
||||||
|
lualine_b = {},
|
||||||
|
lualine_c = { "filename" },
|
||||||
|
lualine_x = { "location" },
|
||||||
|
lualine_y = {},
|
||||||
|
lualine_z = {},
|
||||||
|
},
|
||||||
|
tabline = {},
|
||||||
|
extensions = {
|
||||||
|
"nvim-tree",
|
||||||
|
"toggleterm",
|
||||||
|
"fzf",
|
||||||
|
"quickfix",
|
||||||
|
},
|
||||||
|
})
|
16
lua/user/notify.lua
Normal file
16
lua/user/notify.lua
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
local status_ok, notify = pcall(require, "notify")
|
||||||
|
if not status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
notify.setup({
|
||||||
|
stages = "fade_in_slide_out",
|
||||||
|
on_open = nil,
|
||||||
|
on_close = nil,
|
||||||
|
render = "default",
|
||||||
|
timeout = 175,
|
||||||
|
background_colour = "Normal",
|
||||||
|
minimum_width = 10,
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.notify = notify
|
102
lua/user/nvimtree.lua
Normal file
102
lua/user/nvimtree.lua
Normal file
|
@ -0,0 +1,102 @@
|
||||||
|
local status_ok, nvim_tree = pcall(require, "nvim-tree")
|
||||||
|
if not status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local config_status_ok, nvim_tree_config = pcall(require, "nvim-tree.config")
|
||||||
|
if not config_status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local tree_cb = nvim_tree_config.nvim_tree_callback
|
||||||
|
vim.api.nvim_create_autocmd("BufEnter", {
|
||||||
|
nested = true,
|
||||||
|
callback = function()
|
||||||
|
if #vim.api.nvim_list_wins() == 1 and vim.api.nvim_buf_get_name(0):match("NvimTree_") ~= nil then
|
||||||
|
vim.cmd("quit")
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
nvim_tree.setup({
|
||||||
|
disable_netrw = true,
|
||||||
|
hijack_netrw = true,
|
||||||
|
open_on_setup = false,
|
||||||
|
ignore_ft_on_setup = {
|
||||||
|
"alpha",
|
||||||
|
},
|
||||||
|
open_on_tab = true,
|
||||||
|
hijack_cursor = true,
|
||||||
|
update_cwd = true,
|
||||||
|
diagnostics = {
|
||||||
|
enable = true,
|
||||||
|
icons = {
|
||||||
|
hint = "",
|
||||||
|
info = "",
|
||||||
|
warning = "",
|
||||||
|
error = "",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
update_focused_file = {
|
||||||
|
enable = true,
|
||||||
|
update_cwd = true,
|
||||||
|
ignore_list = {},
|
||||||
|
},
|
||||||
|
git = {
|
||||||
|
enable = true,
|
||||||
|
ignore = true,
|
||||||
|
timeout = 500,
|
||||||
|
},
|
||||||
|
view = {
|
||||||
|
width = 30,
|
||||||
|
height = 30,
|
||||||
|
hide_root_folder = false,
|
||||||
|
side = "left",
|
||||||
|
mappings = {
|
||||||
|
custom_only = false,
|
||||||
|
list = {
|
||||||
|
{ key = { "l", "<CR>", "o" }, cb = tree_cb("edit") },
|
||||||
|
{ key = "h", cb = tree_cb("close_node") },
|
||||||
|
{ key = "v", cb = tree_cb("vsplit") },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
number = false,
|
||||||
|
relativenumber = false,
|
||||||
|
},
|
||||||
|
actions = {
|
||||||
|
open_file = {
|
||||||
|
quit_on_open = false,
|
||||||
|
window_picker = {
|
||||||
|
enable = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
renderer = {
|
||||||
|
icons = {
|
||||||
|
glyphs = {
|
||||||
|
default = "",
|
||||||
|
symlink = "",
|
||||||
|
git = {
|
||||||
|
unstaged = "",
|
||||||
|
staged = "S",
|
||||||
|
unmerged = "",
|
||||||
|
renamed = "➜",
|
||||||
|
deleted = "",
|
||||||
|
untracked = "U",
|
||||||
|
ignored = "◌",
|
||||||
|
},
|
||||||
|
folder = {
|
||||||
|
default = "",
|
||||||
|
open = "",
|
||||||
|
empty = "",
|
||||||
|
empty_open = "",
|
||||||
|
symlink = "",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
filesystem_watchers = {
|
||||||
|
enable = true,
|
||||||
|
interval = 100,
|
||||||
|
},
|
||||||
|
})
|
43
lua/user/options.lua
Normal file
43
lua/user/options.lua
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
vim.opt.backup = false
|
||||||
|
vim.opt.clipboard = "unnamedplus"
|
||||||
|
vim.opt.cmdheight = 2
|
||||||
|
vim.opt.completeopt = { "menuone", "noselect" }
|
||||||
|
vim.opt.conceallevel = 0
|
||||||
|
vim.opt.fileencoding = "utf-8"
|
||||||
|
vim.opt.hlsearch = true
|
||||||
|
vim.opt.ignorecase = true
|
||||||
|
vim.opt.mouse = "a"
|
||||||
|
vim.opt.pumheight = 10
|
||||||
|
vim.opt.showmode = false
|
||||||
|
vim.opt.showtabline = 2
|
||||||
|
vim.opt.smartcase = true
|
||||||
|
vim.opt.smartindent = true
|
||||||
|
vim.opt.splitbelow = true
|
||||||
|
vim.opt.splitright = true
|
||||||
|
vim.opt.swapfile = false
|
||||||
|
vim.opt.termguicolors = true
|
||||||
|
vim.opt.timeoutlen = 500
|
||||||
|
vim.opt.undofile = true
|
||||||
|
vim.opt.updatetime = 50
|
||||||
|
vim.opt.writebackup = false
|
||||||
|
vim.opt.expandtab = false
|
||||||
|
vim.opt.shiftwidth = 2
|
||||||
|
vim.opt.tabstop = 2
|
||||||
|
vim.opt.number = true
|
||||||
|
vim.opt.relativenumber = false
|
||||||
|
vim.opt.numberwidth = 4
|
||||||
|
vim.opt.signcolumn = "yes"
|
||||||
|
vim.opt.wrap = false
|
||||||
|
vim.opt.scrolloff = 8
|
||||||
|
vim.opt.sidescrolloff = 8
|
||||||
|
vim.opt.shortmess:append("c")
|
||||||
|
vim.opt.guicursor = ""
|
||||||
|
vim.opt.incsearch = true
|
||||||
|
vim.opt.colorcolumn = "120"
|
||||||
|
vim.opt.list = true
|
||||||
|
vim.opt.listchars:append("lead:.")
|
||||||
|
vim.opt.winbar = "%{%v:lua.require'user.winbar'.get_winbar()%}"
|
||||||
|
|
||||||
|
vim.cmd("set whichwrap+=<,>,[,],h,l")
|
||||||
|
vim.cmd([[set iskeyword+=-]])
|
||||||
|
vim.cmd([[set formatoptions-=cro]])
|
160
lua/user/plugins.lua
Normal file
160
lua/user/plugins.lua
Normal file
|
@ -0,0 +1,160 @@
|
||||||
|
local fn = vim.fn
|
||||||
|
|
||||||
|
local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim"
|
||||||
|
if fn.empty(fn.glob(install_path)) > 0 then
|
||||||
|
PACKER_BOOTSTRAP = fn.system({
|
||||||
|
"git",
|
||||||
|
"clone",
|
||||||
|
"--depth",
|
||||||
|
"1",
|
||||||
|
"https://github.com/wbthomason/packer.nvim",
|
||||||
|
install_path,
|
||||||
|
})
|
||||||
|
print("Installing packer close and reopen Neovim...")
|
||||||
|
vim.cmd([[packadd packer.nvim]])
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.cmd([[
|
||||||
|
augroup packer_user_config
|
||||||
|
autocmd!
|
||||||
|
autocmd BufWritePost plugins.lua source <afile> | PackerSync
|
||||||
|
augroup end
|
||||||
|
]])
|
||||||
|
|
||||||
|
local status_ok, packer = pcall(require, "packer")
|
||||||
|
if not status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
packer.init({
|
||||||
|
display = {
|
||||||
|
open_fn = function()
|
||||||
|
return require("packer.util").float({ border = "rounded" })
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
return packer.startup(function(use)
|
||||||
|
use("wbthomason/packer.nvim")
|
||||||
|
|
||||||
|
-- Plugin Deps
|
||||||
|
use("nvim-lua/popup.nvim")
|
||||||
|
use("nvim-lua/plenary.nvim")
|
||||||
|
use("kyazdani42/nvim-web-devicons")
|
||||||
|
|
||||||
|
-- Themes
|
||||||
|
use("shaunsingh/nord.nvim")
|
||||||
|
use("folke/lsp-colors.nvim")
|
||||||
|
|
||||||
|
-- Completion
|
||||||
|
use("hrsh7th/nvim-cmp")
|
||||||
|
use("hrsh7th/cmp-buffer")
|
||||||
|
use("hrsh7th/cmp-path")
|
||||||
|
use("hrsh7th/cmp-cmdline")
|
||||||
|
use("saadparwaiz1/cmp_luasnip")
|
||||||
|
use("hrsh7th/cmp-nvim-lsp")
|
||||||
|
use("hrsh7th/cmp-nvim-lua")
|
||||||
|
use("David-Kunz/cmp-npm")
|
||||||
|
use("zbirenbaum/copilot-cmp")
|
||||||
|
|
||||||
|
-- Snippets
|
||||||
|
use("L3MON4D3/LuaSnip")
|
||||||
|
use("rafamadriz/friendly-snippets")
|
||||||
|
|
||||||
|
-- LSP
|
||||||
|
use("neovim/nvim-lspconfig")
|
||||||
|
use("williamboman/mason.nvim")
|
||||||
|
use("jose-elias-alvarez/null-ls.nvim")
|
||||||
|
use("b0o/SchemaStore.nvim")
|
||||||
|
use("ray-x/lsp_signature.nvim")
|
||||||
|
-- use("github/copilot.vim") -- ENABLE ON FIRST TIME ONLY!
|
||||||
|
use("zbirenbaum/copilot.lua")
|
||||||
|
|
||||||
|
-- Trouble
|
||||||
|
use("folke/trouble.nvim")
|
||||||
|
|
||||||
|
-- Telescope
|
||||||
|
use("nvim-telescope/telescope.nvim")
|
||||||
|
use({ "nvim-telescope/telescope-fzf-native.nvim", run = "make" })
|
||||||
|
use("nvim-telescope/telescope-dap.nvim")
|
||||||
|
|
||||||
|
-- Treesitter
|
||||||
|
use({ "nvim-treesitter/nvim-treesitter", run = ":TSUpdate" })
|
||||||
|
use("p00f/nvim-ts-rainbow")
|
||||||
|
use("JoosepAlviste/nvim-ts-context-commentstring")
|
||||||
|
|
||||||
|
-- Autopairs
|
||||||
|
use("windwp/nvim-autopairs")
|
||||||
|
|
||||||
|
-- Comments
|
||||||
|
use("numToStr/Comment.nvim")
|
||||||
|
|
||||||
|
-- Git
|
||||||
|
use("lewis6991/gitsigns.nvim")
|
||||||
|
|
||||||
|
-- Nvim-Tree
|
||||||
|
use("kyazdani42/nvim-tree.lua")
|
||||||
|
|
||||||
|
-- Bufferline
|
||||||
|
use("akinsho/bufferline.nvim")
|
||||||
|
use("moll/vim-bbye")
|
||||||
|
|
||||||
|
-- Whitespace
|
||||||
|
use("ntpeters/vim-better-whitespace")
|
||||||
|
|
||||||
|
-- Lualine
|
||||||
|
use("nvim-lualine/lualine.nvim")
|
||||||
|
|
||||||
|
-- Toggleterm
|
||||||
|
use("akinsho/toggleterm.nvim")
|
||||||
|
|
||||||
|
-- Impatient
|
||||||
|
use("lewis6991/impatient.nvim")
|
||||||
|
|
||||||
|
-- Indent Line
|
||||||
|
use("lukas-reineke/indent-blankline.nvim")
|
||||||
|
|
||||||
|
-- Alpha
|
||||||
|
use("goolord/alpha-nvim")
|
||||||
|
|
||||||
|
-- WhichKey
|
||||||
|
use("folke/which-key.nvim")
|
||||||
|
|
||||||
|
-- Illuminate
|
||||||
|
use("RRethy/vim-illuminate")
|
||||||
|
|
||||||
|
-- Colorizer
|
||||||
|
use("norcalli/nvim-colorizer.lua")
|
||||||
|
|
||||||
|
-- Navic
|
||||||
|
use("SmiteshP/nvim-navic")
|
||||||
|
|
||||||
|
-- Wakatime
|
||||||
|
use("wakatime/vim-wakatime")
|
||||||
|
|
||||||
|
-- Discord
|
||||||
|
use("andweeb/presence.nvim")
|
||||||
|
|
||||||
|
-- DAP
|
||||||
|
use("mfussenegger/nvim-dap")
|
||||||
|
use("rcarriga/nvim-dap-ui")
|
||||||
|
use("theHamsta/nvim-dap-virtual-text")
|
||||||
|
|
||||||
|
-- Spectre
|
||||||
|
use("windwp/nvim-spectre")
|
||||||
|
|
||||||
|
-- Notify
|
||||||
|
use("rcarriga/nvim-notify")
|
||||||
|
|
||||||
|
-- Markdown Preview
|
||||||
|
use({
|
||||||
|
"iamcco/markdown-preview.nvim",
|
||||||
|
run = function()
|
||||||
|
vim.fn["mkdp#util#install"]()
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
if PACKER_BOOTSTRAP then
|
||||||
|
require("packer").sync()
|
||||||
|
end
|
||||||
|
end)
|
9
lua/user/spectre.lua
Normal file
9
lua/user/spectre.lua
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
local status_ok, spectre = pcall(require, "spectre")
|
||||||
|
if not status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
spectre.setup({
|
||||||
|
live_update = true,
|
||||||
|
is_insert_mode = true,
|
||||||
|
})
|
76
lua/user/telescope.lua
Normal file
76
lua/user/telescope.lua
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
local status_ok, telescope = pcall(require, "telescope")
|
||||||
|
if not status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
telescope.load_extension("fzf")
|
||||||
|
telescope.load_extension("dap")
|
||||||
|
|
||||||
|
local actions = require("telescope.actions")
|
||||||
|
|
||||||
|
telescope.setup({
|
||||||
|
defaults = {
|
||||||
|
prompt_prefix = " ",
|
||||||
|
selection_caret = " ",
|
||||||
|
path_display = { "smart" },
|
||||||
|
mappings = {
|
||||||
|
i = {
|
||||||
|
["<C-n>"] = actions.cycle_history_next,
|
||||||
|
["<C-p>"] = actions.cycle_history_prev,
|
||||||
|
["<C-j>"] = actions.move_selection_next,
|
||||||
|
["<C-k>"] = actions.move_selection_previous,
|
||||||
|
["<C-c>"] = actions.close,
|
||||||
|
["<Down>"] = actions.move_selection_next,
|
||||||
|
["<Up>"] = actions.move_selection_previous,
|
||||||
|
["<CR>"] = actions.select_default,
|
||||||
|
["<C-x>"] = actions.select_horizontal,
|
||||||
|
["<C-v>"] = actions.select_vertical,
|
||||||
|
["<C-t>"] = actions.select_tab,
|
||||||
|
["<C-u>"] = actions.preview_scrolling_up,
|
||||||
|
["<C-d>"] = actions.preview_scrolling_down,
|
||||||
|
["<PageUp>"] = actions.results_scrolling_up,
|
||||||
|
["<PageDown>"] = actions.results_scrolling_down,
|
||||||
|
["<Tab>"] = actions.toggle_selection + actions.move_selection_worse,
|
||||||
|
["<S-Tab>"] = actions.toggle_selection + actions.move_selection_better,
|
||||||
|
["<C-q>"] = actions.send_to_qflist + actions.open_qflist,
|
||||||
|
["<M-q>"] = actions.send_selected_to_qflist + actions.open_qflist,
|
||||||
|
["<C-l>"] = actions.complete_tag,
|
||||||
|
["<C-_>"] = actions.which_key,
|
||||||
|
},
|
||||||
|
n = {
|
||||||
|
["<Esc>"] = actions.close,
|
||||||
|
["<CR>"] = actions.select_default,
|
||||||
|
["<C-x>"] = actions.select_horizontal,
|
||||||
|
["<C-v>"] = actions.select_vertical,
|
||||||
|
["<C-t>"] = actions.select_tab,
|
||||||
|
["<Tab>"] = actions.toggle_selection + actions.move_selection_worse,
|
||||||
|
["<S-Tab>"] = actions.toggle_selection + actions.move_selection_better,
|
||||||
|
["<C-q>"] = actions.send_to_qflist + actions.open_qflist,
|
||||||
|
["<M-q>"] = actions.send_selected_to_qflist + actions.open_qflist,
|
||||||
|
["j"] = actions.move_selection_next,
|
||||||
|
["k"] = actions.move_selection_previous,
|
||||||
|
["H"] = actions.move_to_top,
|
||||||
|
["M"] = actions.move_to_middle,
|
||||||
|
["L"] = actions.move_to_bottom,
|
||||||
|
["<Down>"] = actions.move_selection_next,
|
||||||
|
["<Up>"] = actions.move_selection_previous,
|
||||||
|
["gg"] = actions.move_to_top,
|
||||||
|
["G"] = actions.move_to_bottom,
|
||||||
|
["<C-u>"] = actions.preview_scrolling_up,
|
||||||
|
["<C-d>"] = actions.preview_scrolling_down,
|
||||||
|
["<PageUp>"] = actions.results_scrolling_up,
|
||||||
|
["<PageDown>"] = actions.results_scrolling_down,
|
||||||
|
["?"] = actions.which_key,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
pickers = {},
|
||||||
|
extensions = {
|
||||||
|
fzf = {
|
||||||
|
fuzzy = true,
|
||||||
|
override_generic_sorter = true,
|
||||||
|
override_file_sorter = true,
|
||||||
|
case_mode = "ignore_case",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
27
lua/user/toggleterm.lua
Normal file
27
lua/user/toggleterm.lua
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
local status_ok, toggleterm = pcall(require, "toggleterm")
|
||||||
|
if not status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
toggleterm.setup({
|
||||||
|
size = 20,
|
||||||
|
open_mapping = [[<C-\>]],
|
||||||
|
hide_numbers = true,
|
||||||
|
shade_filetypes = {},
|
||||||
|
shade_terminals = true,
|
||||||
|
shading_factor = 2,
|
||||||
|
start_in_insert = true,
|
||||||
|
insert_mappings = true,
|
||||||
|
persist_size = true,
|
||||||
|
direction = "float",
|
||||||
|
close_on_exit = true,
|
||||||
|
shell = vim.o.shell,
|
||||||
|
float_opts = {
|
||||||
|
border = "curved",
|
||||||
|
winblend = 0,
|
||||||
|
highlights = {
|
||||||
|
border = "Normal",
|
||||||
|
background = "Normal",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
22
lua/user/treesitter.lua
Normal file
22
lua/user/treesitter.lua
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
local configs = require("nvim-treesitter.configs")
|
||||||
|
configs.setup({
|
||||||
|
ensure_installed = "all",
|
||||||
|
sync_install = false,
|
||||||
|
ignore_install = { "" },
|
||||||
|
highlight = {
|
||||||
|
enable = true,
|
||||||
|
disable = { "" },
|
||||||
|
additional_vim_regex_highlighting = true,
|
||||||
|
},
|
||||||
|
rainbow = {
|
||||||
|
enable = true,
|
||||||
|
},
|
||||||
|
autopairs = {
|
||||||
|
enable = true,
|
||||||
|
},
|
||||||
|
context_commentstring = {
|
||||||
|
enable = true,
|
||||||
|
enable_autocmd = false,
|
||||||
|
},
|
||||||
|
indent = { enable = true, disable = { "yaml" } },
|
||||||
|
})
|
6
lua/user/trouble.lua
Normal file
6
lua/user/trouble.lua
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
local status_ok, trouble = pcall(require, "trouble")
|
||||||
|
if not status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
trouble.setup({})
|
6
lua/user/whichkey.lua
Normal file
6
lua/user/whichkey.lua
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
local status_ok, which_key = pcall(require, "which-key")
|
||||||
|
if not status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
which_key.setup({})
|
15
lua/user/whitespace.lua
Normal file
15
lua/user/whitespace.lua
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
vim.g.better_whitespace_enabled = 1
|
||||||
|
vim.g.strip_whitespace_on_save = 1
|
||||||
|
vim.g.show_spaces_that_precede_tabs = 1
|
||||||
|
vim.g.strip_whitelines_at_eof = 1
|
||||||
|
vim.g.better_whitespace_filetypes_blacklist = {
|
||||||
|
"diff",
|
||||||
|
"git",
|
||||||
|
"gitcommit",
|
||||||
|
"unite",
|
||||||
|
"qf",
|
||||||
|
"help",
|
||||||
|
"markdown",
|
||||||
|
"fugitive",
|
||||||
|
"toggleterm",
|
||||||
|
}
|
64
lua/user/winbar.lua
Normal file
64
lua/user/winbar.lua
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
local navic = require("nvim-navic")
|
||||||
|
|
||||||
|
local function get_buf_option(opt)
|
||||||
|
local status_ok, buf_option = pcall(vim.api.nvim_buf_get_option, 0, opt)
|
||||||
|
if not status_ok then
|
||||||
|
return nil
|
||||||
|
else
|
||||||
|
return buf_option
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function is_empty(s)
|
||||||
|
return s == nil or s == ""
|
||||||
|
end
|
||||||
|
|
||||||
|
M.winbar_filetype_exclude = {
|
||||||
|
"help",
|
||||||
|
"startify",
|
||||||
|
"dashboard",
|
||||||
|
"packer",
|
||||||
|
"neogitstatus",
|
||||||
|
"NvimTree",
|
||||||
|
"Trouble",
|
||||||
|
"alpha",
|
||||||
|
"lir",
|
||||||
|
"Outline",
|
||||||
|
"spectre_panel",
|
||||||
|
"toggleterm",
|
||||||
|
}
|
||||||
|
|
||||||
|
local excludes = function()
|
||||||
|
if vim.tbl_contains(M.winbar_filetype_exclude, vim.bo.filetype) then
|
||||||
|
vim.opt_local.winbar = nil
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
local function get_filename()
|
||||||
|
return "%#WinBarFilename#" .. "%t" .. "%*"
|
||||||
|
end
|
||||||
|
|
||||||
|
local function get_location()
|
||||||
|
local location = navic.get_location()
|
||||||
|
if not is_empty(location) then
|
||||||
|
return "%#WinBarContext#" .. " " .. ">" .. " " .. location .. "%*"
|
||||||
|
end
|
||||||
|
return ""
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.get_winbar()
|
||||||
|
if excludes() then
|
||||||
|
return ""
|
||||||
|
end
|
||||||
|
if navic.is_available() then
|
||||||
|
return get_filename() .. get_location()
|
||||||
|
else
|
||||||
|
return get_filename()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
Reference in a new issue