Compare commits
11 Commits
1edafd6d41
...
8dacb00b4d
Author | SHA1 | Date | |
---|---|---|---|
doryan | 8dacb00b4d | ||
doryan | 6be1e7e268 | ||
doryan | d8daf61525 | ||
doryan | 7019e4e902 | ||
doryan | 9aee982481 | ||
doryan | 9fb66c5fd8 | ||
doryan | ce5ddb9b89 | ||
doryan | 3b1a2e37ca | ||
doryan | 04fba535ff | ||
doryan | 046942c93f | ||
doryan | 9830c20eb6 |
31
init.lua
31
init.lua
|
@ -1,17 +1,21 @@
|
||||||
local vanila_vim_autostart_commands = {
|
local vanila_vim_autostart_commands = {
|
||||||
"set number",
|
"set number",
|
||||||
"set clipboard=unnamedplus",
|
"set clipboard=unnamedplus",
|
||||||
"set nowrap"
|
"set nowrap",
|
||||||
|
"set shiftwidth=4",
|
||||||
|
"set tabstop=4",
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, cmd in pairs(vanila_vim_autostart_commands) do
|
for _, cmd in pairs(vanila_vim_autostart_commands) do
|
||||||
vim.cmd(cmd)
|
vim.cmd(cmd)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if vim.lsp.inlay_hint then
|
||||||
|
vim.lsp.inlay_hint.enable(true, { 0 })
|
||||||
|
end
|
||||||
|
|
||||||
require("config.lazy")
|
require("config.lazy")
|
||||||
|
require("config.plugins.nvimufo")
|
||||||
require("mappings")
|
|
||||||
|
|
||||||
require("config.plugins.acmp")
|
require("config.plugins.acmp")
|
||||||
require("config.plugins.autotag")
|
require("config.plugins.autotag")
|
||||||
require("config.plugins.autocomplete")
|
require("config.plugins.autocomplete")
|
||||||
|
@ -20,7 +24,13 @@ require("config.plugins.colorizer")
|
||||||
require("config.plugins.comment")
|
require("config.plugins.comment")
|
||||||
require("config.plugins.dap")
|
require("config.plugins.dap")
|
||||||
require("config.plugins.gitsigns")
|
require("config.plugins.gitsigns")
|
||||||
require("ibl").setup()
|
require("ibl").setup({
|
||||||
|
exclude = {
|
||||||
|
filetypes = { "dashboard" },
|
||||||
|
}
|
||||||
|
})
|
||||||
|
require("config.plugins.hover_actions")
|
||||||
|
require("config.plugins.lsp_config")
|
||||||
require("config.plugins.lsp_diagnostic")
|
require("config.plugins.lsp_diagnostic")
|
||||||
require("config.plugins.lualine")
|
require("config.plugins.lualine")
|
||||||
require("config.plugins.navic")
|
require("config.plugins.navic")
|
||||||
|
@ -28,8 +38,17 @@ require("config.plugins.noice")
|
||||||
require("toggleterm").setup()
|
require("toggleterm").setup()
|
||||||
require("config.plugins.treesitter")
|
require("config.plugins.treesitter")
|
||||||
require("config.plugins.neotree")
|
require("config.plugins.neotree")
|
||||||
require("config.plugins.nvimufo")
|
|
||||||
require("config.plugins.prettier")
|
require("config.plugins.prettier")
|
||||||
require("config.plugins.rustaceanvim")
|
require("config.plugins.rustaceanvim")
|
||||||
require("huez").setup({})
|
require("huez").setup({})
|
||||||
require("config.plugins.dropbar")
|
require("config.plugins.dropbar")
|
||||||
|
require("config.plugins.dashboard")
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||||
|
buffer = buffer,
|
||||||
|
callback = function()
|
||||||
|
vim.lsp.buf.format { async = false }
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
require("mappings")
|
||||||
|
|
|
@ -1,43 +1,10 @@
|
||||||
require("Comment").setup({
|
require('Comment').setup({
|
||||||
---Add a space b/w comment and the line
|
|
||||||
padding = true,
|
padding = true,
|
||||||
---Whether the cursor should stay at its position
|
|
||||||
sticky = true,
|
sticky = true,
|
||||||
---Lines to be ignored while (un)comment
|
|
||||||
ignore = nil,
|
|
||||||
---LHS of toggle mappings in NORMAL mode
|
|
||||||
toggler = {
|
toggler = {
|
||||||
---Line-comment toggle keymap
|
|
||||||
line = '<leader>/',
|
line = '<leader>/',
|
||||||
---Block-comment toggle keymap
|
|
||||||
block = '<leader>/',
|
|
||||||
},
|
},
|
||||||
---LHS of operator-pending mappings in NORMAL and VISUAL mode
|
|
||||||
opleader = {
|
opleader = {
|
||||||
---Line-comment keymap
|
|
||||||
line = '<leader>/',
|
line = '<leader>/',
|
||||||
---Block-comment keymap
|
|
||||||
block = '<leader>/',
|
|
||||||
},
|
},
|
||||||
---LHS of extra mappings
|
|
||||||
extra = {
|
|
||||||
---Add comment on the line above
|
|
||||||
above = 'gcO',
|
|
||||||
---Add comment on the line below
|
|
||||||
below = 'gco',
|
|
||||||
---Add comment at the end of line
|
|
||||||
eol = 'gcA',
|
|
||||||
},
|
|
||||||
---Enable keybindings
|
|
||||||
---NOTE: If given `false` then the plugin won't create any mappings
|
|
||||||
mappings = {
|
|
||||||
---Operator-pending mapping; `gcc` `gbc` `gc[count]{motion}` `gb[count]{motion}`
|
|
||||||
basic = true,
|
|
||||||
---Extra mapping; `gco`, `gcO`, `gcA`
|
|
||||||
extra = true,
|
|
||||||
},
|
|
||||||
---Function to call before (un)comment
|
|
||||||
pre_hook = nil,
|
|
||||||
---Function to call after (un)comment
|
|
||||||
post_hook = nil,
|
|
||||||
})
|
})
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
require('dashboard').setup {
|
||||||
|
theme = 'hyper',
|
||||||
|
config = {
|
||||||
|
week_header = {
|
||||||
|
enable = true,
|
||||||
|
},
|
||||||
|
shortcut = {
|
||||||
|
{ desc = ' Update', group = '@property', action = 'Lazy update', key = 'u' },
|
||||||
|
{
|
||||||
|
icon = ' ',
|
||||||
|
icon_hl = '@variable',
|
||||||
|
desc = 'Files',
|
||||||
|
group = 'Label',
|
||||||
|
action = 'Telescope find_files',
|
||||||
|
key = 'f',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
desc = ' Apps',
|
||||||
|
group = 'DiagnosticHint',
|
||||||
|
action = 'Telescope app',
|
||||||
|
key = 'a',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
desc = ' dotfiles',
|
||||||
|
group = 'Number',
|
||||||
|
action = 'Telescope dotfiles',
|
||||||
|
key = 'd',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
require("hover").setup {
|
||||||
|
init = function()
|
||||||
|
-- Require providers
|
||||||
|
require("hover.providers.lsp")
|
||||||
|
-- require('hover.providers.gh')
|
||||||
|
-- require('hover.providers.gh_user')
|
||||||
|
-- require('hover.providers.jira')
|
||||||
|
-- require('hover.providers.dap')
|
||||||
|
-- require('hover.providers.fold_preview')
|
||||||
|
require('hover.providers.diagnostic')
|
||||||
|
-- require('hover.providers.man')
|
||||||
|
-- require('hover.providers.dictionary')
|
||||||
|
end,
|
||||||
|
preview_opts = {
|
||||||
|
border = 'single'
|
||||||
|
},
|
||||||
|
preview_window = false,
|
||||||
|
title = true,
|
||||||
|
mouse_providers = {
|
||||||
|
'LSP'
|
||||||
|
},
|
||||||
|
mouse_delay = 1000
|
||||||
|
}
|
|
@ -0,0 +1,50 @@
|
||||||
|
local lspconfig = require("lspconfig")
|
||||||
|
|
||||||
|
lspconfig.lua_ls.setup({
|
||||||
|
settings = {
|
||||||
|
Lua = {
|
||||||
|
hint = {
|
||||||
|
enable = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
lspconfig.eslint.setup({
|
||||||
|
settings = {
|
||||||
|
codeActionOnSave = {
|
||||||
|
enable = true,
|
||||||
|
mode = "all",
|
||||||
|
},
|
||||||
|
format = true,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
lspconfig.ts_ls.setup({
|
||||||
|
settings = {
|
||||||
|
typescript = {
|
||||||
|
inlayHints = {
|
||||||
|
includeInlayParameterNameHints = "all", -- 'none' | 'literals' | 'all'
|
||||||
|
includeInlayParameterNameHintsWhenArgumentMatchesName = false,
|
||||||
|
includeInlayFunctionParameterTypeHints = true,
|
||||||
|
includeInlayVariableTypeHints = true,
|
||||||
|
includeInlayVariableTypeHintsWhenTypeMatchesName = false,
|
||||||
|
includeInlayPropertyDeclarationTypeHints = true,
|
||||||
|
includeInlayFunctionLikeReturnTypeHints = true,
|
||||||
|
includeInlayEnumMemberValueHints = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
javascript = {
|
||||||
|
inlayHints = {
|
||||||
|
includeInlayParameterNameHints = "all", -- 'none' | 'literals' | 'all'
|
||||||
|
includeInlayParameterNameHintsWhenArgumentMatchesName = false,
|
||||||
|
includeInlayVariableTypeHints = true,
|
||||||
|
includeInlayFunctionParameterTypeHints = true,
|
||||||
|
includeInlayVariableTypeHintsWhenTypeMatchesName = false,
|
||||||
|
includeInlayPropertyDeclarationTypeHints = true,
|
||||||
|
includeInlayFunctionLikeReturnTypeHints = true,
|
||||||
|
includeInlayEnumMemberValueHints = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
})
|
|
@ -7,9 +7,42 @@ vim.o.fillchars = [[eob: ,fold: ,foldopen:,foldsep:│,foldclose:]]
|
||||||
vim.keymap.set('n', 'zR', require('ufo').openAllFolds)
|
vim.keymap.set('n', 'zR', require('ufo').openAllFolds)
|
||||||
vim.keymap.set('n', 'zM', require('ufo').closeAllFolds)
|
vim.keymap.set('n', 'zM', require('ufo').closeAllFolds)
|
||||||
|
|
||||||
|
local handler = function(virtText, lnum, endLnum, width, truncate)
|
||||||
|
local newVirtText = {}
|
||||||
|
local totalLines = vim.api.nvim_buf_line_count(0)
|
||||||
|
local foldedLines = endLnum - lnum
|
||||||
|
local suffix = (" %d %d%%"):format(foldedLines, foldedLines / totalLines * 100)
|
||||||
|
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
|
||||||
|
local rAlignAppndx =
|
||||||
|
math.max(math.min(vim.opt.textwidth["_value"], width - 1) - curWidth - sufWidth, 0)
|
||||||
|
suffix = (" "):rep(rAlignAppndx) .. suffix
|
||||||
|
table.insert(newVirtText, { suffix, "MoreMsg" })
|
||||||
|
return newVirtText
|
||||||
|
end
|
||||||
|
|
||||||
require('ufo').setup({
|
require('ufo').setup({
|
||||||
|
fold_virt_text_handler = handler,
|
||||||
open_fold_hl_timeout = 400,
|
open_fold_hl_timeout = 400,
|
||||||
close_fold_kinds = { "imports", "comment" },
|
|
||||||
preview = {
|
preview = {
|
||||||
win_config = {
|
win_config = {
|
||||||
border = { "", "─", "", "", "", "─", "", "" },
|
border = { "", "─", "", "", "", "─", "", "" },
|
||||||
|
|
|
@ -1,18 +1,37 @@
|
||||||
local navic = require("nvim-navic")
|
local navic = require("nvim-navic")
|
||||||
|
|
||||||
vim.g.rustaceanvim = {
|
vim.g.rustaceanvim = {
|
||||||
|
tools = {
|
||||||
|
autoSetHints = true,
|
||||||
|
inlay_hints = {
|
||||||
|
show_parameter_hints = true,
|
||||||
|
parameter_hints_prefix = "in: ", -- "<- "
|
||||||
|
other_hints_prefix = "out: " -- "=> "
|
||||||
|
}
|
||||||
|
},
|
||||||
server = {
|
server = {
|
||||||
on_attach = function(client, bufnr)
|
on_attach = function(client, bufnr)
|
||||||
navic.attach(client, bufnr)
|
navic.attach(client, bufnr)
|
||||||
end,
|
end,
|
||||||
filetypes = {"rust"},
|
|
||||||
settings = {
|
settings = {
|
||||||
-- rust-analyzer language server configuration
|
|
||||||
['rust-analyzer'] = {
|
['rust-analyzer'] = {
|
||||||
cargo = {
|
assist = {
|
||||||
allFeatures = true,
|
importEnforceGranularity = true,
|
||||||
},
|
importPrefix = "create"
|
||||||
},
|
|
||||||
},
|
},
|
||||||
|
cargo = { allFeatures = true },
|
||||||
|
checkOnSave = {
|
||||||
|
-- default: `cargo check`
|
||||||
|
command = "clippy",
|
||||||
|
allFeatures = true
|
||||||
},
|
},
|
||||||
|
inlayHints = {
|
||||||
|
lifetimeElisionHints = {
|
||||||
|
enable = true,
|
||||||
|
useParameterNames = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
local map = vim.keymap.set
|
local map = vim.keymap.set
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
map("n", ";", ":", { desc = "CMD enter command mode" })
|
map("n", ";", ":", { desc = "CMD enter command mode" })
|
||||||
|
|
||||||
map("i", "<C-h>", "<Left>", { desc = "move left" })
|
map("i", "<C-h>", "<Left>", { desc = "move left" })
|
||||||
|
@ -27,7 +25,6 @@ map("n", "<F5>", "<cmd>DapToggleBreakpoint<cr>")
|
||||||
map("n", "mk", "<cmd>RustLsp moveItem upcr>")
|
map("n", "mk", "<cmd>RustLsp moveItem upcr>")
|
||||||
map("n", "m,", "<cmd>RustLsp moveItem down<cr>")
|
map("n", "m,", "<cmd>RustLsp moveItem down<cr>")
|
||||||
map("n", "rs", "<cmd>RustLsp run<cr>")
|
map("n", "rs", "<cmd>RustLsp run<cr>")
|
||||||
map("n", "hh", "<cmd>RustLsp hover actions<cr>")
|
|
||||||
map("n", "ca", "<cmd>RustLsp codeAction<cr>")
|
map("n", "ca", "<cmd>RustLsp codeAction<cr>")
|
||||||
map("n", "<C-s>", "<cmd>w!<cr>")
|
map("n", "<C-s>", "<cmd>w!<cr>")
|
||||||
map("i", "<C-s>", "<cmd>w!<cr>")
|
map("i", "<C-s>", "<cmd>w!<cr>")
|
||||||
|
@ -52,3 +49,9 @@ map("n", "<leader>an", "<cmd>set norelativenumber<cr>")
|
||||||
map("n", "tt", "<cmd>ToggleTerm<cr>")
|
map("n", "tt", "<cmd>ToggleTerm<cr>")
|
||||||
map("n", "<C-{>", "<cmd>foldopen<cr>")
|
map("n", "<C-{>", "<cmd>foldopen<cr>")
|
||||||
map("n", "<C-}>", "<cmd>foldclose<cr>")
|
map("n", "<C-}>", "<cmd>foldclose<cr>")
|
||||||
|
|
||||||
|
map("n", "hh", require("hover").hover, {desc = "hover.nvim"})
|
||||||
|
map("n", "hs", require("hover").hover_select, {desc = "hover.nvim (select)"})
|
||||||
|
map("n", "<C-Tab>", function() require("hover").hover_switch("previous") end, {desc = "hover.nvim (previous source)"})
|
||||||
|
map("n", "<C-S-Tab>", function() require("hover").hover_switch("next") end, {desc = "hover.nvim (next source)"})
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
return {
|
return {
|
||||||
|
{
|
||||||
|
'simrat39/inlay-hints.nvim',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"LunarVim/breadcrumbs.nvim",
|
"LunarVim/breadcrumbs.nvim",
|
||||||
},
|
},
|
||||||
|
@ -8,6 +11,9 @@ return {
|
||||||
{
|
{
|
||||||
"lewis6991/gitsigns.nvim"
|
"lewis6991/gitsigns.nvim"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"lewis6991/hover.nvim",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"nvim-lualine/lualine.nvim",
|
"nvim-lualine/lualine.nvim",
|
||||||
},
|
},
|
||||||
|
@ -47,9 +53,11 @@ return {
|
||||||
{
|
{
|
||||||
"nvim-telescope/telescope.nvim",
|
"nvim-telescope/telescope.nvim",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"williamboman/mason-lspconfig.nvim",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"neovim/nvim-lspconfig",
|
"neovim/nvim-lspconfig",
|
||||||
dependencies = { "williamboman/mason-lspconfig.nvim", },
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"mfussenegger/nvim-dap",
|
"mfussenegger/nvim-dap",
|
||||||
|
@ -59,6 +67,10 @@ return {
|
||||||
"L3MON4D3/LuaSnip",
|
"L3MON4D3/LuaSnip",
|
||||||
lazy = true,
|
lazy = true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
'folke/lazydev.nvim',
|
||||||
|
ft = "lua",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
'Bekaboo/dropbar.nvim',
|
'Bekaboo/dropbar.nvim',
|
||||||
dependencies = {
|
dependencies = {
|
||||||
|
@ -136,49 +148,5 @@ return {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'kevinhwang91/nvim-ufo',
|
'kevinhwang91/nvim-ufo',
|
||||||
lazy = true,
|
|
||||||
config = function(_, opts)
|
|
||||||
local handler = function(virtText, lnum, endLnum, width, truncate)
|
|
||||||
local newVirtText = {}
|
|
||||||
local totalLines = vim.api.nvim_buf_line_count(0)
|
|
||||||
local foldedLines = endLnum - lnum
|
|
||||||
local suffix = (" %d %d%%"):format(foldedLines, foldedLines / totalLines * 100)
|
|
||||||
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
|
|
||||||
local rAlignAppndx =
|
|
||||||
math.max(math.min(vim.opt.textwidth["_value"], width - 1) - curWidth - sufWidth, 0)
|
|
||||||
suffix = (" "):rep(rAlignAppndx) .. suffix
|
|
||||||
table.insert(newVirtText, { suffix, "MoreMsg" })
|
|
||||||
return newVirtText
|
|
||||||
end
|
|
||||||
opts["fold_virt_text_handler"] = handler
|
|
||||||
require("ufo").setup(opts)
|
|
||||||
vim.keymap.set("n", "K", function()
|
|
||||||
local winid = require("ufo").peekFoldedLinesUnderCursor()
|
|
||||||
if not winid then
|
|
||||||
-- vim.lsp.buf.hover()
|
|
||||||
vim.cmd [[ Lspsaga hover_doc ]]
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
end,
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
"goolord/alpha-nvim",
|
'nvimdev/dashboard-nvim',
|
||||||
config = function ()
|
event = 'VimEnter',
|
||||||
require'alpha'.setup(require'alpha.themes.dashboard'.config)
|
dependencies = { { 'nvim-tree/nvim-web-devicons' } }
|
||||||
end
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kaarmu/typst.vim",
|
"kaarmu/typst.vim",
|
||||||
|
@ -46,5 +45,6 @@ return {
|
||||||
"mrcjkb/rustaceanvim",
|
"mrcjkb/rustaceanvim",
|
||||||
version = '^4', -- Recommended
|
version = '^4', -- Recommended
|
||||||
lazy = false, -- This plugin is already lazy
|
lazy = false, -- This plugin is already lazy
|
||||||
|
ft = { "rust" },
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue