Archived
0
0
Fork 0

rewrite config from scratch (#1)

Makes all the plugins lazyload, remove plugins with duplicate uses and just general nit picks and improvements

Reviewed-on: Relms/neovim-config#1
This commit is contained in:
Daryl Ronningen 2022-09-02 17:42:32 +00:00
parent 7005d5066c
commit 69181599a5
70 changed files with 558 additions and 1268 deletions

View file

@ -1,7 +1,4 @@
# 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
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.

View file

@ -1,31 +1,5 @@
require("user.disable")
require("user.impatient")
require("user.options")
require("user.keymaps")
require("user.plugins")
require("user.notify")
require("user.navic")
require("user.cmp")
require("user.lsp")
require("user.telescope")
require("user.autopairs")
require("user.comment")
require("user.gitsigns")
require("user.bufferline")
require("user.whitespace")
require("user.lualine")
require("user.toggleterm")
require("user.indentline")
require("user.legendary")
require("user.whichkey")
require("user.trouble")
require("user.colorizer")
require("user.discord")
require("user.spectre")
require("user.dap")
require("user.treesitter")
require("user.dressing")
require("user.cybu")
require("user.autocommands")
require("user.gps")
require("user.ufo")
require("plugins.configs.impatient")
require("core.disable")
require("core.options")
require("core.keymaps")
require("plugins.packer")

View file

@ -1,5 +1,4 @@
-- Disable some builtin vim plugins
local disabled_built_ins = {
local default_plugins = {
"2html_plugin",
"getscript",
"getscriptPlugin",
@ -10,16 +9,24 @@ local disabled_built_ins = {
"netrwSettings",
"netrwFileHandlers",
"matchit",
"matchparen",
"tar",
"tarPlugin",
"rrhelper",
"spellfile_plugin",
"vimball",
"vimballPlugin",
"zip",
"zipPlugin",
"tutor",
"rplugin",
"syntax",
"synmenu",
"optwin",
"compiler",
"bugreport",
"ftplugin",
}
for _, plugin in pairs(disabled_built_ins) do
for _, plugin in pairs(default_plugins) do
vim.g["loaded_" .. plugin] = 1
end

View file

@ -43,8 +43,8 @@ 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)
-- Neotree
keymap("n", "<leader>e", ":Neotree toggle<CR>", opts)
-- Trouble
keymap("n", "<leader>xx", ":Trouble<CR>", opts)

View file

@ -4,6 +4,7 @@ vim.opt.cmdheight = 2
vim.opt.completeopt = { "menu", "menuone", "noselect" }
vim.opt.conceallevel = 0
vim.opt.fileencoding = "utf-8"
vim.o.background = "dark"
vim.opt.hlsearch = true
vim.opt.ignorecase = true
vim.opt.mouse = "a"
@ -36,16 +37,16 @@ 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.opt.foldcolumn = "2"
vim.opt.foldlevel = 99
vim.opt.foldlevelstart = -1
vim.opt.foldenable = true
vim.opt.fillchars = [[eob: ,fold: ,foldopen:,foldsep: ,foldclose:]]
vim.cmd("set whichwrap+=<,>,[,],h,l")
vim.cmd([[set iskeyword+=-]])
vim.cmd([[set formatoptions-=cro]])
vim.cmd("set iskeyword+=-")
vim.cmd("set formatoptions-=cro")
vim.cmd("set foldmethod=expr")
vim.cmd("set foldexpr=nvim_treesitter#foldexpr()")
vim.cmd(
"let g:clipboard = { 'copy': { '+': 'xsel', '*': 'xsel' }, 'paste': { '+': 'xsel', '*': 'xsel' }, 'cache_enabled': 0 }"

View file

@ -1,8 +1,4 @@
local status_ok, alpha = pcall(require, "alpha")
if not status_ok then
return
end
local alpha = require("alpha")
local dashboard = require("alpha.themes.dashboard")
dashboard.section.header.val = {
" ▟▙",

View file

@ -0,0 +1,10 @@
local autopairs = require("nvim-autopairs")
autopairs.setup({
check_ts = true,
disable_filetype = { "TelescopePrompt" },
})
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
local cmp = require("cmp")
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done({}))

View file

@ -0,0 +1,55 @@
local cmp = require("cmp")
local lspkind = require("lspkind")
cmp.setup({
snippet = {
expand = function(args)
vim.fn["vsnip#anonymous"](args.body)
end,
},
completion = { completeopt = "menu,menuone,noinsert", keyword_length = 1 },
sources = {
{ name = "nvim_lsp" },
{ name = "nvim_lua" },
{ name = "vsnip" },
{ name = "buffer" },
{ name = "path" },
},
confirm_opts = {
behavior = cmp.ConfirmBehavior.Replace,
select = false,
},
window = {
documentation = {
border = { "", "", "", "", "", "", "", "" },
},
},
experimental = {
ghost_text = true,
native_menu = false,
},
formatting = {
fields = { "abbr", "kind", "menu" },
format = lspkind.cmp_format({
mode = "symbol_text",
maxwidth = 50,
before = function(entry, vim_item)
vim_item.menu = ({
nvim_lsp = "[LSP]",
nvim_lua = "[NVIM_LUA]",
vsnip = "[SNIPPET]",
buffer = "[BUFFER]",
path = "[PATH]",
})[entry.source.name]
return vim_item
end,
}),
},
mapping = cmp.mapping.preset.insert({
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.abort(),
["<CR>"] = cmp.mapping.confirm({ select = true }),
}),
})

View file

@ -0,0 +1,5 @@
local present, impatient = pcall(require, "impatient")
if not present then
return
end

View file

@ -43,18 +43,12 @@ end
local function attach_navic(client, bufnr)
vim.g.navic_silence = false
local status_ok, navic = pcall(require, "nvim-navic")
if not status_ok then
return
end
local navic = require("nvim-navic")
navic.attach(client, bufnr)
end
local function lsp_highlight_document(client)
local status_ok, illuminate = pcall(require, "illuminate")
if not status_ok then
return
end
local illuminate = require("illuminate")
illuminate.on_attach(client)
end
@ -84,17 +78,9 @@ end
-- Define Capabilities
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true
capabilities.textDocument.foldingRange = {
dynamicRegistration = false,
lineFoldingOnly = true,
}
local status_ok, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp")
local cmp_lsp = require("cmp_nvim_lsp")
if not status_ok then
return
end
M.capabilities = cmp_nvim_lsp.update_capabilities(capabilities)
M.capabilities = cmp_lsp.update_capabilities(capabilities)
return M

View file

@ -0,0 +1,7 @@
require("plugins.configs.lsp.handlers").setup()
require("plugins.configs.lsp.nlspsettings")
require("plugins.configs.lsp.nullls")
require("plugins.configs.lsp.mason")
require("plugins.configs.lsp.lspsaga")
require("plugins.configs.lsp.signature")
require("plugins.configs.lsp.lsplines")

View file

@ -0,0 +1,7 @@
local lines = require("lsp_lines")
lines.setup()
vim.diagnostic.config({
virtual_text = false,
})

View file

@ -0,0 +1,3 @@
local lspsaga = require("lspsaga")
lspsaga.init_lsp_saga({})

View file

@ -0,0 +1,29 @@
local mason = require("mason")
local lspconfig = require("lspconfig")
local mason_lspconfig = require("mason-lspconfig")
mason.setup()
mason_lspconfig.setup()
lspconfig.util.default_config = vim.tbl_extend("force", lspconfig.util.default_config, {
on_attach = require("plugins.configs.lsp.handlers").on_attach,
capabilities = require("plugins.configs.lsp.handlers").capabilities,
})
mason_lspconfig.setup_handlers({
function(server_name)
lspconfig[server_name].setup({})
end,
["jsonls"] = function()
local schemastore = require("schemastore")
lspconfig.jsonls.setup({
settings = {
json = {
schemas = schemastore.json.schemas(),
validate = { enable = true },
},
},
})
end,
})

View file

@ -1,7 +1,7 @@
local nlspsettings = require("nlspsettings")
nlspsettings.setup({
config_home = vim.fn.stdpath("config") .. "/lua/user/lsp/settings/json",
config_home = vim.fn.stdpath("config") .. "/lua/plugins/configs/lsp/settings",
local_settings_dir = ".nlsp-settings",
local_settings_root_markers = { ".git" },
append_default_schemas = true,

View file

@ -1,7 +1,4 @@
local null_ls_status_ok, null_ls = pcall(require, "null-ls")
if not null_ls_status_ok then
return
end
local null_ls = require("null-ls")
local formatting = null_ls.builtins.formatting
local code_actions = null_ls.builtins.code_actions
@ -11,13 +8,9 @@ null_ls.setup({
debug = false,
sources = {
formatting.stylua,
code_actions.eslint_d,
diagnostics.eslint_d,
formatting.eslint_d,
diagnostics.markdownlint,
formatting.markdownlint,
diagnostics.yamllint,
formatting.rustfmt,
diagnostics.actionlint,
},
})

View file

@ -0,0 +1,3 @@
{
"eslint.codeActionsOnSave.enable": true
}

View file

@ -0,0 +1,5 @@
{
"Lua.diagnostics.globals": [
"vim"
]
}

View file

@ -0,0 +1,8 @@
local signature = require("lsp_signature")
local cfg = {
floating_window = false,
}
signature.setup(cfg)
signature.on_attach(cfg)

View file

@ -0,0 +1,55 @@
local lualine = require("lualine")
local winbar = require("plugins.configs.winbar")
lualine.setup({
options = {
icons_enabled = true,
component_separators = { left = "", right = "" },
section_separators = { left = "", right = "" },
disabled_filetypes = { "alpha", "neo-tree" },
always_divide_middle = true,
refresh = {
winbar = 50,
},
},
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 = { "filename" },
lualine_b = {},
lualine_c = {},
lualine_x = {},
lualine_y = {},
lualine_z = { "location" },
},
tabline = {
lualine_a = { "buffers" },
lualine_b = {},
lualine_c = {},
lualine_x = {},
lualine_y = {},
lualine_z = { "tabs" },
},
winbar = {
lualine_a = {},
lualine_b = { winbar.get_fileicon() .. winbar.get_filename() },
lualine_c = { winbar.get_location },
lualine_x = {},
lualine_y = {},
lualine_z = {},
},
inactive_winbar = {
lualine_a = {},
lualine_b = {},
lualine_c = {},
lualine_x = {},
lualine_y = {},
lualine_z = {},
},
})

View file

@ -0,0 +1,18 @@
local neotree = require("neo-tree")
neotree.setup({
popup_border_style = "rounded",
filesystem = {
filtered_items = {
visible = true,
force_visible_in_empty_folder = false,
show_hidden_count = true,
hide_dotfiles = false,
hide_gitignored = false,
},
},
source_selector = {
winbar = true,
statusline = true,
},
})

View file

@ -0,0 +1,5 @@
local present, nightfox = pcall(require, "nightfox")
if present then
vim.cmd("colorscheme nordfox")
end

View file

@ -0,0 +1,46 @@
local telescope = require("telescope")
local actions = require("telescope.actions")
telescope.setup({
defaults = {
prompt_prefix = "",
selection_caret = " ",
entry_prefix = " ",
initial_mode = "insert",
selection_strategy = "reset",
sorting_strategy = "ascending",
layout_strategy = "horizontal",
layout_config = {
horizontal = {
prompt_position = "bottom",
preview_width = 0.55,
results_width = 0.8,
},
vertical = {
mirror = false,
},
width = 0.87,
height = 0.80,
preview_cutoff = 120,
},
path_display = { "truncate" },
winblend = 0,
border = {},
borderchars = { "", "", "", "", "", "", "", "" },
color_devicons = true,
mappings = {
n = { ["q"] = require("telescope.actions").close },
},
},
extensions = {
fzf = {
fuzzy = true,
override_generic_sorter = true,
override_file_sorter = true,
case_mode = "ignore_case",
},
},
})
telescope.load_extension("fzf")

View file

@ -1,7 +1,4 @@
local status_ok, toggleterm = pcall(require, "toggleterm")
if not status_ok then
return
end
local toggleterm = require("toggleterm")
toggleterm.setup({
size = 20,

View file

@ -1,18 +1,17 @@
local configs = require("nvim-treesitter.configs")
configs.setup({
ensure_installed = "all",
local treesitter = require("nvim-treesitter.configs")
treesitter.setup({
sync_install = false,
ignore_install = { "" },
auto_install = true,
highlight = {
enable = true,
disable = { "" },
additional_vim_regex_highlighting = true,
},
rainbow = {
enable = true,
},
autopairs = {
enable = true,
extended_mode = true,
},
context_commentstring = {
enable = true,

View file

@ -7,34 +7,11 @@ 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()
function M.get_filename()
return "%#WinBarFilename#" .. "%t" .. "%*"
end
local function get_location()
function M.get_location()
local location = navic.get_location()
local gps_location = gps.get_location()
@ -47,7 +24,7 @@ local function get_location()
end
end
local function get_fileicon()
function M.get_fileicon()
local hl_winbar_file_icon = "WinBarFileIcon"
local file_path = vim.fn.expand("%:~:.:h")
local filename = vim.fn.expand("%:t")
@ -67,15 +44,4 @@ local function get_fileicon()
return "%#WinBarContext#" .. "%#" .. hl_winbar_file_icon .. "#" .. file_icon .. " " .. "%*"
end
function M.get_winbar()
if excludes() then
return ""
end
if navic.is_available() then
return get_fileicon() .. get_filename() .. get_location()
else
return get_fileicon() .. get_filename()
end
end
return M

251
lua/plugins/packer.lua Normal file
View file

@ -0,0 +1,251 @@
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,
})
vim.cmd("packadd packer.nvim")
end
vim.cmd([[
augroup packer_user_config
autocmd!
autocmd BufWritePost packer.lua source <afile> | PackerSync
augroup end
]])
local packer = require("packer")
packer.init({
display = {
open_fn = function()
return require("packer.util").float({ border = "rounded" })
end,
},
profile = {
enable = true,
threshold = 0,
},
})
return packer.startup(function(use)
use("wbthomason/packer.nvim")
-- Dependencies
use({
"MunifTanjim/nui.nvim",
module = "nui",
})
use({
"nvim-lua/plenary.nvim",
module = "plenary",
})
use({
"kyazdani42/nvim-web-devicons",
module = "nvim-web-devicons",
})
-- Benchmark Startup
use({
"dstein64/vim-startuptime",
cmd = "StartupTime",
})
-- Plugin Module Caching
use("lewis6991/impatient.nvim")
-- Alpha Dashboard
use({
"goolord/alpha-nvim",
config = function()
require("plugins.configs.alpha")
end,
})
-- Colorscheme
use({
"EdenEast/nightfox.nvim",
run = ":NightfoxCompile",
config = function()
require("plugins.configs.nightfox")
end,
})
-- File Tree
use({
"nvim-neo-tree/neo-tree.nvim",
ft = "alpha",
cmd = { "Neotree" },
config = function()
require("plugins.configs.neotree")
end,
})
-- Treesitter
use({
"nvim-treesitter/nvim-treesitter",
run = ":TSUpdate",
event = "BufReadPre",
config = function()
require("plugins.configs.treesitter")
end,
})
use({
"p00f/nvim-ts-rainbow",
after = "nvim-treesitter",
})
use({
"JoosepAlviste/nvim-ts-context-commentstring",
after = "nvim-treesitter",
})
use({
"SmiteshP/nvim-gps",
after = "nvim-treesitter",
})
-- Telescope
use({
"nvim-telescope/telescope.nvim",
cmd = "Telescope",
config = function()
require("plugins.configs.telescope")
end,
})
use({
"nvim-telescope/telescope-fzf-native.nvim",
run = "make",
module = "telescope._extensions.fzf",
})
use({
"nvim-telescope/telescope-dap.nvim",
module = "telescope._extensions.dap",
})
-- CMP
use({
"hrsh7th/nvim-cmp",
event = "InsertEnter",
config = function()
require("plugins.configs.cmp")
end,
})
use({
"hrsh7th/cmp-nvim-lsp",
after = "nvim-cmp",
})
use({
"hrsh7th/cmp-path",
after = "nvim-cmp",
})
use({
"hrsh7th/cmp-nvim-lua",
after = "nvim-cmp",
})
use({
"hrsh7th/vim-vsnip",
after = "nvim-cmp",
})
use({
"hrsh7th/cmp-vsnip",
after = "nvim-cmp",
})
use({
"rafamadriz/friendly-snippets",
after = "nvim-cmp",
})
use({
"hrsh7th/cmp-buffer",
after = "nvim-cmp",
})
-- Terminal
use({
"akinsho/toggleterm.nvim",
keys = [[<C-\>]],
config = function()
require("plugins.configs.toggleterm")
end,
})
-- LSP
use({
"neovim/nvim-lspconfig",
event = "BufReadPre",
config = function()
require("plugins.configs.lsp")
end,
})
use({
"onsails/lspkind.nvim",
module = "lspkind",
})
use({
"williamboman/mason.nvim",
module = "mason",
})
use({
"williamboman/mason-lspconfig.nvim",
module = "mason-lspconfig",
})
use({
"glepnir/lspsaga.nvim",
module = "lspsaga",
})
use({
"RRethy/vim-illuminate",
module = "illuminate",
})
use({
"SmiteshP/nvim-navic",
module = "nvim-navic",
})
use({
"tamago324/nlsp-settings.nvim",
module = "nlspsettings",
})
use({
"b0o/SchemaStore.nvim",
module = "schemastore",
})
use({
"jose-elias-alvarez/null-ls.nvim",
module = "null-ls",
})
use({
"ray-x/lsp_signature.nvim",
module = "lsp_signature",
})
use({
"Maan2003/lsp_lines.nvim",
module = "lsp_lines",
})
-- Statusline
use({
"nvim-lualine/lualine.nvim",
event = "BufReadPre",
config = function()
require("plugins.configs.lualine")
end,
})
-- Autopairs
use({
"windwp/nvim-autopairs",
event = "InsertEnter",
config = function()
require("plugins.configs.autopairs")
end,
})
if PACKER_BOOTSTRAP then
require("packer").sync()
end
end)

View file

@ -1,47 +0,0 @@
-- 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
:DisableWhitespace
]])
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,
})

View file

@ -1,17 +0,0 @@
-- 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({}))

View file

@ -1,34 +0,0 @@
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,
},
})

