Compare commits
No commits in common. "legacy" and "main" have entirely different histories.
|
@ -1,5 +1,41 @@
|
||||||
tags
|
# Compiled Lua sources
|
||||||
test.sh
|
luac.out
|
||||||
.luarc.json
|
|
||||||
nvim
|
# luarocks build files
|
||||||
lazy-lock.json
|
*.src.rock
|
||||||
|
*.zip
|
||||||
|
*.tar.gz
|
||||||
|
|
||||||
|
# Object files
|
||||||
|
*.o
|
||||||
|
*.os
|
||||||
|
*.ko
|
||||||
|
*.obj
|
||||||
|
*.elf
|
||||||
|
|
||||||
|
# Precompiled Headers
|
||||||
|
*.gch
|
||||||
|
*.pch
|
||||||
|
|
||||||
|
# Libraries
|
||||||
|
*.lib
|
||||||
|
*.a
|
||||||
|
*.la
|
||||||
|
*.lo
|
||||||
|
*.def
|
||||||
|
*.exp
|
||||||
|
|
||||||
|
# Shared objects (inc. Windows DLLs)
|
||||||
|
*.dll
|
||||||
|
*.so
|
||||||
|
*.so.*
|
||||||
|
*.dylib
|
||||||
|
|
||||||
|
# Executables
|
||||||
|
*.exe
|
||||||
|
*.out
|
||||||
|
*.app
|
||||||
|
*.i*86
|
||||||
|
*.x86_64
|
||||||
|
*.hex
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
repos:
|
||||||
|
- repo: https://github.com/JohnnyMorganz/StyLua
|
||||||
|
rev: v2.3.0
|
||||||
|
hooks:
|
||||||
|
- id: stylua-system
|
||||||
|
args: [--check, --respect-ignores]
|
|
@ -1,6 +1,3 @@
|
||||||
column_width = 160
|
column_width = 88
|
||||||
line_endings = "Unix"
|
|
||||||
indent_type = "Spaces"
|
indent_type = "Spaces"
|
||||||
indent_width = 2
|
collapse_simple_statement = "Always"
|
||||||
quote_style = "AutoPreferSingle"
|
|
||||||
no_call_parentheses = true
|
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) Matej Janežič
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
in the Software without restriction, including without limitation the rights
|
in the Software without restriction, including without limitation the rights
|
|
@ -1,7 +1 @@
|
||||||
# init.lua
|
# nvim
|
||||||
|
|
||||||
created from the fantastic [kickstart.nvim](https://github.com/nvim-lua/kickstart.nvim)
|
|
||||||
|
|
||||||
## requirements
|
|
||||||
|
|
||||||
- [ripgrep](https://github.com/BurntSushi/ripgrep)
|
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
vim.keymap.set("n", "<leader><leader>x", "<cmd>source %<CR>")
|
||||||
|
vim.keymap.set("n", "<leader>x", ":.lua<CR>")
|
||||||
|
vim.keymap.set("v", "<leader>x", ":lua<CR>")
|
||||||
|
|
||||||
|
vim.opt_local.colorcolumn = { 81 }
|
|
@ -0,0 +1 @@
|
||||||
|
vim.opt_local.colorcolumn = { 80, 81, 89 }
|
|
@ -0,0 +1 @@
|
||||||
|
vim.opt_local.colorcolumn = { 80, 100 }
|
|
@ -0,0 +1,7 @@
|
||||||
|
return {
|
||||||
|
settings = {
|
||||||
|
initializationOptions = {
|
||||||
|
telemetry = "off",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,62 @@
|
||||||
|
local filter_line_locations = function(locations)
|
||||||
|
local present, res = {}, {}
|
||||||
|
for _, l in ipairs(locations) do
|
||||||
|
local t = present[l.filename] or {}
|
||||||
|
if not t[l.lnum] then
|
||||||
|
table.insert(res, l)
|
||||||
|
t[l.lnum] = true
|
||||||
|
end
|
||||||
|
present[l.filename] = t
|
||||||
|
end
|
||||||
|
return res
|
||||||
|
end
|
||||||
|
|
||||||
|
local show_location = function(location)
|
||||||
|
local buf_id = location.bufnr or vim.fn.bufadd(location.filename)
|
||||||
|
vim.bo[buf_id].buflisted = true
|
||||||
|
vim.api.nvim_win_set_buf(0, buf_id)
|
||||||
|
vim.api.nvim_win_set_cursor(0, { location.lnum, location.col - 1 })
|
||||||
|
vim.cmd("normal! zv")
|
||||||
|
end
|
||||||
|
|
||||||
|
local on_list = function(args)
|
||||||
|
local items = filter_line_locations(args.items)
|
||||||
|
if #items > 1 then
|
||||||
|
vim.fn.setqflist({}, " ", { title = "LSP locations", items = items })
|
||||||
|
return vim.cmd("botright copen")
|
||||||
|
end
|
||||||
|
show_location(items[1])
|
||||||
|
end
|
||||||
|
|
||||||
|
local luals_unique_definition = function()
|
||||||
|
return vim.lsp.buf.definition({ on_list = on_list })
|
||||||
|
end
|
||||||
|
|
||||||
|
return {
|
||||||
|
on_attach = function(client, buf_id)
|
||||||
|
-- Reduce unnecessarily long list of completion triggers for better
|
||||||
|
-- 'mini.completion' experience
|
||||||
|
client.server_capabilities.completionProvider.triggerCharacters =
|
||||||
|
{ ".", ":", "#", "(" }
|
||||||
|
|
||||||
|
-- Override global "Go to source" mapping with dedicated buffer-local
|
||||||
|
local opts = { buffer = buf_id, desc = "Lua source definition" }
|
||||||
|
vim.keymap.set("n", "<Leader>ld", luals_unique_definition, opts)
|
||||||
|
end,
|
||||||
|
settings = {
|
||||||
|
Lua = {
|
||||||
|
runtime = { version = "LuaJIT", path = vim.split(package.path, ";") },
|
||||||
|
diagnostics = {
|
||||||
|
-- Don't analyze whole workspace, as it consumes too much CPU and RAM
|
||||||
|
workspaceDelay = -1,
|
||||||
|
},
|
||||||
|
workspace = {
|
||||||
|
-- Don't analyze code from submodules
|
||||||
|
ignoreSubmodules = true,
|
||||||
|
-- Add Neovim's methods for easier code writing
|
||||||
|
library = { vim.env.VIMRUNTIME },
|
||||||
|
},
|
||||||
|
telemetry = { enable = false },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
88
init.lua
88
init.lua
|
@ -1,82 +1,6 @@
|
||||||
-- Set <space> as the leader key
|
-- set vim options
|
||||||
-- WARN: Must happen before plugins are required (otherwise wrong leader will be used)
|
require("config.options")
|
||||||
vim.g.mapleader = ' '
|
-- set keympas
|
||||||
vim.g.maplocalleader = ' '
|
require("config.keymap")
|
||||||
|
-- import plugins
|
||||||
-- Install package manager
|
require("config.plugins")
|
||||||
-- https://github.com/folke/lazy.nvim
|
|
||||||
-- `:help lazy.nvim.txt` for more info
|
|
||||||
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
|
|
||||||
if not vim.loop.fs_stat(lazypath) then
|
|
||||||
vim.fn.system {
|
|
||||||
'git',
|
|
||||||
'clone',
|
|
||||||
'--filter=blob:none',
|
|
||||||
'https://github.com/folke/lazy.nvim.git',
|
|
||||||
'--branch=stable', -- latest stable release
|
|
||||||
lazypath,
|
|
||||||
}
|
|
||||||
end
|
|
||||||
vim.opt.rtp:prepend(lazypath)
|
|
||||||
|
|
||||||
require 'options'
|
|
||||||
require 'autocmd'
|
|
||||||
require 'keymaps'
|
|
||||||
|
|
||||||
require('lazy').setup({
|
|
||||||
{
|
|
||||||
-- NOTE: Theme
|
|
||||||
'sainnhe/gruvbox-material',
|
|
||||||
priority = 1000,
|
|
||||||
lazy = false,
|
|
||||||
config = function()
|
|
||||||
vim.o.background = 'dark'
|
|
||||||
vim.g.gruvbox_material_background = 'light'
|
|
||||||
vim.g.gruvbox_material_better_performance = 1
|
|
||||||
vim.g.gruvbox_material_diagnostic_line_highlight = 1
|
|
||||||
vim.g.gruvbox_material_diagnostic_virtual_text = 'colored'
|
|
||||||
vim.g.gruvbox_material_enable_bold = 1
|
|
||||||
vim.g.gruvbox_material_enable_italic = 1
|
|
||||||
vim.cmd.colorscheme 'gruvbox-material'
|
|
||||||
-- changing bg and border colors
|
|
||||||
vim.api.nvim_set_hl(0, 'FloatBorder', { link = 'Normal' })
|
|
||||||
vim.api.nvim_set_hl(0, 'LspInfoBorder', { link = 'Normal' })
|
|
||||||
vim.api.nvim_set_hl(0, 'NormalFloat', { link = 'Normal' })
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
|
|
||||||
-- NOTE: First, some plugins that don't require any configuration
|
|
||||||
|
|
||||||
-- Git related plugins
|
|
||||||
'tpope/vim-fugitive',
|
|
||||||
'tpope/vim-rhubarb',
|
|
||||||
|
|
||||||
-- Detect tabstop and shiftwidth automatically
|
|
||||||
'tpope/vim-sleuth',
|
|
||||||
|
|
||||||
-- NOTE: Second, plugins that require setup call (done via opts)
|
|
||||||
|
|
||||||
-- Useful plugin to show you pending keybinds.
|
|
||||||
{ 'folke/which-key.nvim', opts = {} },
|
|
||||||
|
|
||||||
-- "gc" to comment visual regions/lines
|
|
||||||
{ 'numToStr/Comment.nvim', opts = {} },
|
|
||||||
|
|
||||||
-- colorize in files
|
|
||||||
{ 'norcalli/nvim-colorizer.lua', opts = {} },
|
|
||||||
|
|
||||||
-- autopairs on newline
|
|
||||||
{ 'windwp/nvim-autopairs', opts = {} },
|
|
||||||
|
|
||||||
-- highlighting for comments
|
|
||||||
{ 'folke/todo-comments.nvim', dependencies = 'nvim-lua/plenary.nvim', opts = {} },
|
|
||||||
|
|
||||||
-- cargo crates
|
|
||||||
{ 'saecki/crates.nvim', dependencies = 'nvim-lua/plenary.nvim', opts = {} },
|
|
||||||
|
|
||||||
-- import other plugins
|
|
||||||
{ import = 'plugins' },
|
|
||||||
}, {})
|
|
||||||
|
|
||||||
-- The line beneath this is called `modeline`. See `:help modeline`
|
|
||||||
-- vim: ts=2 sts=2 sw=2 et
|
|
||||||
|
|
|
@ -1,29 +0,0 @@
|
||||||
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWinEnter' }, { command = 'set colorcolumn=79,80,88,120', pattern = { '*.py', '*.pyi' } })
|
|
||||||
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWinEnter' }, { command = 'set colorcolumn=80,100', pattern = { '*.rs' } })
|
|
||||||
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWinEnter' }, { command = 'set splitright', pattern = { '*' } })
|
|
||||||
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWinEnter' }, { command = 'set splitbelow', pattern = { '*' } })
|
|
||||||
|
|
||||||
-- [[ Highlight on yank ]]
|
|
||||||
-- See `:help vim.highlight.on_yank()`
|
|
||||||
local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true })
|
|
||||||
vim.api.nvim_create_autocmd('TextYankPost', {
|
|
||||||
callback = function()
|
|
||||||
vim.highlight.on_yank()
|
|
||||||
end,
|
|
||||||
group = highlight_group,
|
|
||||||
pattern = '*',
|
|
||||||
})
|
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd({ 'BufRead', 'BufNewFile' }, {
|
|
||||||
pattern = '*.gitlab-ci*.{yml,yaml}',
|
|
||||||
callback = function()
|
|
||||||
vim.bo.filetype = 'yaml.gitlab'
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd({ 'BufRead', 'BufNewFile' }, {
|
|
||||||
pattern = vim.fn.expand '~' .. '/.ssh/config.d/*.config',
|
|
||||||
callback = function()
|
|
||||||
vim.bo.filetype = 'sshconfig'
|
|
||||||
end,
|
|
||||||
})
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
vim.keymap.set("n", "<C-d>", "<C-d>zz", { noremap = true, silent = true })
|
||||||
|
vim.keymap.set("n", "<C-u>", "<C-u>zz", { noremap = true, silent = true })
|
||||||
|
vim.keymap.set("n", "n", "nzz", { noremap = true, silent = true })
|
||||||
|
vim.keymap.set("n", "N", "Nzz", { noremap = true, silent = true })
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<leader>e", vim.diagnostic.open_float)
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<M-j>", "<cmd>cnext<CR>")
|
||||||
|
vim.keymap.set("n", "<M-k>", "<cmd>cprev<CR>")
|
||||||
|
|
||||||
|
vim.keymap.set("v", "<M-k>", ":m '<-2<cr>gv=gv")
|
||||||
|
vim.keymap.set("v", "<M-j>", ":m '>+1<cr>gv=gv")
|
||||||
|
|
||||||
|
vim.keymap.set(
|
||||||
|
"t",
|
||||||
|
"<C-x>",
|
||||||
|
vim.api.nvim_replace_termcodes("<C-\\><C-N>", true, true, true),
|
||||||
|
{ desc = "escape terminal mode" }
|
||||||
|
)
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<leader>hh", ":noh<cr>", { desc = "no highlight search" })
|
|
@ -0,0 +1,70 @@
|
||||||
|
vim.g.mapleader = " "
|
||||||
|
vim.keymap.set({ "n", "v" }, "<Space>", "<Nop>", { silent = true })
|
||||||
|
|
||||||
|
-- disable netrw
|
||||||
|
vim.g.loaded_netrw = 1
|
||||||
|
vim.g.loaded_netrwPlugin = 1
|
||||||
|
|
||||||
|
-- general
|
||||||
|
vim.o.backup = false
|
||||||
|
vim.o.mouse = ""
|
||||||
|
-- TODO:(janezicmatej) i think mouse scroll is binded to up/down and this
|
||||||
|
-- deosn't always work
|
||||||
|
vim.o.mousescroll = "ver:0,hor:0"
|
||||||
|
vim.o.writebackup = false
|
||||||
|
vim.o.undofile = true
|
||||||
|
|
||||||
|
-- ui
|
||||||
|
vim.o.breakindent = true
|
||||||
|
vim.o.colorcolumn = "+1"
|
||||||
|
vim.o.number = true
|
||||||
|
vim.o.cursorline = true
|
||||||
|
vim.o.relativenumber = true
|
||||||
|
vim.o.splitright = true
|
||||||
|
vim.o.splitbelow = true
|
||||||
|
vim.o.signcolumn = "yes"
|
||||||
|
vim.o.wrap = false
|
||||||
|
vim.o.winborder = "double"
|
||||||
|
|
||||||
|
-- editing
|
||||||
|
vim.o.autoindent = true
|
||||||
|
vim.o.expandtab = true
|
||||||
|
vim.o.ignorecase = true
|
||||||
|
vim.o.smartcase = true
|
||||||
|
|
||||||
|
-- diagnostic show virtual text
|
||||||
|
vim.diagnostic.config({ virtual_text = true })
|
||||||
|
local function swap_diagnostic()
|
||||||
|
local virtext = vim.diagnostic.config().virtual_text
|
||||||
|
local virlines = vim.diagnostic.config().virtual_lines
|
||||||
|
vim.diagnostic.config({ virtual_text = not virtext, virtual_lines = not virlines })
|
||||||
|
end
|
||||||
|
vim.keymap.set("n", "<leader>dt", swap_diagnostic)
|
||||||
|
|
||||||
|
-- osc52 escape codes copy
|
||||||
|
local function ocs52_paste_fail()
|
||||||
|
vim.notify("can't paste via osc52", vim.log.levels.WARN)
|
||||||
|
return {}
|
||||||
|
end
|
||||||
|
vim.g.clipboard = {
|
||||||
|
name = "osc52-writeonly",
|
||||||
|
copy = {
|
||||||
|
["+"] = require("vim.ui.clipboard.osc52").copy("+"),
|
||||||
|
["*"] = require("vim.ui.clipboard.osc52").copy("*"),
|
||||||
|
},
|
||||||
|
paste = {
|
||||||
|
["+"] = ocs52_paste_fail,
|
||||||
|
["*"] = ocs52_paste_fail,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
vim.o.completeopt = "menuone,noselect,fuzzy,nosort"
|
||||||
|
|
||||||
|
-- default plus added dash
|
||||||
|
vim.o.iskeyword = "@,48-57,_,192-255,-"
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("TextYankPost", {
|
||||||
|
desc = "highlight when yanking text",
|
||||||
|
group = vim.api.nvim_create_augroup("CustomHighlightYank", { clear = true }),
|
||||||
|
callback = function() vim.highlight.on_yank() end,
|
||||||
|
})
|
|
@ -0,0 +1,44 @@
|
||||||
|
-- bootstrap 'mini.nvim' manually in a way that it gets managed by 'mini.deps'
|
||||||
|
local mini_path = vim.fn.stdpath("data") .. "/site/pack/deps/start/mini.nvim"
|
||||||
|
if not vim.loop.fs_stat(mini_path) then
|
||||||
|
vim.cmd('echo "Installing `mini.nvim`" | redraw')
|
||||||
|
local clone_cmd = {
|
||||||
|
"git",
|
||||||
|
"clone",
|
||||||
|
"--filter=blob:none",
|
||||||
|
"https://github.com/nvim-mini/mini.nvim",
|
||||||
|
mini_path,
|
||||||
|
}
|
||||||
|
vim.fn.system(clone_cmd)
|
||||||
|
vim.cmd("packadd mini.nvim | helptags ALL")
|
||||||
|
vim.cmd('echo "Installed `mini.nvim`" | redraw')
|
||||||
|
end
|
||||||
|
|
||||||
|
-- set up 'mini.deps' immediately to have its `now()` and `later()` helpers
|
||||||
|
require("mini.deps").setup()
|
||||||
|
|
||||||
|
-- define main config table to be able to use it in scripts
|
||||||
|
_G.Config = {}
|
||||||
|
|
||||||
|
-- dyncamically import lua/plugins/*.lua
|
||||||
|
local path = vim.fn.stdpath("config") .. "/lua/plugins"
|
||||||
|
|
||||||
|
local plugins = vim.iter(vim.fs.dir(path))
|
||||||
|
:filter(function(n, t) return t == "file" and n:match("%.lua") end)
|
||||||
|
:map(function(n, _)
|
||||||
|
local s, _ = n:gsub("%.lua$", "")
|
||||||
|
return s
|
||||||
|
end)
|
||||||
|
:totable()
|
||||||
|
|
||||||
|
-- gather errors so any vim.notify overrides happen
|
||||||
|
local errors = {}
|
||||||
|
|
||||||
|
for _, p in ipairs(plugins) do
|
||||||
|
local ok, err = pcall(require, "plugins." .. p)
|
||||||
|
if not ok then table.insert(errors, "'" .. p .. ".lua'\n\t" .. err) end
|
||||||
|
end
|
||||||
|
|
||||||
|
for _, error in ipairs(errors) do
|
||||||
|
vim.notify(error, vim.log.levels.ERROR)
|
||||||
|
end
|
|
@ -1,33 +0,0 @@
|
||||||
-- [[ Basic Keymaps ]]
|
|
||||||
|
|
||||||
-- Keymaps for better default experience
|
|
||||||
-- See `:help vim.keymap.set()`
|
|
||||||
vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true })
|
|
||||||
|
|
||||||
-- Remap for dealing with word wrap
|
|
||||||
vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
|
|
||||||
vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
|
|
||||||
vim.keymap.set('n', '<Up>', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
|
|
||||||
vim.keymap.set('n', '<Down>', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
|
|
||||||
|
|
||||||
-- Remap for vertical navigation
|
|
||||||
vim.keymap.set('n', '<C-d>', '<C-d>zz', { noremap = true, silent = true })
|
|
||||||
vim.keymap.set('n', '<C-u>', '<C-u>zz', { noremap = true, silent = true })
|
|
||||||
vim.keymap.set('n', 'n', 'nzzzv', { noremap = true, silent = true })
|
|
||||||
vim.keymap.set('n', 'N', 'Nzzzv', { noremap = true, silent = true })
|
|
||||||
|
|
||||||
-- Remap for moving selected line / block of text in visual mode
|
|
||||||
vim.keymap.set('v', '<M-k>', ":m '<-2<cr>gv=gv", { desc = 'Move selected lines up' })
|
|
||||||
vim.keymap.set('v', '<M-j>', ":m '>+1<cr>gv=gv", { desc = 'Move selected lines down' })
|
|
||||||
|
|
||||||
-- Diagnostic keymaps
|
|
||||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev)
|
|
||||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next)
|
|
||||||
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float)
|
|
||||||
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist)
|
|
||||||
|
|
||||||
-- terminal
|
|
||||||
vim.keymap.set('t', '<C-x>', vim.api.nvim_replace_termcodes('<C-\\><C-N>', true, true, true), { desc = 'Escape terminal mode' })
|
|
||||||
|
|
||||||
-- disabling highlight
|
|
||||||
vim.keymap.set('n', '<leader>hh', ':noh<CR>', { desc = 'No highlight search' })
|
|
|
@ -1,45 +0,0 @@
|
||||||
-- [[ Setting options ]]
|
|
||||||
-- See `:help vim.o`
|
|
||||||
|
|
||||||
-- disable netrw
|
|
||||||
vim.g.loaded_netrw = 1
|
|
||||||
vim.g.loaded_netrwPlugin = 1
|
|
||||||
|
|
||||||
-- Set highlight on search
|
|
||||||
vim.o.hlsearch = true
|
|
||||||
|
|
||||||
-- Make line numbers default
|
|
||||||
vim.wo.number = true
|
|
||||||
|
|
||||||
-- Make line numbers relative
|
|
||||||
vim.wo.relativenumber = true
|
|
||||||
|
|
||||||
-- Enable break indent
|
|
||||||
vim.o.breakindent = true
|
|
||||||
|
|
||||||
-- Save undo history
|
|
||||||
vim.o.undofile = true
|
|
||||||
|
|
||||||
-- Case insensitive searching UNLESS /C or capital in search
|
|
||||||
vim.o.ignorecase = true
|
|
||||||
vim.o.smartcase = true
|
|
||||||
|
|
||||||
-- Keep signcolumn on by default
|
|
||||||
vim.wo.signcolumn = 'yes'
|
|
||||||
|
|
||||||
-- Decrease update time
|
|
||||||
vim.o.updatetime = 250
|
|
||||||
vim.o.timeout = true
|
|
||||||
vim.o.timeoutlen = 300
|
|
||||||
|
|
||||||
-- Set completeopt to have a better completion experience
|
|
||||||
vim.o.completeopt = 'menuone,noselect'
|
|
||||||
|
|
||||||
vim.o.termguicolors = true
|
|
||||||
|
|
||||||
-- eol chars
|
|
||||||
vim.opt.list = true
|
|
||||||
vim.opt.listchars = {
|
|
||||||
eol = '',
|
|
||||||
tab = '<->',
|
|
||||||
}
|
|
|
@ -1,59 +0,0 @@
|
||||||
return {
|
|
||||||
'goolord/alpha-nvim',
|
|
||||||
dependencies = {
|
|
||||||
'nvim-tree/nvim-web-devicons',
|
|
||||||
},
|
|
||||||
|
|
||||||
config = function()
|
|
||||||
local alpha = require 'alpha'
|
|
||||||
local dashboard = require 'alpha.themes.dashboard'
|
|
||||||
|
|
||||||
dashboard.section.header.val = {
|
|
||||||
[[ ]],
|
|
||||||
[[ ]],
|
|
||||||
[[ ]],
|
|
||||||
[[ ]],
|
|
||||||
[[ ]],
|
|
||||||
[[ ]],
|
|
||||||
[[ ]],
|
|
||||||
[[ ]],
|
|
||||||
[[ ]],
|
|
||||||
[[ ]],
|
|
||||||
[[ ]],
|
|
||||||
[[ ]],
|
|
||||||
[[ ]],
|
|
||||||
[[ ████ ██████ █████ ██ ]],
|
|
||||||
[[ ███████████ █████ ]],
|
|
||||||
[[ █████████ ███████████████████ ███ ███████████ ]],
|
|
||||||
[[ █████████ ███ █████████████ █████ ██████████████ ]],
|
|
||||||
[[ █████████ ██████████ █████████ █████ █████ ████ █████ ]],
|
|
||||||
[[ ███████████ ███ ███ █████████ █████ █████ ████ █████ ]],
|
|
||||||
[[ ██████ █████████████████████ ████ █████ █████ ████ ██████ ]],
|
|
||||||
[[ ]],
|
|
||||||
[[ ]],
|
|
||||||
[[ ]],
|
|
||||||
}
|
|
||||||
|
|
||||||
dashboard.section.buttons.val = {
|
|
||||||
dashboard.button('e', 'New file', '<cmd>ene <CR>'),
|
|
||||||
dashboard.button('SPC s f', 'Search files'),
|
|
||||||
dashboard.button('SPC s g', 'Search grep'),
|
|
||||||
dashboard.button('SPC s r', 'Search resume'),
|
|
||||||
dashboard.button('SPC SPC', 'Open buffers'),
|
|
||||||
dashboard.button('SPC h t', 'Harpoon terminal'),
|
|
||||||
}
|
|
||||||
_Gopts = {
|
|
||||||
position = 'center',
|
|
||||||
hl = 'Type',
|
|
||||||
}
|
|
||||||
|
|
||||||
local function footer()
|
|
||||||
return os.date 'It was %H:%M:%S when this buffer was opened on %d. %m. %Y, a %A in %B.'
|
|
||||||
end
|
|
||||||
|
|
||||||
dashboard.section.footer.val = footer()
|
|
||||||
|
|
||||||
dashboard.opts.opts.noautocmd = true
|
|
||||||
alpha.setup(dashboard.opts)
|
|
||||||
end,
|
|
||||||
}
|
|
|
@ -1,7 +0,0 @@
|
||||||
return {
|
|
||||||
'projekt0n/circles.nvim',
|
|
||||||
dependencies = { 'nvim-tree/nvim-web-devicons' },
|
|
||||||
opts = {
|
|
||||||
icons = { empty = '●', filled = '○', lsp_prefix = '●' },
|
|
||||||
},
|
|
||||||
}
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
MiniDeps.now(function()
|
||||||
|
MiniDeps.add("sainnhe/gruvbox-material")
|
||||||
|
|
||||||
|
vim.o.background = "dark"
|
||||||
|
vim.g.gruvbox_material_background = "light"
|
||||||
|
vim.g.gruvbox_material_better_performance = 1
|
||||||
|
vim.g.gruvbox_material_diagnostic_line_highlight = 1
|
||||||
|
vim.g.gruvbox_material_diagnostic_virtual_text = "colored"
|
||||||
|
vim.g.gruvbox_material_enable_bold = 1
|
||||||
|
vim.g.gruvbox_material_enable_italic = 1
|
||||||
|
|
||||||
|
vim.cmd.colorscheme("gruvbox-material")
|
||||||
|
end)
|
|
@ -1,117 +0,0 @@
|
||||||
-- function Leave_snippet()
|
|
||||||
-- if
|
|
||||||
-- ((vim.v.event.old_mode == 's' and vim.v.event.new_mode == 'n') or vim.v.event.old_mode == 'i')
|
|
||||||
-- and require('luasnip').session.current_nodes[vim.api.nvim_get_current_buf()]
|
|
||||||
-- and not require('luasnip').session.jump_active
|
|
||||||
-- then
|
|
||||||
-- require('luasnip').unlink_current()
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
--
|
|
||||||
-- vim.api.nvim_command [[
|
|
||||||
-- autocmd ModeChanged * lua Leave_snippet()
|
|
||||||
-- ]]
|
|
||||||
--
|
|
||||||
-- vim.cmd 'highlight! link CmpPmenu Pmenu'
|
|
||||||
-- vim.cmd 'highlight! link CmpPmenuBorder Pmenu'
|
|
||||||
-- vim.cmd 'highlight! CmpPmenu guibg=#282828'
|
|
||||||
-- vim.cmd 'highlight! CmpPmenuBorder guifg=#615750'
|
|
||||||
|
|
||||||
return {
|
|
||||||
{
|
|
||||||
'hrsh7th/nvim-cmp',
|
|
||||||
event = 'InsertEnter',
|
|
||||||
dependencies = {
|
|
||||||
-- Snippet Engine & its associated nvim-cmp source
|
|
||||||
{
|
|
||||||
'L3MON4D3/LuaSnip',
|
|
||||||
build = (function()
|
|
||||||
-- Build Step is needed for regex support in snippets.
|
|
||||||
-- This step is not supported in many windows environments.
|
|
||||||
-- Remove the below condition to re-enable on windows.
|
|
||||||
if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
return 'make install_jsregexp'
|
|
||||||
end)(),
|
|
||||||
dependencies = {
|
|
||||||
-- `friendly-snippets` contains a variety of premade snippets.
|
|
||||||
-- See the README about individual language/framework/plugin snippets:
|
|
||||||
-- https://github.com/rafamadriz/friendly-snippets
|
|
||||||
{
|
|
||||||
'rafamadriz/friendly-snippets',
|
|
||||||
config = function()
|
|
||||||
require('luasnip.loaders.from_vscode').lazy_load()
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
'saadparwaiz1/cmp_luasnip',
|
|
||||||
|
|
||||||
-- Adds other completion capabilities.
|
|
||||||
-- nvim-cmp does not ship with all sources by default. They are split
|
|
||||||
-- into multiple repos for maintenance purposes.
|
|
||||||
'hrsh7th/cmp-nvim-lsp',
|
|
||||||
'hrsh7th/cmp-path',
|
|
||||||
},
|
|
||||||
config = function()
|
|
||||||
local cmp = require 'cmp'
|
|
||||||
local luasnip = require 'luasnip'
|
|
||||||
luasnip.config.setup {}
|
|
||||||
|
|
||||||
local border = require('utils').nvim_open_win_border
|
|
||||||
local highlight_opts = 'Normal:CmpPmenu,FloatBorder:CmpPmenuBorder,CursorLine:PmenuSel,Search:None'
|
|
||||||
|
|
||||||
cmp.setup {
|
|
||||||
snippet = {
|
|
||||||
expand = function(args)
|
|
||||||
luasnip.lsp_expand(args.body)
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
completion = { completeopt = 'menu,menuone,noinsert' },
|
|
||||||
|
|
||||||
mapping = cmp.mapping.preset.insert {
|
|
||||||
['<C-n>'] = cmp.mapping.select_next_item(),
|
|
||||||
['<C-p>'] = cmp.mapping.select_prev_item(),
|
|
||||||
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
|
||||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
|
||||||
['<C-y>'] = cmp.mapping.confirm { select = true },
|
|
||||||
['<C-Space>'] = cmp.mapping.complete {},
|
|
||||||
|
|
||||||
['<C-l>'] = cmp.mapping(function()
|
|
||||||
if luasnip.expand_or_locally_jumpable() then
|
|
||||||
luasnip.expand_or_jump()
|
|
||||||
end
|
|
||||||
end, { 'i', 's' }),
|
|
||||||
['<C-h>'] = cmp.mapping(function()
|
|
||||||
if luasnip.locally_jumpable(-1) then
|
|
||||||
luasnip.jump(-1)
|
|
||||||
end
|
|
||||||
end, { 'i', 's' }),
|
|
||||||
},
|
|
||||||
sources = {
|
|
||||||
{
|
|
||||||
name = 'lazydev',
|
|
||||||
-- set group index to 0 to skip loading LuaLS completions as lazydev recommends it
|
|
||||||
group_index = 0,
|
|
||||||
},
|
|
||||||
{ name = 'nvim_lsp' },
|
|
||||||
{ name = 'luasnip' },
|
|
||||||
{ name = 'path' },
|
|
||||||
-- { name = 'crates' },
|
|
||||||
},
|
|
||||||
window = {
|
|
||||||
completion = {
|
|
||||||
border = border 'CmpBorder',
|
|
||||||
side_padding = 1,
|
|
||||||
winhighlight = highlight_opts,
|
|
||||||
},
|
|
||||||
documentation = {
|
|
||||||
border = border 'CmpDocBorder',
|
|
||||||
winhighlight = highlight_opts,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
}
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
local now_if_args = vim.fn.argc(-1) > 0 and MiniDeps.now or MiniDeps.later
|
||||||
|
|
||||||
|
now_if_args(function()
|
||||||
|
MiniDeps.add("github/copilot.vim")
|
||||||
|
|
||||||
|
vim.g.copilot_filetypes = {
|
||||||
|
-- disable all and only allow specific filetyps
|
||||||
|
["*"] = false,
|
||||||
|
--
|
||||||
|
c = true,
|
||||||
|
cpp = true,
|
||||||
|
dockerfile = true,
|
||||||
|
go = true,
|
||||||
|
javascript = true,
|
||||||
|
lua = true,
|
||||||
|
nix = true,
|
||||||
|
python = true,
|
||||||
|
rust = true,
|
||||||
|
sh = true,
|
||||||
|
typescript = true,
|
||||||
|
}
|
||||||
|
end)
|
|
@ -0,0 +1,23 @@
|
||||||
|
MiniDeps.later(function()
|
||||||
|
MiniDeps.add("ibhagwan/fzf-lua")
|
||||||
|
|
||||||
|
local fzf = require("fzf-lua")
|
||||||
|
fzf.setup({
|
||||||
|
files = {
|
||||||
|
no_ignore = true,
|
||||||
|
toggle_ignore_flag = "--no-ignore-vcs",
|
||||||
|
},
|
||||||
|
grep = {
|
||||||
|
no_ignore = true,
|
||||||
|
toggle_ignore_flag = "--no-ignore-vcs",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<leader>sf", fzf.files)
|
||||||
|
vim.keymap.set("n", "<leader>sg", fzf.live_grep)
|
||||||
|
vim.keymap.set("n", "<leader>sw", fzf.grep_cword)
|
||||||
|
vim.keymap.set("v", "<leader>sg", fzf.grep_visual)
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<leader>sr", fzf.resume)
|
||||||
|
vim.keymap.set("n", "<leader>sb", fzf.builtin)
|
||||||
|
end)
|
|
@ -0,0 +1,11 @@
|
||||||
|
MiniDeps.later(function()
|
||||||
|
MiniDeps.add("f-person/git-blame.nvim")
|
||||||
|
require("gitblame").setup({
|
||||||
|
enabled = false,
|
||||||
|
message_template = " <sha>: <author> <date> <summary>",
|
||||||
|
date_format = "%Y-%m-%d",
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<leader>gt", ":GitBlameToggle<CR>")
|
||||||
|
vim.keymap.set("n", "<leader>gs", ":GitBlameCopySHA<CR>")
|
||||||
|
end)
|
|
@ -1,12 +0,0 @@
|
||||||
return {
|
|
||||||
-- git blame annotations
|
|
||||||
'f-person/git-blame.nvim',
|
|
||||||
init = function()
|
|
||||||
-- disable on startup
|
|
||||||
vim.g.gitblame_enabled = 0
|
|
||||||
end,
|
|
||||||
config = function()
|
|
||||||
vim.api.nvim_set_keymap('n', '<leader>gt', ':GitBlameToggle<CR>', { desc = '[G]it Blame [T]oggle', noremap = true })
|
|
||||||
vim.api.nvim_set_keymap('n', '<leader>gu', ':GitBlameOpenCommitURL<CR>', { desc = '[G]it Blame Open Commit [U]rl', noremap = true })
|
|
||||||
end,
|
|
||||||
}
|
|
|
@ -1,11 +1,10 @@
|
||||||
return {
|
MiniDeps.later(function()
|
||||||
'ruifm/gitlinker.nvim',
|
MiniDeps.add("nvim-lua/plenary.nvim")
|
||||||
config = function()
|
MiniDeps.add("ruifm/gitlinker.nvim")
|
||||||
require('gitlinker').setup {
|
require("gitlinker").setup({
|
||||||
callbacks = {
|
callbacks = {
|
||||||
['git.aflabs.org'] = require('gitlinker.hosts').get_gitlab_type_url,
|
["git.aflabs.org"] = require("gitlinker.hosts").get_gitlab_type_url,
|
||||||
['git.janezic.dev'] = require('gitlinker.hosts').get_gitea_type_url,
|
["git.janezic.dev"] = require("gitlinker.hosts").get_gitea_type_url,
|
||||||
},
|
},
|
||||||
}
|
})
|
||||||
end,
|
end)
|
||||||
}
|
|
||||||
|
|
|
@ -1,14 +1,12 @@
|
||||||
return {
|
MiniDeps.later(function()
|
||||||
-- Adds git releated signs to the gutter, as well as utilities for managing changes
|
MiniDeps.add("lewis6991/gitsigns.nvim")
|
||||||
'lewis6991/gitsigns.nvim',
|
require("gitsigns").setup({
|
||||||
opts = {
|
signs = {
|
||||||
-- See `:help gitsigns.txt`
|
add = { text = "+" },
|
||||||
signs = {
|
change = { text = "~" },
|
||||||
add = { text = '+' },
|
delete = { text = "x" },
|
||||||
change = { text = '~' },
|
topdelete = { text = "x" },
|
||||||
delete = { text = '_' },
|
changedelete = { text = "~" },
|
||||||
topdelete = { text = '‾' },
|
},
|
||||||
changedelete = { text = '~' },
|
})
|
||||||
},
|
end)
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
MiniDeps.later(function()
|
||||||
|
MiniDeps.add("nmac427/guess-indent.nvim")
|
||||||
|
require("guess-indent").setup()
|
||||||
|
end)
|
|
@ -1,24 +0,0 @@
|
||||||
return {
|
|
||||||
{
|
|
||||||
'ThePrimeagen/harpoon',
|
|
||||||
dependencies = {
|
|
||||||
'nvim-lua/plenary.nvim',
|
|
||||||
},
|
|
||||||
config = function()
|
|
||||||
local term = require 'harpoon.term'
|
|
||||||
local mark = require 'harpoon.mark'
|
|
||||||
local ui = require 'harpoon.ui'
|
|
||||||
|
|
||||||
-- add file
|
|
||||||
vim.keymap.set('n', '<leader>ha', mark.add_file, { desc = '[H]arpoon [a]dd file' })
|
|
||||||
|
|
||||||
-- open menu
|
|
||||||
vim.keymap.set('n', '<leader>he', ui.toggle_quick_menu, { desc = '[H]arpoon toggle m[e]nu' })
|
|
||||||
|
|
||||||
-- open terminal
|
|
||||||
vim.keymap.set('n', '<leader>ht', function()
|
|
||||||
term.gotoTerminal(0)
|
|
||||||
end, { desc = '[H]arpoon [t]erminal' })
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
}
|
|
|
@ -1,8 +0,0 @@
|
||||||
return {
|
|
||||||
-- Add indentation guides even on blank lines
|
|
||||||
'lukas-reineke/indent-blankline.nvim',
|
|
||||||
-- Enable `lukas-reineke/indent-blankline.nvim`
|
|
||||||
-- See `:help indent_blankline.txt`
|
|
||||||
main = 'ibl',
|
|
||||||
opts = { scope = { show_start = false, show_end = false } },
|
|
||||||
}
|
|
|
@ -1,171 +1,67 @@
|
||||||
vim.api.nvim_create_autocmd('LspAttach', {
|
MiniDeps.later(function()
|
||||||
group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }),
|
MiniDeps.add("neovim/nvim-lspconfig")
|
||||||
callback = function(event)
|
|
||||||
local map = function(keys, func, desc, mode)
|
|
||||||
mode = mode or 'n'
|
|
||||||
vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
|
|
||||||
end
|
|
||||||
|
|
||||||
map('<leader>D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition')
|
vim.lsp.enable({
|
||||||
map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction', { 'n', 'x' })
|
"pyright",
|
||||||
map('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
|
"ts_ls",
|
||||||
map('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
|
"rust_analyzer",
|
||||||
map('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
|
"clangd",
|
||||||
map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
|
"gopls",
|
||||||
map('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation')
|
"ruff",
|
||||||
map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition')
|
"stylua",
|
||||||
map('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
|
"lua_ls",
|
||||||
|
"nixd",
|
||||||
|
"nil_ls",
|
||||||
|
"docker_language_server",
|
||||||
|
})
|
||||||
|
|
||||||
local delayed_format = function()
|
vim.api.nvim_create_autocmd("LspAttach", {
|
||||||
vim.lsp.buf.format { timeout_ms = 2000 }
|
callback = function(args)
|
||||||
end
|
local client = vim.lsp.get_client_by_id(args.data.client_id)
|
||||||
|
local bufnr = args.buf
|
||||||
|
|
||||||
map('<leader>ff', delayed_format, '[F]ormat')
|
---@param keys string
|
||||||
--
|
---@param func function
|
||||||
-- -- See `:help K` for why this keymap
|
---@param desc string
|
||||||
-- nmap('K', vim.lsp.buf.hover, 'Hover Documentation')
|
---@param modes? string | table
|
||||||
-- nmap('<C-k>', vim.lsp.buf.signature_help, 'Signature Documentation')
|
local map_lsp = function(keys, func, desc, modes)
|
||||||
|
modes = modes or "n"
|
||||||
|
vim.keymap.set(
|
||||||
|
modes,
|
||||||
|
"<leader>l" .. keys,
|
||||||
|
func,
|
||||||
|
{ buffer = bufnr, desc = "lsp: " .. desc }
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
local client = vim.lsp.get_client_by_id(event.data.client_id)
|
local fzf = require("fzf-lua")
|
||||||
if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_documentHighlight) then
|
|
||||||
local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false })
|
|
||||||
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
|
|
||||||
buffer = event.buf,
|
|
||||||
group = highlight_augroup,
|
|
||||||
callback = vim.lsp.buf.document_highlight,
|
|
||||||
})
|
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, {
|
map_lsp("d", fzf.lsp_definitions, "definition")
|
||||||
buffer = event.buf,
|
map_lsp("D", fzf.lsp_declarations, "declaration")
|
||||||
group = highlight_augroup,
|
map_lsp("i", fzf.lsp_implementations, "implementation")
|
||||||
callback = vim.lsp.buf.clear_references,
|
map_lsp("r", fzf.lsp_references, "references")
|
||||||
})
|
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd('LspDetach', {
|
map_lsp("t", fzf.lsp_typedefs, "type definition")
|
||||||
group = vim.api.nvim_create_augroup('kickstart-lsp-detach', { clear = true }),
|
|
||||||
callback = function(event2)
|
map_lsp("a", fzf.lsp_code_actions, "code action", { "n", "x" })
|
||||||
vim.lsp.buf.clear_references()
|
map_lsp("n", vim.lsp.buf.rename, "rename")
|
||||||
vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight', buffer = event2.buf }
|
|
||||||
|
map_lsp("W", fzf.lsp_live_workspace_symbols, "workspace symbols")
|
||||||
|
map_lsp("L", fzf.lsp_document_symbols, "document symbols")
|
||||||
|
|
||||||
|
map_lsp("w", fzf.lsp_workspace_diagnostics, "workspace diagnostics")
|
||||||
|
map_lsp("l", fzf.lsp_document_diagnostics, "document diagnostics")
|
||||||
|
|
||||||
|
map_lsp(
|
||||||
|
"f",
|
||||||
|
function() vim.lsp.buf.format({ timeout_ms = 2000 }) end,
|
||||||
|
"format"
|
||||||
|
)
|
||||||
|
|
||||||
|
-- inlay hints
|
||||||
|
if client and client.server_capabilities.inlayHintProvider then
|
||||||
|
vim.lsp.inlay_hint.enable(true, { bufnr = bufnr })
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end
|
end)
|
||||||
|
|
||||||
if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then
|
|
||||||
map('<leader>th', function()
|
|
||||||
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf })
|
|
||||||
end, '[T]oggle Inlay [H]ints')
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
return {
|
|
||||||
{
|
|
||||||
-- LSP Configuration & Plugins
|
|
||||||
'neovim/nvim-lspconfig',
|
|
||||||
dependencies = {
|
|
||||||
|
|
||||||
-- Automatically install LSPs and related tools to stdpath for Neovim
|
|
||||||
{ 'williamboman/mason.nvim', config = true }, -- NOTE: Must be loaded before dependants
|
|
||||||
'williamboman/mason-lspconfig.nvim',
|
|
||||||
'WhoIsSethDaniel/mason-tool-installer.nvim',
|
|
||||||
|
|
||||||
-- Useful status updates for LSP.
|
|
||||||
{ 'j-hui/fidget.nvim', opts = {} },
|
|
||||||
|
|
||||||
-- Allows extra capabilities provided by nvim-cmp
|
|
||||||
'hrsh7th/cmp-nvim-lsp',
|
|
||||||
|
|
||||||
{
|
|
||||||
'mrcjkb/rustaceanvim',
|
|
||||||
version = '^4',
|
|
||||||
ft = { 'rust' },
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
-- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins
|
|
||||||
-- used for completion, annotations and signatures of Neovim apis
|
|
||||||
'folke/lazydev.nvim',
|
|
||||||
ft = 'lua',
|
|
||||||
opts = {
|
|
||||||
library = {
|
|
||||||
-- Load luvit types when the `vim.uv` word is found
|
|
||||||
{ path = 'luvit-meta/library', words = { 'vim%.uv' } },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{ 'Bilal2453/luvit-meta', lazy = true },
|
|
||||||
},
|
|
||||||
config = function()
|
|
||||||
local servers = {
|
|
||||||
clangd = {},
|
|
||||||
marksman = {},
|
|
||||||
gopls = {},
|
|
||||||
ruff = {},
|
|
||||||
pyright = {
|
|
||||||
pyright = {
|
|
||||||
disableOrganizeImports = true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
ts_ls = {},
|
|
||||||
lua_ls = {
|
|
||||||
Lua = {
|
|
||||||
workspace = { checkThirdParty = false },
|
|
||||||
telemetry = { enable = false },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
stylua = {},
|
|
||||||
}
|
|
||||||
|
|
||||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
|
||||||
capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities())
|
|
||||||
|
|
||||||
-- Setup mason so it can manage external tooling
|
|
||||||
require('mason').setup()
|
|
||||||
|
|
||||||
-- Ensure the servers above are installed
|
|
||||||
require('mason-tool-installer').setup { ensure_installed = vim.tbl_keys(servers) }
|
|
||||||
|
|
||||||
require('mason-lspconfig').setup {
|
|
||||||
handlers = {
|
|
||||||
function(server_name)
|
|
||||||
local server = servers[server_name] or {}
|
|
||||||
-- This handles overriding only values explicitly passed
|
|
||||||
-- by the server configuration above. Useful when disabling
|
|
||||||
-- certain features of an LSP (for example, turning off formatting for ts_ls)
|
|
||||||
server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
|
|
||||||
require('lspconfig')[server_name].setup(server)
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
vim.g.rustaceanvim = {
|
|
||||||
tools = {
|
|
||||||
inlay_hints = {
|
|
||||||
auto = false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
server = {
|
|
||||||
settings = {
|
|
||||||
['rust-analyzer'] = {
|
|
||||||
cargo = {
|
|
||||||
-- always enable all features
|
|
||||||
features = 'all',
|
|
||||||
},
|
|
||||||
-- use clippy on save
|
|
||||||
checkOnSave = {
|
|
||||||
command = 'clippy',
|
|
||||||
},
|
|
||||||
-- leave rainbow higlight to plugin
|
|
||||||
rainbowHighlightOn = false,
|
|
||||||
useLibraryCodeForTypes = true,
|
|
||||||
autoSearchPaths = true,
|
|
||||||
autoImportCompletions = false,
|
|
||||||
reportMissingImports = true,
|
|
||||||
followImportForHints = true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
return {
|
|
||||||
'nvim-lualine/lualine.nvim',
|
|
||||||
opts = {
|
|
||||||
options = {
|
|
||||||
icons_enabled = false,
|
|
||||||
theme = 'gruvbox-material',
|
|
||||||
statusline_style = 'mix',
|
|
||||||
component_separators = '|',
|
|
||||||
section_separators = '',
|
|
||||||
},
|
|
||||||
sections = {
|
|
||||||
lualine_c = {
|
|
||||||
{
|
|
||||||
'filename',
|
|
||||||
file_status = true,
|
|
||||||
path = 1,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
MiniDeps.now(function()
|
||||||
|
local clue = require("mini.clue")
|
||||||
|
clue.setup({
|
||||||
|
triggers = {
|
||||||
|
-- Leader triggers
|
||||||
|
{ mode = "n", keys = "<Leader>" },
|
||||||
|
{ mode = "x", keys = "<Leader>" },
|
||||||
|
|
||||||
|
-- Built-in completion
|
||||||
|
{ mode = "i", keys = "<C-x>" },
|
||||||
|
|
||||||
|
-- `g` key
|
||||||
|
{ mode = "n", keys = "g" },
|
||||||
|
{ mode = "x", keys = "g" },
|
||||||
|
|
||||||
|
-- Marks
|
||||||
|
{ mode = "n", keys = "'" },
|
||||||
|
{ mode = "n", keys = "`" },
|
||||||
|
{ mode = "x", keys = "'" },
|
||||||
|
{ mode = "x", keys = "`" },
|
||||||
|
|
||||||
|
-- Registers
|
||||||
|
{ mode = "n", keys = '"' },
|
||||||
|
{ mode = "x", keys = '"' },
|
||||||
|
{ mode = "i", keys = "<C-r>" },
|
||||||
|
{ mode = "c", keys = "<C-r>" },
|
||||||
|
|
||||||
|
-- Window commands
|
||||||
|
{ mode = "n", keys = "<C-w>" },
|
||||||
|
|
||||||
|
-- `z` key
|
||||||
|
{ mode = "n", keys = "z" },
|
||||||
|
{ mode = "x", keys = "z" },
|
||||||
|
},
|
||||||
|
|
||||||
|
clues = {
|
||||||
|
-- Enhance this by adding descriptions for <Leader> mapping groups
|
||||||
|
clue.gen_clues.builtin_completion(),
|
||||||
|
clue.gen_clues.g(),
|
||||||
|
clue.gen_clues.marks(),
|
||||||
|
clue.gen_clues.registers(),
|
||||||
|
clue.gen_clues.windows(),
|
||||||
|
clue.gen_clues.z(),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end)
|
|
@ -0,0 +1,15 @@
|
||||||
|
MiniDeps.later(function()
|
||||||
|
require("mini.completion").setup({
|
||||||
|
lsp_completion = {
|
||||||
|
-- `source_func` should be one of 'completefunc' or 'omnifunc'.
|
||||||
|
source_func = "omnifunc",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("LspAttach", {
|
||||||
|
callback = function(args)
|
||||||
|
vim.bo[args.buf].omnifunc = "v:lua.MiniCompletion.completefunc_lsp"
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
vim.lsp.config("*", { capabilities = MiniCompletion.get_lsp_capabilities() })
|
||||||
|
end)
|
|
@ -0,0 +1,5 @@
|
||||||
|
MiniDeps.now(function()
|
||||||
|
require("mini.icons").setup()
|
||||||
|
MiniIcons.mock_nvim_web_devicons()
|
||||||
|
MiniIcons.tweak_lsp_kind()
|
||||||
|
end)
|
|
@ -0,0 +1,10 @@
|
||||||
|
MiniDeps.later(
|
||||||
|
function()
|
||||||
|
require("mini.indentscope").setup({
|
||||||
|
draw = {
|
||||||
|
delay = 0,
|
||||||
|
animation = require("mini.indentscope").gen_animation.none(),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end
|
||||||
|
)
|
|
@ -0,0 +1,4 @@
|
||||||
|
MiniDeps.now(function()
|
||||||
|
require("mini.notify").setup()
|
||||||
|
vim.notify = MiniNotify.make_notify()
|
||||||
|
end)
|
|
@ -0,0 +1 @@
|
||||||
|
MiniDeps.later(function() require("mini.pairs").setup() end)
|
|
@ -0,0 +1,13 @@
|
||||||
|
MiniDeps.later(function()
|
||||||
|
local gen_loader = require("mini.snippets").gen_loader
|
||||||
|
require("mini.snippets").setup({
|
||||||
|
snippets = {
|
||||||
|
-- Load custom file with global snippets first (adjust for Windows)
|
||||||
|
gen_loader.from_file("~/.config/nvim/snippets/global.json"),
|
||||||
|
|
||||||
|
-- Load snippets based on current language by reading files from
|
||||||
|
-- "snippets/" subdirectories from 'runtimepath' directories.
|
||||||
|
gen_loader.from_lang(),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end)
|
|
@ -0,0 +1,35 @@
|
||||||
|
local function default_header()
|
||||||
|
local hour = tonumber(vim.fn.strftime("%H"))
|
||||||
|
local part_id = math.floor((hour + 4) / 8) + 1
|
||||||
|
local day_part = ({ "evening", "morning", "afternoon", "evening" })[part_id]
|
||||||
|
local username = vim.loop.os_get_passwd()["username"] or "USERNAME"
|
||||||
|
|
||||||
|
return ("good %s, %s"):format(day_part, username)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function reinstall_treesitter()
|
||||||
|
local ts = require("nvim-treesitter")
|
||||||
|
ts.install(ts.get_installed(), { force = true })
|
||||||
|
end
|
||||||
|
|
||||||
|
MiniDeps.now(function()
|
||||||
|
require("mini.starter").setup({
|
||||||
|
query_updaters = "abcdefghijklmnopqrstuvwxyz0123456789_.",
|
||||||
|
evaluate_single = true,
|
||||||
|
header = default_header,
|
||||||
|
footer = "",
|
||||||
|
items = {
|
||||||
|
--stylua: ignore start
|
||||||
|
-- builtins
|
||||||
|
{ name = "edit new buffer", action = "enew", section = "builtin actions" },
|
||||||
|
{ name = "quit neovim", action = "qall", section = "builtin actions" },
|
||||||
|
-- dependencies
|
||||||
|
{ name = "update dependencies", action = "DepsUpdate", section = "dependencies" },
|
||||||
|
{ name = "snap dependencies", action = "DepsSnapSave", section = "dependencies" },
|
||||||
|
{ name = "load dependencies", action = "DepsSnapLoad", section = "dependencies" },
|
||||||
|
-- debug
|
||||||
|
{ name = "reinstall treesitter parsers", action = reinstall_treesitter, section = "debug" },
|
||||||
|
--stylua: ignore end
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end)
|
|
@ -0,0 +1 @@
|
||||||
|
MiniDeps.now(function() require("mini.statusline").setup() end)
|
|
@ -1,6 +0,0 @@
|
||||||
return {
|
|
||||||
'danymat/neogen',
|
|
||||||
config = true,
|
|
||||||
-- Uncomment next line if you want to follow only stable versions
|
|
||||||
-- version = "*"
|
|
||||||
}
|
|
|
@ -1,23 +0,0 @@
|
||||||
return {
|
|
||||||
-- inject lsp formatting, diagonstics etc
|
|
||||||
'nvimtools/none-ls.nvim',
|
|
||||||
dependencies = {
|
|
||||||
'nvim-lua/plenary.nvim',
|
|
||||||
},
|
|
||||||
config = function()
|
|
||||||
local none_ls = require 'null-ls'
|
|
||||||
|
|
||||||
none_ls.setup {
|
|
||||||
sources = {
|
|
||||||
-- general
|
|
||||||
none_ls.builtins.code_actions.gitsigns,
|
|
||||||
-- python
|
|
||||||
-- none_ls.builtins.formatting.black,
|
|
||||||
-- typescript
|
|
||||||
none_ls.builtins.formatting.prettier,
|
|
||||||
-- lua
|
|
||||||
none_ls.builtins.formatting.stylua,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
}
|
|
|
@ -1,8 +1,5 @@
|
||||||
return {
|
MiniDeps.later(function()
|
||||||
'stevearc/oil.nvim',
|
MiniDeps.add("stevearc/oil.nvim")
|
||||||
dependencies = { 'nvim-tree/nvim-web-devicons' },
|
require("oil").setup({ view_options = { show_hidden = true } })
|
||||||
config = function()
|
vim.keymap.set("n", "-", require("oil").open, { desc = "Open parent directory" })
|
||||||
require('oil').setup { view_options = { show_hidden = true } }
|
end)
|
||||||
vim.keymap.set('n', '-', require('oil').open, { desc = 'Open parent directory' })
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
return {
|
|
||||||
'HiPhish/rainbow-delimiters.nvim',
|
|
||||||
}
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
MiniDeps.later(function()
|
||||||
|
MiniDeps.add("HiPhish/rainbow-delimiters.nvim")
|
||||||
|
require("rainbow-delimiters.setup").setup()
|
||||||
|
end)
|
|
@ -1,75 +0,0 @@
|
||||||
return {
|
|
||||||
|
|
||||||
{
|
|
||||||
-- Fuzzy Finder (files, lsp, etc)
|
|
||||||
'nvim-telescope/telescope.nvim',
|
|
||||||
branch = '0.1.x',
|
|
||||||
dependencies = {
|
|
||||||
'nvim-lua/plenary.nvim',
|
|
||||||
{
|
|
||||||
'nvim-telescope/telescope-fzf-native.nvim',
|
|
||||||
build = 'make',
|
|
||||||
cond = function()
|
|
||||||
return vim.fn.executable 'make' == 1
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
config = function()
|
|
||||||
local telescopeConfig = require 'telescope.config'
|
|
||||||
|
|
||||||
-- Clone the default Telescope configuration
|
|
||||||
local vimgrep_arguments = { unpack(telescopeConfig.values.vimgrep_arguments) }
|
|
||||||
|
|
||||||
-- I want to search in hidden/dot files.
|
|
||||||
table.insert(vimgrep_arguments, '--hidden')
|
|
||||||
-- I don't want to respect .gitignore but do want to respect .ignore
|
|
||||||
table.insert(vimgrep_arguments, '--no-ignore-vcs')
|
|
||||||
-- I don't want to search in the `.git` directory.
|
|
||||||
table.insert(vimgrep_arguments, '--glob')
|
|
||||||
table.insert(vimgrep_arguments, '!**/.git/*')
|
|
||||||
|
|
||||||
local rg_defaults = { 'rg', '-S', '--hidden', '--no-ignore-vcs', '--glob', '!**/.git/*' }
|
|
||||||
|
|
||||||
local find_command = { unpack(rg_defaults) }
|
|
||||||
table.insert(find_command, '--files')
|
|
||||||
|
|
||||||
local grep_command = { unpack(rg_defaults) }
|
|
||||||
table.insert(grep_command, '--color=never')
|
|
||||||
table.insert(grep_command, '--no-heading')
|
|
||||||
table.insert(grep_command, '--with-filename')
|
|
||||||
table.insert(grep_command, '--line-number')
|
|
||||||
table.insert(grep_command, '--column')
|
|
||||||
|
|
||||||
-- [[ Configure Telescope ]]
|
|
||||||
-- See `:help telescope` and `:help telescope.setup()`
|
|
||||||
require('telescope').setup {
|
|
||||||
defaults = {
|
|
||||||
vimgrep_arguments = vimgrep_arguments,
|
|
||||||
},
|
|
||||||
pickers = {
|
|
||||||
find_files = {
|
|
||||||
find_command = find_command,
|
|
||||||
},
|
|
||||||
live_grep = {
|
|
||||||
grep_command = grep_command,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Enable telescope fzf native, if installed
|
|
||||||
pcall(require('telescope').load_extension, 'fzf')
|
|
||||||
|
|
||||||
-- See `:help telescope.builtin`
|
|
||||||
vim.keymap.set('n', '<leader>?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' })
|
|
||||||
vim.keymap.set('n', '<leader><space>', require('telescope.builtin').buffers, { desc = '[ ] Find existing buffers' })
|
|
||||||
|
|
||||||
vim.keymap.set('n', '<leader>sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' })
|
|
||||||
vim.keymap.set('n', '<leader>sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' })
|
|
||||||
vim.keymap.set('n', '<leader>sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' })
|
|
||||||
vim.keymap.set('n', '<leader>sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' })
|
|
||||||
vim.keymap.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' })
|
|
||||||
vim.keymap.set('n', '<leader>ss', require('telescope.builtin').spell_suggest, { desc = '[S]pell [S]suggest' })
|
|
||||||
vim.keymap.set('n', '<leader>sr', require('telescope.builtin').resume, { desc = '[S]earch [R]esume' })
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
}
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
MiniDeps.now(function()
|
||||||
|
MiniDeps.add("folke/todo-comments.nvim")
|
||||||
|
MiniDeps.add("nvim-lua/plenary.nvim")
|
||||||
|
require("todo-comments").setup()
|
||||||
|
end)
|
|
@ -1,89 +1,34 @@
|
||||||
return {
|
local now_if_args = vim.fn.argc(-1) > 0 and MiniDeps.now or MiniDeps.later
|
||||||
-- Highlight, edit, and navigate code
|
|
||||||
'nvim-treesitter/nvim-treesitter',
|
|
||||||
dependencies = { 'nvim-treesitter/nvim-treesitter-textobjects' },
|
|
||||||
config = function()
|
|
||||||
pcall(require('nvim-treesitter.install').update { with_sync = true })
|
|
||||||
|
|
||||||
-- [[ Configure Treesitter ]]
|
now_if_args(function()
|
||||||
-- See `:help nvim-treesitter`
|
MiniDeps.add({
|
||||||
vim.defer_fn(function()
|
source = "nvim-treesitter/nvim-treesitter",
|
||||||
require('nvim-treesitter.configs').setup {
|
checkout = "main",
|
||||||
-- Add languages to be installed here that you want installed for treesitter
|
hooks = { post_checkout = function() vim.cmd("TSUpdate") end },
|
||||||
ensure_installed = {
|
})
|
||||||
'c',
|
|
||||||
'cpp',
|
|
||||||
'go',
|
|
||||||
'lua',
|
|
||||||
'python',
|
|
||||||
'rust',
|
|
||||||
'tsx',
|
|
||||||
'typescript',
|
|
||||||
'vimdoc',
|
|
||||||
'vim',
|
|
||||||
'markdown',
|
|
||||||
},
|
|
||||||
|
|
||||||
-- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
|
require("nvim-treesitter").install({
|
||||||
auto_install = true,
|
"bash",
|
||||||
|
"c",
|
||||||
|
"cpp",
|
||||||
|
"css",
|
||||||
|
"diff",
|
||||||
|
"go",
|
||||||
|
"html",
|
||||||
|
"javascript",
|
||||||
|
"json",
|
||||||
|
"python",
|
||||||
|
"regex",
|
||||||
|
"rust",
|
||||||
|
"toml",
|
||||||
|
"tsx",
|
||||||
|
"yaml",
|
||||||
|
"lua",
|
||||||
|
"luadoc",
|
||||||
|
"gitcommit",
|
||||||
|
})
|
||||||
|
|
||||||
highlight = { enable = true },
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
indent = { enable = true },
|
callback = function(args) pcall(vim.treesitter.start, args.buf) end,
|
||||||
incremental_selection = {
|
})
|
||||||
enable = true,
|
end)
|
||||||
keymaps = {
|
|
||||||
init_selection = '<c-space>',
|
|
||||||
node_incremental = '<c-space>',
|
|
||||||
scope_incremental = '<c-M-space>',
|
|
||||||
node_decremental = '<c-bslash>',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
-- textobjects
|
|
||||||
textobjects = {
|
|
||||||
select = {
|
|
||||||
enable = true,
|
|
||||||
lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
|
|
||||||
keymaps = {
|
|
||||||
-- You can use the capture groups defined in textobjects.scm
|
|
||||||
['aa'] = '@parameter.outer',
|
|
||||||
['ia'] = '@parameter.inner',
|
|
||||||
['af'] = '@function.outer',
|
|
||||||
['if'] = '@function.inner',
|
|
||||||
['ac'] = '@class.outer',
|
|
||||||
['ic'] = '@class.inner',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
move = {
|
|
||||||
enable = true,
|
|
||||||
set_jumps = true, -- whether to set jumps in the jumplist
|
|
||||||
goto_next_start = {
|
|
||||||
[']m'] = '@function.outer',
|
|
||||||
[']]'] = '@class.outer',
|
|
||||||
},
|
|
||||||
goto_next_end = {
|
|
||||||
[']M'] = '@function.outer',
|
|
||||||
[']['] = '@class.outer',
|
|
||||||
},
|
|
||||||
goto_previous_start = {
|
|
||||||
['[m'] = '@function.outer',
|
|
||||||
['[['] = '@class.outer',
|
|
||||||
},
|
|
||||||
goto_previous_end = {
|
|
||||||
['[M'] = '@function.outer',
|
|
||||||
['[]'] = '@class.outer',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
swap = {
|
|
||||||
enable = true,
|
|
||||||
swap_next = {
|
|
||||||
['<leader>a'] = '@parameter.inner',
|
|
||||||
},
|
|
||||||
swap_previous = {
|
|
||||||
['<leader>A'] = '@parameter.inner',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
end, 0)
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
local M = {}
|
|
||||||
|
|
||||||
M.nvim_open_win_border = function(hl_name)
|
|
||||||
return {
|
|
||||||
{ '┌', hl_name },
|
|
||||||
{ '─', hl_name },
|
|
||||||
{ '┐', hl_name },
|
|
||||||
{ '│', hl_name },
|
|
||||||
{ '┘', hl_name },
|
|
||||||
{ '─', hl_name },
|
|
||||||
{ '└', hl_name },
|
|
||||||
{ '│', hl_name },
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
return M
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
return {
|
||||||
|
["copilot.vim"] = "da369d90cfd6c396b1d0ec259836a1c7222fb2ea",
|
||||||
|
["fzf-lua"] = "db3ccffe79480543d8e0f7b0cac0d9b220f9486e",
|
||||||
|
["git-blame.nvim"] = "54da04264ec5313d602aebea7c5dc90141696ad7",
|
||||||
|
["gitlinker.nvim"] = "cc59f732f3d043b626c8702cb725c82e54d35c25",
|
||||||
|
["gitsigns.nvim"] = "1ee5c1fd068c81f9dd06483e639c2aa4587dc197",
|
||||||
|
["gruvbox-material"] = "834dbf21836862300ced7444db4262b796330ab7",
|
||||||
|
["guess-indent.nvim"] = "84a4987ff36798c2fc1169cbaff67960aed9776f",
|
||||||
|
["mini.nvim"] = "5e1dd6e3d5f758eccf6c51461559da785dba688c",
|
||||||
|
["nvim-lspconfig"] = "ac98db2f9f06a56498ec890a96928774eae412c3",
|
||||||
|
["nvim-treesitter"] = "0606c7a9dcaa5c5beee0b0f09043e9fdd1ba0a68",
|
||||||
|
["oil.nvim"] = "919e155fdf38e9148cdb5304faaaf53c20d703ea",
|
||||||
|
["plenary.nvim"] = "b9fd5226c2f76c951fc8ed5923d85e4de065e509",
|
||||||
|
["rainbow-delimiters.nvim"] = "3277ad5f96eb03c9d618c88e24f683e4364e578c",
|
||||||
|
["todo-comments.nvim"] = "19d461ddd543e938eb22505fb03fa878800270b6"
|
||||||
|
}
|
|
@ -0,0 +1,44 @@
|
||||||
|
---@class TermBuf
|
||||||
|
---@field buf_id integer
|
||||||
|
---@field term_id integer
|
||||||
|
|
||||||
|
---@type table<number, TermBuf>
|
||||||
|
local state = {}
|
||||||
|
|
||||||
|
---@param n integer
|
||||||
|
local function get_from_state(n)
|
||||||
|
local term_buf = state[n]
|
||||||
|
if term_buf ~= nil and vim.api.nvim_buf_is_valid(term_buf.buf_id) then
|
||||||
|
return term_buf
|
||||||
|
end
|
||||||
|
|
||||||
|
state[n] = nil
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param n integer
|
||||||
|
local function get_or_create_term(n)
|
||||||
|
if get_from_state(n) ~= nil then
|
||||||
|
vim.api.nvim_win_set_buf(0, state[n].buf_id)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.cmd.terminal()
|
||||||
|
local buf_id = vim.api.nvim_get_current_buf()
|
||||||
|
local term_id = vim.b.terminal_job_id
|
||||||
|
vim.cmd.startinsert()
|
||||||
|
|
||||||
|
state[n] = { buf_id = buf_id, term_id = term_id }
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param f function
|
||||||
|
local function count_fn(f)
|
||||||
|
local function wrap(...)
|
||||||
|
local count = vim.v.count
|
||||||
|
return f(count, arg)
|
||||||
|
end
|
||||||
|
|
||||||
|
return wrap
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<leader>tn", count_fn(get_or_create_term))
|
Loading…
Reference in New Issue