|
|
@ -1,4 +1,5 @@
|
|
|
|
-- What: Mono-file nvim configuration file Why: Easy to see through everything without needing to navigate thru files Features:
|
|
|
|
-- What: Mono-file nvim configuration file Why: Easy to see through everything without needing to navigate thru files
|
|
|
|
|
|
|
|
-- Features:
|
|
|
|
-- - LSP
|
|
|
|
-- - LSP
|
|
|
|
-- - Auto-complete (in insert mode: ctrl-space, navigate w/ Tab+S-Tab, confirm: Enter)
|
|
|
|
-- - Auto-complete (in insert mode: ctrl-space, navigate w/ Tab+S-Tab, confirm: Enter)
|
|
|
|
-- - <leader>df to format document
|
|
|
|
-- - <leader>df to format document
|
|
|
@ -59,7 +60,6 @@ Plug('nathanalderson/yang.vim')
|
|
|
|
-- Plug('windwp/nvim-autopairs') -- matches pairs like [] (),...
|
|
|
|
-- Plug('windwp/nvim-autopairs') -- matches pairs like [] (),...
|
|
|
|
-- Plug('windwp/nvim-ts-autotag') -- matches tags <body>hello</body>
|
|
|
|
-- Plug('windwp/nvim-ts-autotag') -- matches tags <body>hello</body>
|
|
|
|
-- Plug('NMAC427/guess-indent.nvim') -- guesses the indentation of an opened buffer
|
|
|
|
-- Plug('NMAC427/guess-indent.nvim') -- guesses the indentation of an opened buffer
|
|
|
|
-- Plug('j-hui/fidget.nvim') -- Progress bar for LSP
|
|
|
|
|
|
|
|
Plug('numToStr/Comment.nvim') -- "gc" to comment visual regions/lines
|
|
|
|
Plug('numToStr/Comment.nvim') -- "gc" to comment visual regions/lines
|
|
|
|
Plug('lewis6991/gitsigns.nvim') -- add git info to sign columns
|
|
|
|
Plug('lewis6991/gitsigns.nvim') -- add git info to sign columns
|
|
|
|
Plug('tpope/vim-fugitive') -- git commands in nvim
|
|
|
|
Plug('tpope/vim-fugitive') -- git commands in nvim
|
|
|
@ -174,8 +174,6 @@ vim.opt.backup = false
|
|
|
|
vim.opt.undodir = vim.fn.stdpath('state') .. '/.vim/undodir'
|
|
|
|
vim.opt.undodir = vim.fn.stdpath('state') .. '/.vim/undodir'
|
|
|
|
vim.opt.undofile = true
|
|
|
|
vim.opt.undofile = true
|
|
|
|
vim.opt.completeopt = 'menuone,noselect'
|
|
|
|
vim.opt.completeopt = 'menuone,noselect'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- vim.opt.clipboard = "unnamedplus"
|
|
|
|
-- vim.opt.clipboard = "unnamedplus"
|
|
|
|
-- more aggressive swap file writing. ThePrimeagen believes higher number
|
|
|
|
-- more aggressive swap file writing. ThePrimeagen believes higher number
|
|
|
|
-- leads to low DX
|
|
|
|
-- leads to low DX
|
|
|
@ -358,46 +356,6 @@ remap('n', '<leader>zg', function()
|
|
|
|
vim.cmd(":ZkGrep")
|
|
|
|
vim.cmd(":ZkGrep")
|
|
|
|
end, { desc = '[Z]ettelkasten [G]rep' })
|
|
|
|
end, { desc = '[Z]ettelkasten [G]rep' })
|
|
|
|
|
|
|
|
|
|
|
|
-- tab management {{{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- Jump to specific tab with <C-t>[number]
|
|
|
|
|
|
|
|
for i = 1, 9 do
|
|
|
|
|
|
|
|
vim.api.nvim_set_keymap('n', '<C-t>' .. i, ':tabn ' .. i .. '<CR>', { noremap = true, silent = true })
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- Show tab number in tab display
|
|
|
|
|
|
|
|
vim.o.showtabline = 1
|
|
|
|
|
|
|
|
vim.o.tabline = '%!v:lua.my_tabline()'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function _G.my_tabline()
|
|
|
|
|
|
|
|
local s = ''
|
|
|
|
|
|
|
|
for i = 1, vim.fn.tabpagenr('$') do
|
|
|
|
|
|
|
|
if i == vim.fn.tabpagenr() then
|
|
|
|
|
|
|
|
s = s .. '%' .. i .. 'T%#TabLineSel#'
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
s = s .. '%' .. i .. 'T%#TabLine#'
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
local tab = vim.fn.gettabinfo(i)[1]
|
|
|
|
|
|
|
|
local tabbuf = tab.variables.buffers
|
|
|
|
|
|
|
|
local bufname = "<unknown>"
|
|
|
|
|
|
|
|
if tabbuf then
|
|
|
|
|
|
|
|
bufname = tabbuf[tab.curwin].name
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Canonicalize tab/buf name
|
|
|
|
|
|
|
|
s = s .. ' ' .. i .. ' ' .. vim.fn.fnamemodify(bufname, ':t')
|
|
|
|
|
|
|
|
if i ~= vim.fn.tabpagenr('$') then
|
|
|
|
|
|
|
|
s = s .. '%#TabLine#|%#TabLine#'
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
return s .. '%T%#TabLineFill#%='
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- Close all tabs except the first one
|
|
|
|
|
|
|
|
vim.api.nvim_set_keymap('n', '<C-t>x', ':tabdo if tabpagenr() > 1 | tabclose | endif<CR>',
|
|
|
|
|
|
|
|
{ noremap = true, silent = true })
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- }}}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- treesitter
|
|
|
|
-- treesitter
|
|
|
|
require 'treesitter-context'
|
|
|
|
require 'treesitter-context'
|
|
|
|
require('nvim-treesitter.configs').setup {
|
|
|
|
require('nvim-treesitter.configs').setup {
|
|
|
@ -538,7 +496,6 @@ local on_attach = function(client, bufnr)
|
|
|
|
nmap('<C-k>', vim.lsp.buf.signature_help, 'Signature Documentation')
|
|
|
|
nmap('<C-k>', vim.lsp.buf.signature_help, 'Signature Documentation')
|
|
|
|
|
|
|
|
|
|
|
|
-- Lesser used LSP functionality
|
|
|
|
-- Lesser used LSP functionality
|
|
|
|
|
|
|
|
|
|
|
|
nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
|
|
|
|
nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
|
|
|
|
nmap('gtd', vim.lsp.buf.type_definition, '[G]oto [T]ype [D]efinition')
|
|
|
|
nmap('gtd', vim.lsp.buf.type_definition, '[G]oto [T]ype [D]efinition')
|
|
|
|
nmap('<leader>D', vim.lsp.buf.type_definition, 'Type [D]efinition')
|
|
|
|
nmap('<leader>D', vim.lsp.buf.type_definition, 'Type [D]efinition')
|
|
|
@ -665,8 +622,8 @@ require("mason").setup({
|
|
|
|
PATH = "append",
|
|
|
|
PATH = "append",
|
|
|
|
})
|
|
|
|
})
|
|
|
|
require('mason-lspconfig').setup({
|
|
|
|
require('mason-lspconfig').setup({
|
|
|
|
-- ensure_installed = servers,
|
|
|
|
ensure_installed = servers,
|
|
|
|
automatic_installation = false
|
|
|
|
automatic_installation = true
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
local inlay_hint_tsjs = {
|
|
|
|
local inlay_hint_tsjs = {
|
|
|
@ -704,9 +661,7 @@ require('mason-lspconfig').setup_handlers({
|
|
|
|
library = vim.api.nvim_get_runtime_file('', true)
|
|
|
|
library = vim.api.nvim_get_runtime_file('', true)
|
|
|
|
},
|
|
|
|
},
|
|
|
|
telemetry = { enable = false },
|
|
|
|
telemetry = { enable = false },
|
|
|
|
hint = {
|
|
|
|
hint = { enable = true, },
|
|
|
|
enable = true,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
format = {
|
|
|
|
format = {
|
|
|
|
enable = true,
|
|
|
|
enable = true,
|
|
|
|
defaultConfig = {
|
|
|
|
defaultConfig = {
|
|
|
@ -828,7 +783,7 @@ require("rust-tools").setup {
|
|
|
|
-- default: true
|
|
|
|
-- default: true
|
|
|
|
auto = false,
|
|
|
|
auto = false,
|
|
|
|
-- Only show inlay hints for the current line
|
|
|
|
-- Only show inlay hints for the current line
|
|
|
|
only_current_line = true,
|
|
|
|
only_current_line = false,
|
|
|
|
-- whether to show parameter hints with the inlay hints or not
|
|
|
|
-- whether to show parameter hints with the inlay hints or not
|
|
|
|
-- default: true
|
|
|
|
-- default: true
|
|
|
|
show_parameter_hints = true,
|
|
|
|
show_parameter_hints = true,
|
|
|
@ -846,8 +801,8 @@ require("rust-tools").setup {
|
|
|
|
right_align = false,
|
|
|
|
right_align = false,
|
|
|
|
-- padding from the right if right_align is true
|
|
|
|
-- padding from the right if right_align is true
|
|
|
|
right_align_padding = 7,
|
|
|
|
right_align_padding = 7,
|
|
|
|
-- The color of the hints use `:highlight` for a pick-and-choose menu
|
|
|
|
-- The color of the hints
|
|
|
|
highlight = "NonText",
|
|
|
|
highlight = "Comment",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
-- options same as lsp hover / vim.lsp.util.open_floating_preview()
|
|
|
|
-- options same as lsp hover / vim.lsp.util.open_floating_preview()
|
|
|
|
hover_actions = {
|
|
|
|
hover_actions = {
|
|
|
@ -1085,53 +1040,3 @@ require('lualine').setup {
|
|
|
|
|
|
|
|
|
|
|
|
require('nvim-surround').setup {}
|
|
|
|
require('nvim-surround').setup {}
|
|
|
|
require('tsql').setup()
|
|
|
|
require('tsql').setup()
|
|
|
|
require('fidget').setup({
|
|
|
|
|
|
|
|
text = {
|
|
|
|
|
|
|
|
spinner = "pipe", -- animation shown when tasks are ongoing
|
|
|
|
|
|
|
|
done = "✔", -- character shown when all tasks are complete
|
|
|
|
|
|
|
|
commenced = "Started", -- message shown when task starts
|
|
|
|
|
|
|
|
completed = "Completed", -- message shown when task completes
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
align = {
|
|
|
|
|
|
|
|
bottom = true, -- align fidgets along bottom edge of buffer
|
|
|
|
|
|
|
|
right = true, -- align fidgets along right edge of buffer
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
timer = {
|
|
|
|
|
|
|
|
spinner_rate = 125, -- frame rate of spinner animation, in ms
|
|
|
|
|
|
|
|
fidget_decay = 2000, -- how long to keep around empty fidget, in ms
|
|
|
|
|
|
|
|
task_decay = 1000, -- how long to keep around completed task, in ms
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
window = {
|
|
|
|
|
|
|
|
relative = "win", -- where to anchor, either "win" or "editor"
|
|
|
|
|
|
|
|
blend = 100, -- &winblend for the window
|
|
|
|
|
|
|
|
zindex = nil, -- the zindex value for the window
|
|
|
|
|
|
|
|
border = "none", -- style of border for the fidget window
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
fmt = {
|
|
|
|
|
|
|
|
leftpad = true, -- right-justify text in fidget box
|
|
|
|
|
|
|
|
stack_upwards = true, -- list of tasks grows upwards
|
|
|
|
|
|
|
|
max_width = 0, -- maximum width of the fidget box
|
|
|
|
|
|
|
|
fidget = -- function to format fidget title
|
|
|
|
|
|
|
|
function(fidget_name, spinner)
|
|
|
|
|
|
|
|
return string.format("%s %s", spinner, fidget_name)
|
|
|
|
|
|
|
|
end,
|
|
|
|
|
|
|
|
task = -- function to format each task line
|
|
|
|
|
|
|
|
function(task_name, message, percentage)
|
|
|
|
|
|
|
|
return string.format(
|
|
|
|
|
|
|
|
"%s%s [%s]",
|
|
|
|
|
|
|
|
message,
|
|
|
|
|
|
|
|
percentage and string.format(" (%s%%)", percentage) or "",
|
|
|
|
|
|
|
|
task_name
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
end,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
sources = { -- Sources to configure
|
|
|
|
|
|
|
|
* = { -- Name of source
|
|
|
|
|
|
|
|
ignore = false, -- Ignore notifications from this source
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
debug = {
|
|
|
|
|
|
|
|
logging = false, -- whether to enable logging, for debugging
|
|
|
|
|
|
|
|
strict = false, -- whether to interpret LSP strictly
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|