View file

@ -1,133 +0,0 @@
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
local lspkind_status_ok, lspkind = pcall(require, "lspkind")
if not lspkind_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({})
cmp.setup({
completion = { completeopt = "menu,menuone,noinsert", keyword_length = 1 },
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 = lspkind.cmp_format({
mode = "symbol_text",
maxwidth = 50,
before = function(entry, vim_item)
vim_item.menu = ({
nvim_lsp = "[LSP]",
npm = "[NPM]",
crates = "[CRATES]",
nvim_lua = "[NVIM_LUA]",
luasnip = "[SNIPPET]",
buffer = "[BUFFER]",
path = "[PATH]",
})[entry.source.name]
return vim_item
end,
}),
},
sources = {
{ name = "nvim_lsp" },
{ name = "npm" },
{ name = "crates" },
{ 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" },
}),
})

View file

@ -1,16 +0,0 @@
local status_ok, colorizer = pcall(require, "colorizer")
if not status_ok then
return
end
colorizer.setup({ "*" }, {
RGB = true,
RRGGBB = true,
names = false,
RRGGBBAA = true,
rgb_fn = true,
hsl_fn = true,
css = false,
css_fn = false,
mode = "background",
})

View file

@ -1,22 +0,0 @@
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,
})

View file

@ -1,24 +0,0 @@
local ok, cybu = pcall(require, "cybu")
if not ok then
return
end
cybu.setup({
display_time = 1750, -- time the cybu window is displayed
style = {
path = "relative", -- absolute, relative, tail (filename only)
border = "rounded", -- single, double, rounded, none
separator = " ", -- string used as separator
prefix = "", -- string used as prefix for truncated paths
padding = 1, -- left & right padding in number of spaces
hide_buffer_id = true,
devicons = {
enabled = true, -- enable or disable web dev icons
colored = true, -- enable color for web dev icons
},
},
})
vim.keymap.set("n", "<s-tab>", "<Plug>(CybuPrev)")
vim.keymap.set("n", "<tab>", "<Plug>(CybuNext)")
vim.keymap.set("n", "<c-i>", "<c-i>")

