Compare commits
No commits in common. "8dacb00b4d29d05b2a05b8ac43b7f782572a8a51" and "1edafd6d41991aeee84fba8c2a839c0ec913b0c0" have entirely different histories.
8dacb00b4d
...
1edafd6d41
31
init.lua
31
init.lua
|
@ -1,21 +1,17 @@
|
|||
local vanila_vim_autostart_commands = {
|
||||
"set number",
|
||||
"set clipboard=unnamedplus",
|
||||
"set nowrap",
|
||||
"set shiftwidth=4",
|
||||
"set tabstop=4",
|
||||
"set nowrap"
|
||||
}
|
||||
|
||||
for _, cmd in pairs(vanila_vim_autostart_commands) do
|
||||
vim.cmd(cmd)
|
||||
end
|
||||
|
||||
if vim.lsp.inlay_hint then
|
||||
vim.lsp.inlay_hint.enable(true, { 0 })
|
||||
end
|
||||
|
||||
require("config.lazy")
|
||||
require("config.plugins.nvimufo")
|
||||
|
||||
require("mappings")
|
||||
|
||||
require("config.plugins.acmp")
|
||||
require("config.plugins.autotag")
|
||||
require("config.plugins.autocomplete")
|
||||
|
@ -24,13 +20,7 @@ require("config.plugins.colorizer")
|
|||
require("config.plugins.comment")
|
||||
require("config.plugins.dap")
|
||||
require("config.plugins.gitsigns")
|
||||
require("ibl").setup({
|
||||
exclude = {
|
||||
filetypes = { "dashboard" },
|
||||
}
|
||||
})
|
||||
require("config.plugins.hover_actions")
|
||||
require("config.plugins.lsp_config")
|
||||
require("ibl").setup()
|
||||
require("config.plugins.lsp_diagnostic")
|
||||
require("config.plugins.lualine")
|
||||
require("config.plugins.navic")
|
||||
|
@ -38,17 +28,8 @@ require("config.plugins.noice")
|
|||
require("toggleterm").setup()
|
||||
require("config.plugins.treesitter")
|
||||
require("config.plugins.neotree")
|
||||
require("config.plugins.nvimufo")
|
||||
require("config.plugins.prettier")
|
||||
require("config.plugins.rustaceanvim")
|
||||
require("huez").setup({})
|
||||
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,10 +1,43 @@
|
|||
require('Comment').setup({
|
||||
require("Comment").setup({
|
||||
---Add a space b/w comment and the line
|
||||
padding = true,
|
||||
---Whether the cursor should stay at its position
|
||||
sticky = true,
|
||||
---Lines to be ignored while (un)comment
|
||||
ignore = nil,
|
||||
---LHS of toggle mappings in NORMAL mode
|
||||
toggler = {
|
||||
---Line-comment toggle keymap
|
||||
line = '<leader>/',
|
||||
---Block-comment toggle keymap
|
||||
block = '<leader>/',
|
||||
},
|
||||
---LHS of operator-pending mappings in NORMAL and VISUAL mode
|
||||
opleader = {
|
||||
---Line-comment keymap
|
||||
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,
|
||||
})
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
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',
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
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
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
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,42 +7,9 @@ vim.o.fillchars = [[eob: ,fold: ,foldopen:,foldsep:│,foldclose:]]
|
|||
vim.keymap.set('n', 'zR', require('ufo').openAllFolds)
|
||||
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({
|
||||
fold_virt_text_handler = handler,
|
||||
open_fold_hl_timeout = 400,
|
||||
close_fold_kinds = { "imports", "comment" },
|
||||
preview = {
|
||||
win_config = {
|
||||
border = { "", "─", "", "", "", "─", "", "" },
|
||||
|
@ -56,6 +23,6 @@ require('ufo').setup({
|
|||
},
|
||||
},
|
||||
provider_selector = function(bufnr, filetype, buftype)
|
||||
return { 'treesitter', 'indent' }
|
||||
return {'treesitter', 'indent'}
|
||||
end
|
||||
})
|
||||
|
|
|
@ -1,37 +1,18 @@
|
|||
local navic = require("nvim-navic")
|
||||
|
||||
vim.g.rustaceanvim = {
|
||||
tools = {
|
||||
autoSetHints = true,
|
||||
inlay_hints = {
|
||||
show_parameter_hints = true,
|
||||
parameter_hints_prefix = "in: ", -- "<- "
|
||||
other_hints_prefix = "out: " -- "=> "
|
||||
}
|
||||
},
|
||||
server = {
|
||||
on_attach = function(client, bufnr)
|
||||
navic.attach(client, bufnr)
|
||||
end,
|
||||
filetypes = {"rust"},
|
||||
settings = {
|
||||
-- rust-analyzer language server configuration
|
||||
['rust-analyzer'] = {
|
||||
assist = {
|
||||
importEnforceGranularity = true,
|
||||
importPrefix = "create"
|
||||
cargo = {
|
||||
allFeatures = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
cargo = { allFeatures = true },
|
||||
checkOnSave = {
|
||||
-- default: `cargo check`
|
||||
command = "clippy",
|
||||
allFeatures = true
|
||||
},
|
||||
inlayHints = {
|
||||
lifetimeElisionHints = {
|
||||
enable = true,
|
||||
useParameterNames = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
local map = vim.keymap.set
|
||||
|
||||
|
||||
|
||||
map("n", ";", ":", { desc = "CMD enter command mode" })
|
||||
|
||||
map("i", "<C-h>", "<Left>", { desc = "move left" })
|
||||
|
@ -25,6 +27,7 @@ map("n", "<F5>", "<cmd>DapToggleBreakpoint<cr>")
|
|||
map("n", "mk", "<cmd>RustLsp moveItem upcr>")
|
||||
map("n", "m,", "<cmd>RustLsp moveItem down<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", "<C-s>", "<cmd>w!<cr>")
|
||||
map("i", "<C-s>", "<cmd>w!<cr>")
|
||||
|
@ -49,9 +52,3 @@ map("n", "<leader>an", "<cmd>set norelativenumber<cr>")
|
|||
map("n", "tt", "<cmd>ToggleTerm<cr>")
|
||||
map("n", "<C-{>", "<cmd>foldopen<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,7 +1,4 @@
|
|||
return {
|
||||
{
|
||||
'simrat39/inlay-hints.nvim',
|
||||
},
|
||||
{
|
||||
"LunarVim/breadcrumbs.nvim",
|
||||
},
|
||||
|
@ -11,9 +8,6 @@ return {
|
|||
{
|
||||
"lewis6991/gitsigns.nvim"
|
||||
},
|
||||
{
|
||||
"lewis6991/hover.nvim",
|
||||
},
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
},
|
||||
|
@ -53,11 +47,9 @@ return {
|
|||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
},
|
||||
{
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
},
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = { "williamboman/mason-lspconfig.nvim", },
|
||||
},
|
||||
{
|
||||
"mfussenegger/nvim-dap",
|
||||
|
@ -67,10 +59,6 @@ return {
|
|||
"L3MON4D3/LuaSnip",
|
||||
lazy = true,
|
||||
},
|
||||
{
|
||||
'folke/lazydev.nvim',
|
||||
ft = "lua",
|
||||
},
|
||||
{
|
||||
'Bekaboo/dropbar.nvim',
|
||||
dependencies = {
|
||||
|
@ -148,5 +136,49 @@ return {
|
|||
},
|
||||
{
|
||||
'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,8 +1,9 @@
|
|||
return {
|
||||
{
|
||||
'nvimdev/dashboard-nvim',
|
||||
event = 'VimEnter',
|
||||
dependencies = { { 'nvim-tree/nvim-web-devicons' } }
|
||||
"goolord/alpha-nvim",
|
||||
config = function ()
|
||||
require'alpha'.setup(require'alpha.themes.dashboard'.config)
|
||||
end
|
||||
},
|
||||
{
|
||||
"kaarmu/typst.vim",
|
||||
|
@ -45,6 +46,5 @@ return {
|
|||
"mrcjkb/rustaceanvim",
|
||||
version = '^4', -- Recommended
|
||||
lazy = false, -- This plugin is already lazy
|
||||
ft = { "rust" },
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue