Compare commits

..

11 Commits

10 changed files with 235 additions and 122 deletions

View File

@ -1,17 +1,21 @@
local vanila_vim_autostart_commands = {
"set number",
"set clipboard=unnamedplus",
"set nowrap"
"set nowrap",
"set shiftwidth=4",
"set tabstop=4",
}
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("mappings")
require("config.plugins.nvimufo")
require("config.plugins.acmp")
require("config.plugins.autotag")
require("config.plugins.autocomplete")
@ -20,7 +24,13 @@ require("config.plugins.colorizer")
require("config.plugins.comment")
require("config.plugins.dap")
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.lualine")
require("config.plugins.navic")
@ -28,8 +38,17 @@ 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")

View File

@ -1,43 +1,10 @@
require("Comment").setup({
---Add a space b/w comment and the line
require('Comment').setup({
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,
})

View File

@ -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',
},
},
},
}

View File

@ -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
}

View File

@ -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,
},
},
}
})

View File

@ -7,9 +7,42 @@ 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 = { "", "", "", "", "", "", "", "" },

View File

@ -1,18 +1,37 @@
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'] = {
cargo = {
allFeatures = true,
},
},
assist = {
importEnforceGranularity = true,
importPrefix = "create"
},
cargo = { allFeatures = true },
checkOnSave = {
-- default: `cargo check`
command = "clippy",
allFeatures = true
},
inlayHints = {
lifetimeElisionHints = {
enable = true,
useParameterNames = true
}
}
}
}
}
}

View File

@ -1,7 +1,5 @@
local map = vim.keymap.set
map("n", ";", ":", { desc = "CMD enter command mode" })
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", "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>")
@ -52,3 +49,9 @@ 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)"})

View File

@ -1,4 +1,7 @@
return {
{
'simrat39/inlay-hints.nvim',
},
{
"LunarVim/breadcrumbs.nvim",
},
@ -8,6 +11,9 @@ return {
{
"lewis6991/gitsigns.nvim"
},
{
"lewis6991/hover.nvim",
},
{
"nvim-lualine/lualine.nvim",
},
@ -47,9 +53,11 @@ return {
{
"nvim-telescope/telescope.nvim",
},
{
"williamboman/mason-lspconfig.nvim",
},
{
"neovim/nvim-lspconfig",
dependencies = { "williamboman/mason-lspconfig.nvim", },
},
{
"mfussenegger/nvim-dap",
@ -59,6 +67,10 @@ return {
"L3MON4D3/LuaSnip",
lazy = true,
},
{
'folke/lazydev.nvim',
ft = "lua",
},
{
'Bekaboo/dropbar.nvim',
dependencies = {
@ -136,49 +148,5 @@ 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,
},
}

View File

@ -1,9 +1,8 @@
return {
{
"goolord/alpha-nvim",
config = function ()
require'alpha'.setup(require'alpha.themes.dashboard'.config)
end
'nvimdev/dashboard-nvim',
event = 'VimEnter',
dependencies = { { 'nvim-tree/nvim-web-devicons' } }
},
{
"kaarmu/typst.vim",
@ -46,5 +45,6 @@ return {
"mrcjkb/rustaceanvim",
version = '^4', -- Recommended
lazy = false, -- This plugin is already lazy
ft = { "rust" },
},
}