View file

@ -1,12 +0,0 @@
local dapui_status_ok, dapui = pcall(require, "dapui")
if not dapui_status_ok then
return
end
local vtext_status_ok, vtext = pcall(require, "nvim-dap-virtual-text")
if not vtext_status_ok then
return
end
dapui.setup()
vtext.setup()

View file

@ -1,6 +0,0 @@
local status_ok, discord = pcall(require, "presence")
if not status_ok then
return
end
discord:setup({})

View file

@ -1,6 +0,0 @@
local status_ok, dressing = pcall(require, "dressing")
if not status_ok then
return
end
dressing.setup({})

View file

@ -1,52 +0,0 @@
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,
},
})

View file

@ -1,33 +0,0 @@
local status_ok, gps = pcall(require, "nvim-gps")
if not status_ok then
return
end
gps.setup({
icons = {
["class-name"] = "",
["function-name"] = "",
["method-name"] = "",
["container-name"] = "",
["tag-name"] = "",
["mapping-name"] = "",
["sequence-name"] = "",
["null-name"] = "[] ",
["boolean-name"] = "ﰰﰴ ",
["integer-name"] = "# ",
["float-name"] = "",
["string-name"] = "",
["array-name"] = "",
["object-name"] = "",
["number-name"] = "# ",
["table-name"] = "",
["date-name"] = "",
["date-time-name"] = "",
["inline-table-name"] = "",
["time-name"] = "",
["module-name"] = "",
},
separator = " > ",
depth = 0,
depth_limit_indicator = "..",
})

View file

@ -1,3 +0,0 @@
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})

View file

@ -1,6 +0,0 @@
local status_ok, impatient = pcall(require, "impatient")
if not status_ok then
return
end
impatient.enable_profile()

View file

@ -1,16 +0,0 @@
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,
})

View file

@ -1,6 +0,0 @@
local ok, legendary = pcall(require, "legendary")
if not ok then
return
end
legendary.setup()

View file

@ -1,7 +0,0 @@
require("user.lsp.handlers").setup()
require("user.lsp.nlspsettings")
require("user.lsp.mason")
require("user.lsp.nullls")
require("user.lsp.signature")
require("user.lsp.lspsaga")
require("user.lsp.virtuallines")

View file

@ -1,6 +0,0 @@
local status_ok, lspsaga = pcall(require, "lspsaga")
if not status_ok then
return
end
lspsaga.init_lsp_saga({})

View file

@ -1,32 +0,0 @@
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,
})
require("mason-tool-installer").setup({
auto_update = false,
run_on_start = 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.lua.sumneko_lua")
require("user.lsp.settings.lua.jsonls")
require("user.lsp.settings.lua.tsserver")
require("user.lsp.settings.lua.yamlls")
require("user.lsp.settings.lua.volar")
require("user.lsp.settings.lua.dockerls")
require("user.lsp.settings.lua.rnix")
require("user.lsp.settings.lua.taplo")
require("user.lsp.settings.lua.omnisharp")
require("user.lsp.settings.lua.lemminx")

View file

@ -1,3 +0,0 @@
{
"Lua.diagnostics.globals": ["vim"]
}

View file

@ -1,6 +0,0 @@
local status_ok, lspconfig = pcall(require, "lspconfig")
if not status_ok then
return
end
lspconfig.dockerls.setup({})

View file

@ -1,18 +0,0 @@
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 },
},
},
})

View file

@ -1,6 +0,0 @@
local status_ok, lspconfig = pcall(require, "lspconfig")
if not status_ok then
return
end
lspconfig.lemminx.setup({})

View file

@ -1,9 +0,0 @@
local status_ok, lspconfig = pcall(require, "lspconfig")
if not status_ok then
return
end
lspconfig.omnisharp.setup({
organize_imports_on_format = true,
enable_import_completion = true,
})

View file

@ -1,6 +0,0 @@
local status_ok, lspconfig = pcall(require, "lspconfig")
if not status_ok then
return
end
lspconfig.rnix.setup({})

View file

@ -1,3 +0,0 @@
local lspconfig = require("lspconfig")
lspconfig.sumneko_lua.setup({})

View file

@ -1,6 +0,0 @@
local status_ok, lspconfig = pcall(require, "lspconfig")
if not status_ok then
return
end
lspconfig.taplo.setup({})

View file

@ -1,6 +0,0 @@
local status_ok, lspconfig = pcall(require, "lspconfig")
if not status_ok then
return
end
lspconfig.tsserver.setup({})

View file

@ -1,6 +0,0 @@
local status_ok, lspconfig = pcall(require, "lspconfig")
if not status_ok then
return
end
lspconfig.volar.setup({})

View file

@ -1,6 +0,0 @@
local status_ok, lspconfig = pcall(require, "lspconfig")
if not status_ok then
return
end
lspconfig.yamlls.setup({})

View file

@ -1,11 +0,0 @@
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

View file

@ -1,10 +0,0 @@
local status_ok, lines = pcall(require, "lsp_lines")
if not status_ok then
return
end
lines.setup()
vim.diagnostic.config({
virtual_text = false,
})

View file

@ -1,38 +0,0 @@
local status_ok, lualine = pcall(require, "lualine")
if not status_ok then
return
end
lualine.setup({
options = {
icons_enabled = true,
theme = "onenord",
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 = {},
},
extensions = {
"nvim-tree",
"toggleterm",
"fzf",
"quickfix",
"nvim-dap-ui",
},
})

View file

@ -1,34 +0,0 @@
local status_ok, navic = pcall(require, "nvim-navic")
if not status_ok then
return
end
navic.setup({
icons = {
["class-name"] = "",
["function-name"] = "",
["method-name"] = "",
["container-name"] = "",
["tag-name"] = "",
["mapping-name"] = "",
["sequence-name"] = "",
["null-name"] = "[] ",
["boolean-name"] = "ﰰﰴ ",
["integer-name"] = "# ",
["float-name"] = "",
["string-name"] = "",
["array-name"] = "",
["object-name"] = "",
["number-name"] = "# ",
["table-name"] = "",
["date-name"] = "",
["date-time-name"] = "",
["inline-table-name"] = "",
["time-name"] = "",
["module-name"] = "",
},
highlight = true,
separator = " > ",
depth_limit = 0,
depth_limit_indicator = "..",
})

View file

@ -1,16 +0,0 @@
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

View file

@ -1,101 +0,0 @@
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 = false,
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,
},
})

View file

@ -1,219 +0,0 @@
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,
},
profile = {
enable = true,
threshold = 0,
},
})
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")
use("antoinemadec/FixCursorHold.nvim")
use("kevinhwang91/promise-async")
-- Themes
-- Theme
use({
"rmehri01/onenord.nvim",
config = function()
require("onenord").setup()
end,
})
use({
"folke/lsp-colors.nvim",
config = function()
require("lsp-colors").setup()
end,
})
-- 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")
-- Snippets
use("L3MON4D3/LuaSnip")
use("rafamadriz/friendly-snippets")
-- LSP
use("neovim/nvim-lspconfig")
use("williamboman/mason.nvim")
use("williamboman/mason-lspconfig.nvim")
use("WhoIsSethDaniel/mason-tool-installer.nvim")
use("jose-elias-alvarez/null-ls.nvim")
use("b0o/SchemaStore.nvim")
use("ray-x/lsp_signature.nvim")
use("folke/trouble.nvim")
use("onsails/lspkind.nvim")
use("glepnir/lspsaga.nvim")
use("https://git.sr.ht/~whynothugo/lsp_lines.nvim")
use("SmiteshP/nvim-navic")
use("kevinhwang91/nvim-ufo")
use("tamago324/nlsp-settings.nvim")
use("gpanders/editorconfig.nvim")
-- Rust Dev
use({
"simrat39/rust-tools.nvim",
config = function()
require("rust-tools").setup({})
end,
})
use({
"saecki/crates.nvim",
config = function()
require("crates").setup({
null_ls = {
enabled = true,
},
})
end,
})
-- 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")
use("SmiteshP/nvim-gps")
-- Autopairs
use("windwp/nvim-autopairs")
-- Comments
use("numToStr/Comment.nvim")
-- Git
use("lewis6991/gitsigns.nvim")
-- Nvim-Tree
use({
"kyazdani42/nvim-tree.lua",
opt = true,
cmd = { "NvimTreeToggle", "NvimTreeClose" },
config = function()
require("user.nvimtree")
end,
})
-- 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")
-- Speed
use("lewis6991/impatient.nvim")
use("nathom/filetype.nvim")
use("dstein64/vim-startuptime")
-- Indent Line
use("lukas-reineke/indent-blankline.nvim")
-- Alpha
use({
"goolord/alpha-nvim",
config = function()
require("user.alpha")
end,
})
-- Keymaps
use("folke/which-key.nvim")
use("mrjones2014/legendary.nvim")
-- Illuminate
use("RRethy/vim-illuminate")
-- Colorizer
use("norcalli/nvim-colorizer.lua")
-- 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,
})
-- UI
use("stevearc/dressing.nvim")
use("ghillb/cybu.nvim")
-- Undo Tree
use("mbbill/undotree")
if PACKER_BOOTSTRAP then
require("packer").sync()
end
end)

View file

@ -1,9 +0,0 @@
local status_ok, spectre = pcall(require, "spectre")
if not status_ok then
return
end
spectre.setup({
live_update = true,
is_insert_mode = true,
})

View file

@ -1,76 +0,0 @@
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",
},
},
})

View file

@ -1,6 +0,0 @@
local status_ok, trouble = pcall(require, "trouble")
if not status_ok then
return
end
trouble.setup({})

View file

@ -1,39 +0,0 @@
local status_ok, ufo = pcall(require, "ufo")
if not status_ok then
return
end
local handler = function(virtText, lnum, endLnum, width, truncate)
local newVirtText = {}
local suffix = ("  %d "):format(endLnum - lnum)
local sufWidth = vim.fn.strdisplaywidth(suffix)
local targetWidth = width - sufWidth
local curWidth = 0
for _, chunk in ipairs(virtText) do
local chunkText = chunk[1]
local chunkWidth = vim.fn.strdisplaywidth(chunkText)
if targetWidth > curWidth + chunkWidth then
table.insert(newVirtText, chunk)
else
chunkText = truncate(chunkText, targetWidth - curWidth)
local hlGroup = chunk[2]
table.insert(newVirtText, { chunkText, hlGroup })
chunkWidth = vim.fn.strdisplaywidth(chunkText)
-- str width returned from truncate() may less than 2nd argument, need padding
if curWidth + chunkWidth < targetWidth then
suffix = suffix .. (" "):rep(targetWidth - curWidth - chunkWidth)
end
break
end
curWidth = curWidth + chunkWidth
end
table.insert(newVirtText, { suffix, "MoreMsg" })
return newVirtText
end
ufo.setup({
provider_selector = function()
return { "lsp", "indent" }
end,
fold_virt_text_handler = handler,
})

View file

@ -1,6 +0,0 @@
local status_ok, which_key = pcall(require, "which-key")
if not status_ok then
return
end
which_key.setup({})

View file

@ -1,15 +0,0 @@
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",
}