Added base folke setup
This commit is contained in:
parent
1afab44385
commit
efc511cbcf
7
init.lua
7
init.lua
@ -1,6 +1,11 @@
|
||||
local util = require("util")
|
||||
|
||||
util.require("config.options")
|
||||
|
||||
vim.schedule(function()
|
||||
util.packer_deferred()
|
||||
util.packer_defered()
|
||||
util.version()
|
||||
util.require("config.mappings")
|
||||
util.require("config.commands")
|
||||
util.require("config.plugins")
|
||||
end)
|
||||
|
21
lua/config/commands.lua
Normal file
21
lua/config/commands.lua
Normal file
@ -0,0 +1,21 @@
|
||||
-- Check if we need to reload the file when it changed
|
||||
vim.cmd("au FocusGained * :checktime")
|
||||
|
||||
-- show cursor line only in active window
|
||||
vim.cmd([[
|
||||
autocmd InsertLeave,WinEnter * set cursorline
|
||||
autocmd InsertEnter,WinLeave * set nocursorline
|
||||
]])
|
||||
|
||||
-- create directories when needed, when saving a file
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
group = vim.api.nvim_create_augroup("auto_create_dir", { clear = true }),
|
||||
command = [[call mkdir(expand('<afile>:p:h'), 'p')]],
|
||||
})
|
||||
|
||||
-- Highlight on yank
|
||||
vim.cmd("au TextYankPost * lua vim.highlight.on_yank {}")
|
||||
|
||||
-- windows to close with "q"
|
||||
vim.cmd([[autocmd FileType help,startuptime,qf,lspinfo nnoremap <buffer><silent> q :close<CR>]])
|
||||
vim.cmd([[autocmd FileType man nnoremap <buffer><silent> q :quit<CR>]])
|
275
lua/config/mappings.lua
Normal file
275
lua/config/mappings.lua
Normal file
@ -0,0 +1,275 @@
|
||||
---@diagnostic disable: missing-parameter
|
||||
|
||||
local wk = require("which-key")
|
||||
local util = require("util")
|
||||
|
||||
vim.o.timeoutlen = 300
|
||||
|
||||
wk.setup({
|
||||
show_help = false,
|
||||
triggers = "auto",
|
||||
plugins = { spelling = true },
|
||||
key_labels = { ["<leader>"] = "SPC" },
|
||||
})
|
||||
|
||||
-- Move to window using the <ctrl> movement keys
|
||||
vim.keymap.set("n", "<left>", "<C-w>h")
|
||||
vim.keymap.set("n", "<down>", "<C-w>j")
|
||||
vim.keymap.set("n", "<up>", "<C-w>k")
|
||||
vim.keymap.set("n", "<right>", "<C-w>l")
|
||||
|
||||
-- Resize window using <ctrl> arrow keys
|
||||
vim.keymap.set("n", "<S-Up>", "<cmd>resize +2<CR>")
|
||||
vim.keymap.set("n", "<S-Down>", "<cmd>resize -2<CR>")
|
||||
vim.keymap.set("n", "<S-Left>", "<cmd>vertical resize -2<CR>")
|
||||
vim.keymap.set("n", "<S-Right>", "<cmd>vertical resize +2<CR>")
|
||||
|
||||
-- Move Lines
|
||||
vim.keymap.set("n", "<A-j>", ":m .+1<CR>==")
|
||||
vim.keymap.set("v", "<A-j>", ":m '>+1<CR>gv=gv")
|
||||
vim.keymap.set("i", "<A-j>", "<Esc>:m .+1<CR>==gi")
|
||||
vim.keymap.set("n", "<A-k>", ":m .-2<CR>==")
|
||||
vim.keymap.set("v", "<A-k>", ":m '<-2<CR>gv=gv")
|
||||
vim.keymap.set("i", "<A-k>", "<Esc>:m .-2<CR>==gi")
|
||||
|
||||
-- Switch buffers with tab
|
||||
vim.keymap.set("n", "<C-Left>", "<cmd>bprevious<cr>")
|
||||
vim.keymap.set("n", "<C-Right>", "<cmd>bnext<cr>")
|
||||
|
||||
-- Easier pasting
|
||||
vim.keymap.set("n", "[p", ":pu!<cr>")
|
||||
vim.keymap.set("n", "]p", ":pu<cr>")
|
||||
|
||||
-- Clear search with <esc>
|
||||
vim.keymap.set("", "<esc>", ":noh<esc>")
|
||||
vim.keymap.set("n", "gw", "*N")
|
||||
vim.keymap.set("x", "gw", "*N")
|
||||
|
||||
-- https://github.com/mhinz/vim-galore#saner-behavior-of-n-and-n
|
||||
vim.keymap.set("n", "n", "'Nn'[v:searchforward]", { expr = true })
|
||||
vim.keymap.set("x", "n", "'Nn'[v:searchforward]", { expr = true })
|
||||
vim.keymap.set("o", "n", "'Nn'[v:searchforward]", { expr = true })
|
||||
vim.keymap.set("n", "N", "'nN'[v:searchforward]", { expr = true })
|
||||
vim.keymap.set("x", "N", "'nN'[v:searchforward]", { expr = true })
|
||||
vim.keymap.set("o", "N", "'nN'[v:searchforward]", { expr = true })
|
||||
|
||||
-- Add undo break-points
|
||||
vim.keymap.set("i", ",", ",<c-g>u")
|
||||
vim.keymap.set("i", ".", ".<c-g>u")
|
||||
vim.keymap.set("i", ";", ";<c-g>u")
|
||||
|
||||
-- save in insert mode
|
||||
vim.keymap.set("i", "<C-s>", "<cmd>:w<cr><esc>")
|
||||
vim.keymap.set("n", "<C-s>", "<cmd>:w<cr><esc>")
|
||||
vim.keymap.set("n", "<C-c>", "<cmd>normal ciw<cr>a")
|
||||
|
||||
-- telescope <ctrl-r> in command line
|
||||
-- vim.cmd([[cmap <C-R> <Plug>(TelescopeFuzzyCommandSearch)]])
|
||||
|
||||
-- better indenting
|
||||
vim.keymap.set("v", "<", "<gv")
|
||||
vim.keymap.set("v", ">", ">gv")
|
||||
|
||||
vim.keymap.set("n", "<space>cu", function()
|
||||
local number = math.random(math.pow(2, 127) + 1, math.pow(2, 128))
|
||||
return "i" .. string.format("%.0f", number)
|
||||
end, {
|
||||
expr = true,
|
||||
desc = "GUID",
|
||||
})
|
||||
|
||||
-- makes * and # work on visual mode too.
|
||||
vim.cmd([[
|
||||
function! g:VSetSearch(cmdtype)
|
||||
let temp = @s
|
||||
norm! gv"sy
|
||||
let @/ = '\V' . substitute(escape(@s, a:cmdtype.'\'), '\n', '\\n', 'g')
|
||||
let @s = temp
|
||||
endfunction
|
||||
xnoremap * :<C-u>call g:VSetSearch('/')<CR>/<C-R>=@/<CR><CR>
|
||||
xnoremap # :<C-u>call g:VSetSearch('?')<CR>?<C-R>=@/<CR><CR>
|
||||
]])
|
||||
|
||||
local leader = {
|
||||
["w"] = {
|
||||
name = "+windows",
|
||||
["w"] = { "<C-W>p", "other-window" },
|
||||
["d"] = { "<C-W>c", "delete-window" },
|
||||
["-"] = { "<C-W>s", "split-window-below" },
|
||||
["|"] = { "<C-W>v", "split-window-right" },
|
||||
["2"] = { "<C-W>v", "layout-double-columns" },
|
||||
["h"] = { "<C-W>h", "window-left" },
|
||||
["j"] = { "<C-W>j", "window-below" },
|
||||
["l"] = { "<C-W>l", "window-right" },
|
||||
["k"] = { "<C-W>k", "window-up" },
|
||||
["H"] = { "<C-W>5<", "expand-window-left" },
|
||||
["J"] = { ":resize +5", "expand-window-below" },
|
||||
["L"] = { "<C-W>5>", "expand-window-right" },
|
||||
["K"] = { ":resize -5", "expand-window-up" },
|
||||
["="] = { "<C-W>=", "balance-window" },
|
||||
["s"] = { "<C-W>s", "split-window-below" },
|
||||
["v"] = { "<C-W>v", "split-window-right" },
|
||||
},
|
||||
c = {
|
||||
name = "+code",
|
||||
},
|
||||
b = {
|
||||
name = "+buffer",
|
||||
["b"] = { "<cmd>:e #<cr>", "Switch to Other Buffer" },
|
||||
["p"] = { "<cmd>:BufferLineCyclePrev<CR>", "Previous Buffer" },
|
||||
["["] = { "<cmd>:BufferLineCyclePrev<CR>", "Previous Buffer" },
|
||||
["n"] = { "<cmd>:BufferLineCycleNext<CR>", "Next Buffer" },
|
||||
["]"] = { "<cmd>:BufferLineCycleNext<CR>", "Next Buffer" },
|
||||
["d"] = { "<cmd>:Bdelete<CR>", "Delete Buffer" },
|
||||
["D"] = { "<cmd>:bd<CR>", "Delete Buffer & Window" },
|
||||
},
|
||||
g = {
|
||||
name = "+git",
|
||||
l = {
|
||||
function()
|
||||
require("util").float_terminal("lazygit")
|
||||
end,
|
||||
"LazyGit",
|
||||
},
|
||||
c = { "<Cmd>Telescope git_commits<CR>", "commits" },
|
||||
b = { "<Cmd>Telescope git_branches<CR>", "branches" },
|
||||
s = { "<Cmd>Telescope git_status<CR>", "status" },
|
||||
d = { "<cmd>DiffviewOpen<cr>", "DiffView" },
|
||||
h = { name = "+hunk" },
|
||||
},
|
||||
["h"] = {
|
||||
name = "+help",
|
||||
t = { "<cmd>:Telescope builtin<cr>", "Telescope" },
|
||||
c = { "<cmd>:Telescope commands<cr>", "Commands" },
|
||||
h = { "<cmd>:Telescope help_tags<cr>", "Help Pages" },
|
||||
m = { "<cmd>:Telescope man_pages<cr>", "Man Pages" },
|
||||
k = { "<cmd>:Telescope keymaps<cr>", "Key Maps" },
|
||||
s = { "<cmd>:Telescope highlights<cr>", "Search Highlight Groups" },
|
||||
l = { [[<cmd>TSHighlightCapturesUnderCursor<cr>]], "Highlight Groups at cursor" },
|
||||
f = { "<cmd>:Telescope filetypes<cr>", "File Types" },
|
||||
o = { "<cmd>:Telescope vim_options<cr>", "Options" },
|
||||
a = { "<cmd>:Telescope autocommands<cr>", "Auto Commands" },
|
||||
p = {
|
||||
name = "+packer",
|
||||
p = { "<cmd>PackerSync<cr>", "Sync" },
|
||||
s = { "<cmd>PackerStatus<cr>", "Status" },
|
||||
i = { "<cmd>PackerInstall<cr>", "Install" },
|
||||
c = { "<cmd>PackerCompile<cr>", "Compile" },
|
||||
},
|
||||
},
|
||||
s = {
|
||||
name = "+search",
|
||||
g = { "<cmd>Telescope live_grep<cr>", "Grep" },
|
||||
b = { "<cmd>Telescope current_buffer_fuzzy_find<cr>", "Buffer" },
|
||||
s = {
|
||||
function()
|
||||
require("telescope.builtin").lsp_document_symbols({
|
||||
symbols = { "Class", "Function", "Method", "Constructor", "Interface", "Module", "Struct", "Trait" },
|
||||
})
|
||||
end,
|
||||
"Goto Symbol",
|
||||
},
|
||||
h = { "<cmd>Telescope command_history<cr>", "Command History" },
|
||||
m = { "<cmd>Telescope marks<cr>", "Jump to Mark" },
|
||||
r = { "<cmd>lua require('spectre').open()<CR>", "Replace (Spectre)" },
|
||||
},
|
||||
f = {
|
||||
name = "+file",
|
||||
t = { "<cmd>Neotree toggle<cr>", "NeoTree" },
|
||||
f = { "<cmd>Telescope find_files<cr>", "Find File" },
|
||||
r = { "<cmd>Telescope oldfiles<cr>", "Open Recent File" },
|
||||
n = { "<cmd>enew<cr>", "New File" },
|
||||
z = "Zoxide",
|
||||
d = "Dot Files",
|
||||
},
|
||||
o = {
|
||||
name = "+open",
|
||||
p = { "<cmd>MarkdownPreview<cr>", "Markdown Preview" },
|
||||
g = { "<cmd>Glow<cr>", "Markdown Glow" },
|
||||
n = { "<cmd>lua require('github-notifications.menu').notifications()<cr>", "GitHub Notifications" },
|
||||
},
|
||||
p = {
|
||||
name = "+project",
|
||||
p = "Open Project",
|
||||
b = { ":Telescope file_browser cwd=~/projects<CR>", "Browse ~/projects" },
|
||||
},
|
||||
t = {
|
||||
name = "toggle",
|
||||
f = {
|
||||
require("plugins.lsp.formatting").toggle,
|
||||
"Format on Save",
|
||||
},
|
||||
s = {
|
||||
function()
|
||||
util.toggle("spell")
|
||||
end,
|
||||
"Spelling",
|
||||
},
|
||||
w = {
|
||||
function()
|
||||
util.toggle("wrap")
|
||||
end,
|
||||
"Word Wrap",
|
||||
},
|
||||
n = {
|
||||
function()
|
||||
util.toggle("relativenumber", true)
|
||||
util.toggle("number")
|
||||
end,
|
||||
"Line Numbers",
|
||||
},
|
||||
},
|
||||
["<tab>"] = {
|
||||
name = "tabs",
|
||||
["<tab>"] = { "<cmd>tabnew<CR>", "New Tab" },
|
||||
n = { "<cmd>tabnext<CR>", "Next" },
|
||||
d = { "<cmd>tabclose<CR>", "Close" },
|
||||
p = { "<cmd>tabprevious<CR>", "Previous" },
|
||||
["]"] = { "<cmd>tabnext<CR>", "Next" },
|
||||
["["] = { "<cmd>tabprevious<CR>", "Previous" },
|
||||
f = { "<cmd>tabfirst<CR>", "First" },
|
||||
l = { "<cmd>tablast<CR>", "Last" },
|
||||
},
|
||||
["`"] = { "<cmd>:e #<cr>", "Switch to Other Buffer" },
|
||||
[" "] = "Find File",
|
||||
["."] = { ":Telescope file_browser<CR>", "Browse Files" },
|
||||
[","] = { "<cmd>Telescope buffers show_all_buffers=true<cr>", "Switch Buffer" },
|
||||
["/"] = { "<cmd>Telescope live_grep<cr>", "Search" },
|
||||
[":"] = { "<cmd>Telescope command_history<cr>", "Command History" },
|
||||
["C"] = {
|
||||
function()
|
||||
util.clipman()
|
||||
end,
|
||||
"Paste from Clipman",
|
||||
},
|
||||
["P"] = {
|
||||
":Telescope neoclip plus<CR>",
|
||||
"Paste from Clipman",
|
||||
},
|
||||
q = {
|
||||
name = "+quit/session",
|
||||
q = { "<cmd>qa<cr>", "Quit" },
|
||||
["!"] = { "<cmd>:qa!<cr>", "Quit without saving" },
|
||||
s = { [[<cmd>lua require("persistence").load()<cr>]], "Restore Session" },
|
||||
l = { [[<cmd>lua require("persistence").load({last=true})<cr>]], "Restore Last Session" },
|
||||
d = { [[<cmd>lua require("persistence").stop()<cr>]], "Stop Current Session" },
|
||||
},
|
||||
x = {
|
||||
name = "+errors",
|
||||
x = { "<cmd>TroubleToggle workspace_diagnostics<cr>", "Trouble" },
|
||||
t = { "<cmd>TodoTrouble<cr>", "Todo Trouble" },
|
||||
T = { "<cmd>TodoTelescope<cr>", "Todo Telescope" },
|
||||
l = { "<cmd>lopen<cr>", "Open Location List" },
|
||||
q = { "<cmd>copen<cr>", "Open Quickfix List" },
|
||||
},
|
||||
z = { [[<cmd>ZenMode<cr>]], "Zen Mode" },
|
||||
T = { [[<Plug>PlenaryTestFile]], "Plenary Test" },
|
||||
}
|
||||
|
||||
for i = 0, 10 do
|
||||
leader[tostring(i)] = "which_key_ignore"
|
||||
end
|
||||
|
||||
wk.register(leader, { prefix = "<leader>" })
|
||||
|
||||
wk.register({ g = { name = "+goto" } })
|
100
lua/config/options.lua
Normal file
100
lua/config/options.lua
Normal file
@ -0,0 +1,100 @@
|
||||
local indent = 2
|
||||
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = ","
|
||||
vim.opt.tabstop = indent
|
||||
vim.opt.termguicolors = true
|
||||
vim.opt.autowrite = true -- enable auto write
|
||||
vim.opt.clipboard = "unnamedplus" -- sync with system clipboard
|
||||
vim.opt.concealcursor = "nc" -- Hide * markup for bold and italic
|
||||
vim.opt.conceallevel = 3 -- Hide * markup for bold and italic
|
||||
vim.opt.confirm = true -- confirm to save changes before exiting modified buffer
|
||||
vim.opt.cursorline = true -- Enable highlighting of the current line
|
||||
vim.opt.expandtab = true -- Use spaces instead of tabs
|
||||
|
||||
vim.opt.guifont = "FiraCode Nerd Font:h12"
|
||||
vim.opt.grepprg = "rg --vimgrep"
|
||||
vim.opt.grepformat = "%f:%l:%c:%m"
|
||||
vim.opt.hidden = true -- Enable modified buffers in background
|
||||
vim.opt.ignorecase = true -- Ignore case
|
||||
vim.opt.inccommand = "split" -- preview incremental substitute
|
||||
vim.opt.joinspaces = false -- No double spaces with join after a dot
|
||||
vim.opt.list = true -- Show some invisible characters (tabs...
|
||||
vim.opt.mouse = "a" -- enable mouse mode
|
||||
vim.opt.number = true -- Print line number
|
||||
vim.opt.pumblend = 10 -- Popup blend
|
||||
vim.opt.pumheight = 10 -- Maximum number of entries in a popup
|
||||
vim.opt.relativenumber = true -- Relative line numbers
|
||||
vim.opt.scrolloff = 4 -- Lines of context
|
||||
vim.opt.shiftround = true -- Round indent
|
||||
vim.opt.shiftwidth = indent -- Size of an indent
|
||||
vim.opt.showmode = false -- dont show mode since we have a statusline
|
||||
vim.opt.sidescrolloff = 8 -- Columns of context
|
||||
vim.opt.signcolumn = "yes" -- Always show the signcolumn, otherwise it would shift the text each time
|
||||
vim.opt.smartcase = true -- Don't ignore case with capitals
|
||||
vim.opt.smartindent = true -- Insert indents automatically
|
||||
|
||||
vim.opt.splitbelow = true -- Put new windows below current
|
||||
vim.opt.splitright = true -- Put new windows right of current
|
||||
vim.opt.tabstop = indent -- Number of spaces tabs count for
|
||||
vim.opt.termguicolors = true -- True color support
|
||||
vim.opt.undofile = true
|
||||
vim.opt.undolevels = 10000
|
||||
vim.opt.updatetime = 200 -- save swap file and trigger CursorHold
|
||||
vim.opt.wildmode = "longest:full,full" -- Command-line completion mode
|
||||
vim.opt.wrap = false -- Disable line wrap
|
||||
vim.opt.sessionoptions = { "buffers", "curdir", "tabpages", "winsize" }
|
||||
vim.opt.fillchars = {
|
||||
-- horiz = "\u2501",
|
||||
-- horizup = "\u253b",
|
||||
-- horizdown = "\u2533",
|
||||
-- vert = "\u2503",
|
||||
-- vertleft = "\u252b",
|
||||
-- vertright = "\u2523",
|
||||
-- verthoriz = "\u254b",im.o.fillchars = [[eob: ,
|
||||
-- fold = " ",
|
||||
foldopen = "",
|
||||
-- foldsep = " ",
|
||||
foldclose = "",
|
||||
}
|
||||
|
||||
local builtins = {
|
||||
"gzip",
|
||||
"zip",
|
||||
"zipPlugin",
|
||||
"fzf",
|
||||
"tar",
|
||||
"tarPlugin",
|
||||
"getscript",
|
||||
"getscriptPlugin",
|
||||
"vimball",
|
||||
"vimballPlugin",
|
||||
"2html_plugin",
|
||||
"matchit",
|
||||
"matchparen",
|
||||
"logiPat",
|
||||
"rrhelper",
|
||||
"netrw",
|
||||
"netrwPlugin",
|
||||
"netrwSettings",
|
||||
"netrwFileHandlers",
|
||||
}
|
||||
|
||||
for _, plugin in ipairs(builtins) do
|
||||
vim.g["loaded_" .. plugin] = 1
|
||||
end
|
||||
|
||||
local fences = {
|
||||
"lua",
|
||||
-- "vim",
|
||||
"json",
|
||||
"typescript",
|
||||
"javascript",
|
||||
"js=javascript",
|
||||
"ts=typescript",
|
||||
"shell=sh",
|
||||
"python",
|
||||
"sh",
|
||||
"console=sh",
|
||||
}
|
||||
vim.g.markdown_fenced_languages = fences
|
@ -5,21 +5,184 @@ local config = {
|
||||
auto_reload_compiled = false,
|
||||
}
|
||||
|
||||
|
||||
local function plugins(use, plugin)
|
||||
-- Bootstrap
|
||||
---- Bootstrap
|
||||
use({ "wbthomason/packer.nvim" })
|
||||
|
||||
-- Explorer
|
||||
-- UI
|
||||
use({ "stevearc/dressing.nvim", event = "User PackerDefered" })
|
||||
|
||||
-- Layout
|
||||
use({
|
||||
"folke/noice.nvim",
|
||||
module = "noice",
|
||||
event = "VimEnter",
|
||||
config = function()
|
||||
require("noice").setup()
|
||||
end,
|
||||
})
|
||||
plugin("anuvyklack/windows.nvim")
|
||||
|
||||
-- Notifications
|
||||
use({
|
||||
"rcarriga/nvim-notify",
|
||||
event = "User PackerDefered",
|
||||
module = "notify",
|
||||
config = function()
|
||||
require("notify").setup({ level = vim.log.levels.INFO, fps = 20 })
|
||||
vim.notify = require("notify")
|
||||
end,
|
||||
})
|
||||
|
||||
---- Explorer
|
||||
plugin("nvim-neo-tree/neo-tree.nvim")
|
||||
use({
|
||||
"MunifTanjim/nui.nvim",
|
||||
module = "nui",
|
||||
})
|
||||
use({
|
||||
"danymat/neogen",
|
||||
module = "neogen",
|
||||
config = function()
|
||||
require("neogen").setup({ snippet_engine = "luasnip" })
|
||||
end,
|
||||
})
|
||||
|
||||
--plugin("nvim-treesitter/nvim-treesitter")
|
||||
-- Status bar
|
||||
use({
|
||||
"SmiteshP/nvim-navic",
|
||||
module = "nvim-navic",
|
||||
config = function()
|
||||
vim.g.navic_silence = true
|
||||
require("nvim-navic").setup({ separator = " ", highlight = true, depth_limit = 5 })
|
||||
end,
|
||||
})
|
||||
|
||||
plugin("nvim-lualine/lualine.nvim")
|
||||
|
||||
-- Bufferline
|
||||
plugin("nvim-telescope/telescope.nvim")
|
||||
|
||||
plugin("lukas-reineke/indent-blankline.nvim")
|
||||
plugin("akinsho/nvim-bufferline.lua")
|
||||
|
||||
plugin("NvChad/nvim-colorizer.lua")
|
||||
|
||||
-- Dashboard
|
||||
plugin("glepnir/dashboard-nvim")
|
||||
|
||||
-- Notify
|
||||
use({
|
||||
"j-hui/fidget.nvim",
|
||||
module = "fidget",
|
||||
config = function()
|
||||
require("fidget").setup({
|
||||
window = {
|
||||
relative = "editor",
|
||||
},
|
||||
})
|
||||
-- HACK: prevent error when exiting Neovim
|
||||
vim.api.nvim_create_autocmd("VimLeavePre", { command = [[silent! FidgetClose]] })
|
||||
end,
|
||||
})
|
||||
|
||||
-- smooth scrolling
|
||||
plugin("karb94/neoscroll.nvim")
|
||||
|
||||
---- Code
|
||||
-- Formatting
|
||||
plugin("jose-elias-alvarez/null-ls.nvim")
|
||||
use({ "folke/lua-dev.nvim", module = "lua-dev" })
|
||||
|
||||
-- LSP
|
||||
use({ "neovim/nvim-lspconfig", plugin = "lsp" })
|
||||
plugin("williamboman/mason.nvim")
|
||||
use({
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
module = "mason-lspconfig",
|
||||
})
|
||||
|
||||
-- Autocomplete
|
||||
plugin("hrsh7th/nvim-cmp")
|
||||
|
||||
use({
|
||||
"folke/trouble.nvim",
|
||||
event = "BufReadPre",
|
||||
module = "trouble",
|
||||
cmd = { "TroubleToggle", "Trouble" },
|
||||
config = function()
|
||||
require("trouble").setup({
|
||||
auto_open = false,
|
||||
use_diagnostic_signs = true, -- en
|
||||
})
|
||||
end,
|
||||
})
|
||||
|
||||
-- Utility
|
||||
plugin("windwp/nvim-autopairs")
|
||||
|
||||
-- Yanking
|
||||
use({
|
||||
"AckslD/nvim-neoclip.lua",
|
||||
event = "TextYankPost",
|
||||
module = "telescope._extensions.neoclip",
|
||||
requires = { { "kkharji/sqlite.lua", module = "sqlite" } },
|
||||
config = function()
|
||||
require("neoclip").setup({
|
||||
enable_persistent_history = true,
|
||||
continuous_sync = true,
|
||||
})
|
||||
end,
|
||||
})
|
||||
|
||||
-- Session management
|
||||
use({
|
||||
"folke/persistence.nvim",
|
||||
event = "BufReadPre",
|
||||
module = "persistence",
|
||||
config = function()
|
||||
require("persistence").setup()
|
||||
end,
|
||||
})
|
||||
use({
|
||||
"dstein64/vim-startuptime",
|
||||
cmd = "StartupTime",
|
||||
config = function()
|
||||
vim.g.startuptime_tries = 10
|
||||
end,
|
||||
})
|
||||
|
||||
-- Snippets
|
||||
plugin("L3MON4D3/LuaSnip")
|
||||
|
||||
-- Syntax
|
||||
use({ "nvim-lua/plenary.nvim", module = "plenary" })
|
||||
|
||||
plugin("nvim-treesitter/nvim-treesitter")
|
||||
use({ "nvim-treesitter/playground", cmd = { "TSHighlightCapturesUnderCursor", "TSPlaygroundToggle" } })
|
||||
|
||||
use({
|
||||
"m-demare/hlargs.nvim",
|
||||
module = "hlargs",
|
||||
event = "User PackerDefered",
|
||||
requires = {
|
||||
"nvim-treesitter",
|
||||
},
|
||||
config = function()
|
||||
require("hlargs").setup({
|
||||
color = require("tokyonight.colors").setup().yellow,
|
||||
})
|
||||
end,
|
||||
})
|
||||
|
||||
use({
|
||||
"folke/which-key.nvim",
|
||||
module = "which-key",
|
||||
})
|
||||
|
||||
-- Theme: color scheme
|
||||
plugin("folke/tokyonight.nvim")
|
||||
|
||||
-- Theme: Icons
|
||||
use({
|
||||
"kyazdani42/nvim-web-devicons",
|
||||
@ -28,12 +191,6 @@ local function plugins(use, plugin)
|
||||
require("nvim-web-devicons").setup({ default = true })
|
||||
end,
|
||||
})
|
||||
|
||||
plugin("nvim-treesitter/nvim-treesitter")
|
||||
|
||||
use({ "nvim-treesitter/playground", cmd = { "TSHighlightCapturesUnderCursor", "TSPlaygroundToggle" } })
|
||||
|
||||
|
||||
end
|
||||
|
||||
return packer.setup(config, plugins)
|
||||
|
12
lua/plugins/autopairs.lua
Normal file
12
lua/plugins/autopairs.lua
Normal file
@ -0,0 +1,12 @@
|
||||
return {
|
||||
module = "nvim-autopairs",
|
||||
config = function()
|
||||
local npairs = require("nvim-autopairs")
|
||||
npairs.setup({
|
||||
check_ts = true,
|
||||
ts_config = {
|
||||
lua = { "string", "comment" },
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
56
lua/plugins/bufferline.lua
Normal file
56
lua/plugins/bufferline.lua
Normal file
@ -0,0 +1,56 @@
|
||||
local M = {
|
||||
event = "BufReadPre",
|
||||
}
|
||||
|
||||
function M.config()
|
||||
local signs = require("plugins.lsp.diagnostics").signs
|
||||
|
||||
signs = {
|
||||
error = signs.Error,
|
||||
warning = signs.Warn,
|
||||
info = signs.Info,
|
||||
hint = signs.Hint,
|
||||
}
|
||||
|
||||
local severities = {
|
||||
"error",
|
||||
"warning",
|
||||
-- "info",
|
||||
-- "hint",
|
||||
}
|
||||
|
||||
require("bufferline").setup({
|
||||
options = {
|
||||
show_close_icon = true,
|
||||
diagnostics = "nvim_lsp",
|
||||
always_show_bufferline = false,
|
||||
separator_style = "thick",
|
||||
diagnostics_indicator = function(_, _, diag)
|
||||
local s = {}
|
||||
for _, severity in ipairs(severities) do
|
||||
if diag[severity] then
|
||||
table.insert(s, signs[severity] .. diag[severity])
|
||||
end
|
||||
end
|
||||
return table.concat(s, " ")
|
||||
end,
|
||||
offsets = {
|
||||
{
|
||||
filetype = "neo-tree",
|
||||
text = "Neo Tree",
|
||||
highlight = "Directory",
|
||||
text_align = "left",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
-- function M.init()
|
||||
-- vim.keymap.set("n", "<leader>bp", "<cmd>:BufferLineCyclePrev<CR>", { desc = "Previous Buffer" })
|
||||
-- vim.keymap.set("n", "<leader>bn", "<cmd>:BufferLineCycleNext<CR>", { desc = "Next Buffer" })
|
||||
-- vim.keymap.set("n", "[b", "<cmd>:BufferLineCyclePrev<CR>", { desc = "Previous Buffer" })
|
||||
-- vim.keymap.set("n", "]b", "<cmd>:BufferLineCycleNext<CR>", { desc = "Next Buffer" })
|
||||
-- end
|
||||
|
||||
return M
|
60
lua/plugins/cmp.lua
Normal file
60
lua/plugins/cmp.lua
Normal file
@ -0,0 +1,60 @@
|
||||
local M = {
|
||||
event = "InsertEnter",
|
||||
module = "cmp",
|
||||
requires = {
|
||||
{ "hrsh7th/cmp-nvim-lsp", module = "cmp_nvim_lsp" },
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-emoji",
|
||||
"hrsh7th/cmp-cmdline",
|
||||
"dmitmel/cmp-cmdline-history",
|
||||
"hrsh7th/cmp-path",
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
"hrsh7th/cmp-nvim-lsp-signature-help",
|
||||
},
|
||||
}
|
||||
|
||||
function M.config()
|
||||
vim.o.completeopt = "menuone,noselect"
|
||||
|
||||
-- Setup nvim-cmp.
|
||||
local cmp = require("cmp")
|
||||
|
||||
cmp.setup({
|
||||
completion = {
|
||||
completeopt = "menu,menuone,noinsert",
|
||||
},
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require("luasnip").lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
["<C-e>"] = cmp.mapping.close(),
|
||||
["<CR>"] = cmp.mapping.confirm({ select = true }),
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "buffer" },
|
||||
{ name = "path" },
|
||||
{ name = "emoji" },
|
||||
{ name = "nvim_lsp_signature_help" },
|
||||
}),
|
||||
formatting = {
|
||||
format = require("plugins.lsp.kind").cmp_format(),
|
||||
},
|
||||
experimental = {
|
||||
ghost_text = {
|
||||
hl_group = "LspCodeLens",
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
|
||||
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done({ map_char = { tex = "" } }))
|
||||
end
|
||||
|
||||
return M
|
26
lua/plugins/colorizer.lua
Normal file
26
lua/plugins/colorizer.lua
Normal file
@ -0,0 +1,26 @@
|
||||
return {
|
||||
event = "BufReadPre",
|
||||
config = function()
|
||||
require("colorizer").setup({
|
||||
user_default_options = {
|
||||
RGB = true, -- #RGB hex codes
|
||||
RRGGBB = true, -- #RRGGBB hex codes
|
||||
names = false, -- "Name" codes like Blue
|
||||
RRGGBBAA = true, -- #RRGGBBAA hex codes
|
||||
AARRGGBB = false, -- 0xAARRGGBB hex codes
|
||||
rgb_fn = true, -- CSS rgb() and rgba() functions
|
||||
hsl_fn = true, -- CSS hsl() and hsla() functions
|
||||
css = false, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB
|
||||
css_fn = true, -- Enable all CSS *functions*: rgb_fn, hsl_fn
|
||||
-- Available modes: foreground, background
|
||||
-- Available modes for `mode`: foreground, background, virtualtext
|
||||
mode = "background", -- Set the display mode.
|
||||
virtualtext = "■",
|
||||
},
|
||||
})
|
||||
|
||||
vim.cmd(
|
||||
[[autocmd ColorScheme * lua package.loaded['colorizer'] = nil; require('colorizer').setup(); require('colorizer').attach_to_buffer(0)]]
|
||||
)
|
||||
end,
|
||||
}
|
33
lua/plugins/dashboard.lua
Normal file
33
lua/plugins/dashboard.lua
Normal file
@ -0,0 +1,33 @@
|
||||
return {
|
||||
opt = false,
|
||||
config = function()
|
||||
local db = require("dashboard")
|
||||
|
||||
local logo = [[
|
||||
███╗ ██╗ ███████╗ ██████╗ ██╗ ██╗ ██╗ ███╗ ███╗
|
||||
████╗ ██║ ██╔════╝██╔═══██╗ ██║ ██║ ██║ ████╗ ████║
|
||||
██╔██╗ ██║ █████╗ ██║ ██║ ██║ ██║ ██║ ██╔████╔██║
|
||||
██║╚██╗██║ ██╔══╝ ██║ ██║ ╚██╗ ██╔╝ ██║ ██║╚██╔╝██║
|
||||
██║ ╚████║ ███████╗╚██████╔╝ ╚████╔╝ ██║ ██║ ╚═╝ ██║
|
||||
╚═╝ ╚═══╝ ╚══════╝ ╚═════╝ ╚═══╝ ╚═╝ ╚═╝ ╚═╝
|
||||
]]
|
||||
local lines = {}
|
||||
for line in logo:gmatch("[^\n]+") do
|
||||
table.insert(lines, line)
|
||||
end
|
||||
|
||||
db.custom_header = lines
|
||||
|
||||
vim.g.dashboard_custom_header = lines
|
||||
|
||||
vim.g.dashboard_custom_shortcut = {
|
||||
["last_session"] = "SPC s l",
|
||||
["find_history"] = "SPC f r",
|
||||
["find_file"] = "SPC spc",
|
||||
["new_file"] = "SPC f n",
|
||||
["change_colorscheme"] = "SPC h c",
|
||||
["find_word"] = "SPC f g",
|
||||
["book_marks"] = "SPC f b",
|
||||
}
|
||||
end,
|
||||
}
|
53
lua/plugins/indent-blankline.lua
Normal file
53
lua/plugins/indent-blankline.lua
Normal file
@ -0,0 +1,53 @@
|
||||
local M = {}
|
||||
|
||||
M.event = "BufReadPre"
|
||||
|
||||
function M.config()
|
||||
local indent = require("indent_blankline")
|
||||
|
||||
--- PERF: debounce indent-blankline refresh
|
||||
local refresh = indent.refresh
|
||||
indent.refresh = require("util").debounce(100, refresh)
|
||||
|
||||
indent.setup({
|
||||
buftype_exclude = { "terminal", "nofile" },
|
||||
filetype_exclude = {
|
||||
"help",
|
||||
"startify",
|
||||
"dashboard",
|
||||
"packer",
|
||||
"neogitstatus",
|
||||
"NvimTree",
|
||||
"neo-tree",
|
||||
"Trouble",
|
||||
},
|
||||
char = "│",
|
||||
use_treesitter_scope = false,
|
||||
show_trailing_blankline_indent = false,
|
||||
show_current_context = true,
|
||||
context_patterns = {
|
||||
"class",
|
||||
"return",
|
||||
"function",
|
||||
"method",
|
||||
"^if",
|
||||
"^while",
|
||||
"jsx_element",
|
||||
"^for",
|
||||
"^object",
|
||||
"^table",
|
||||
"block",
|
||||
"arguments",
|
||||
"if_statement",
|
||||
"else_clause",
|
||||
"jsx_element",
|
||||
"jsx_self_closing_element",
|
||||
"try_statement",
|
||||
"catch_clause",
|
||||
"import_statement",
|
||||
"operation_type",
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
26
lua/plugins/lsp/diagnostics.lua
Normal file
26
lua/plugins/lsp/diagnostics.lua
Normal file
@ -0,0 +1,26 @@
|
||||
local M = {}
|
||||
|
||||
M.signs = { Error = " ", Warn = " ", Hint = " ", Info = " " }
|
||||
|
||||
function M.setup()
|
||||
-- Automatically update diagnostics
|
||||
vim.diagnostic.config({
|
||||
underline = true,
|
||||
update_in_insert = false,
|
||||
virtual_text = { spacing = 4, prefix = "●" },
|
||||
severity_sort = true,
|
||||
})
|
||||
|
||||
vim.lsp.handlers["workspace/diagnostic/refresh"] = function(_, _, ctx)
|
||||
local ns = vim.lsp.diagnostic.get_namespace(ctx.client_id)
|
||||
pcall(vim.diagnostic.reset, ns)
|
||||
return true
|
||||
end
|
||||
|
||||
for type, icon in pairs(M.signs) do
|
||||
local hl = "DiagnosticSign" .. type
|
||||
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
59
lua/plugins/lsp/formatting.lua
Normal file
59
lua/plugins/lsp/formatting.lua
Normal file
@ -0,0 +1,59 @@
|
||||
local util = require("util")
|
||||
|
||||
local M = {}
|
||||
|
||||
-- vim.lsp.handlers["textDocument/hover"] = function(_, method, result)
|
||||
-- print(vim.inspect(result))
|
||||
-- end
|
||||
|
||||
M.autoformat = true
|
||||
|
||||
function M.toggle()
|
||||
M.autoformat = not M.autoformat
|
||||
if M.autoformat then
|
||||
util.info("enabled format on save", "Formatting")
|
||||
else
|
||||
util.warn("disabled format on save", "Formatting")
|
||||
end
|
||||
end
|
||||
|
||||
function M.format()
|
||||
if M.autoformat then
|
||||
if vim.lsp.buf.format then
|
||||
vim.lsp.buf.format()
|
||||
else
|
||||
vim.lsp.buf.formatting_sync()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function M.setup(client, buf)
|
||||
local ft = vim.api.nvim_buf_get_option(buf, "filetype")
|
||||
local nls = require("plugins.null-ls")
|
||||
|
||||
local enable = false
|
||||
if nls.has_formatter(ft) then
|
||||
enable = client.name == "null-ls"
|
||||
else
|
||||
enable = not (client.name == "null-ls")
|
||||
end
|
||||
|
||||
if client.name == "tsserver" then
|
||||
enable = false
|
||||
end
|
||||
|
||||
-- util.info(client.name .. " " .. (enable and "yes" or "no"), "format")
|
||||
|
||||
client.server_capabilities.documentFormattingProvider = enable
|
||||
-- format on save
|
||||
if client.server_capabilities.documentFormattingProvider then
|
||||
vim.cmd([[
|
||||
augroup LspFormat
|
||||
autocmd! * <buffer>
|
||||
autocmd BufWritePre <buffer> lua require("plugins.lsp.formatting").format()
|
||||
augroup END
|
||||
]])
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
91
lua/plugins/lsp/init.lua
Normal file
91
lua/plugins/lsp/init.lua
Normal file
@ -0,0 +1,91 @@
|
||||
local M = {
|
||||
event = "BufReadPre"
|
||||
}
|
||||
|
||||
function M.config()
|
||||
require("lua-dev").setup({
|
||||
library = {
|
||||
runtime = "~/projects/neovim/runtime/"
|
||||
}
|
||||
})
|
||||
require("mason")
|
||||
require("plugins.lsp.diagnostics").setup()
|
||||
require("fidget").setup({text = {spinner = "dots"} })
|
||||
local function on_attach(client, bufnr)
|
||||
--require("nvim-navic").attach(client, bufnr)
|
||||
require("plugins.lsp.formatting").setup(client, bufnr)
|
||||
--require("plugins.lsp.keys").setup(client, bufnr)
|
||||
end
|
||||
|
||||
---@type lspconfig.options
|
||||
local servers = {
|
||||
sumneko_lua = {
|
||||
single_file_support = true,
|
||||
settings = {
|
||||
Lua = {
|
||||
workspace = {
|
||||
checkThirdParty = false,
|
||||
},
|
||||
completion = {
|
||||
workspaceWord = false,
|
||||
},
|
||||
misc = {
|
||||
parameters = {
|
||||
"--log-level=trace",
|
||||
},
|
||||
},
|
||||
diagnostics = {
|
||||
groupFileStatus = {
|
||||
["ambiguity"] = "Opened",
|
||||
["await"] = "Opened",
|
||||
["codestyle"] = "None",
|
||||
["duplicate"] = "Opened",
|
||||
["global"] = "Opened",
|
||||
["luadoc"] = "Opened",
|
||||
["redefined"] = "Opened",
|
||||
["strict"] = "Opened",
|
||||
["strong"] = "Opened",
|
||||
["type-check"] = "Opened",
|
||||
["unbalanced"] = "Opened",
|
||||
["unused"] = "Opened",
|
||||
},
|
||||
unusedLocalExclude = { "_*" },
|
||||
},
|
||||
format = {
|
||||
enable = false,
|
||||
defaultConfig = {
|
||||
indent_style = "space",
|
||||
indent_size = "2",
|
||||
continuation_indent_size = "2",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
vimls = {},
|
||||
}
|
||||
local capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||
capabilities.textDocument.foldingRange = {
|
||||
dymanicRegistration = false,
|
||||
lineFoldingOnly = true,
|
||||
}
|
||||
|
||||
---@type _.lspconfig.options
|
||||
local options = {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
flags = {
|
||||
debounce_text_change = 150,
|
||||
}
|
||||
}
|
||||
|
||||
for server, opts in pairs(servers) do
|
||||
opts = vim.tbl_deep_extend("force", {}, options, opts or {})
|
||||
require("lspconfig")[server].setup(opts)
|
||||
end
|
||||
|
||||
require("plugins.null-ls").setup(options)
|
||||
|
||||
end
|
||||
|
||||
return M
|
36
lua/plugins/lsp/kind.lua
Normal file
36
lua/plugins/lsp/kind.lua
Normal file
@ -0,0 +1,36 @@
|
||||
local M = {}
|
||||
|
||||
M.icons = {
|
||||
Class = " ",
|
||||
Color = " ",
|
||||
Constant = " ",
|
||||
Constructor = " ",
|
||||
Enum = "了 ",
|
||||
EnumMember = " ",
|
||||
Field = " ",
|
||||
File = " ",
|
||||
Folder = " ",
|
||||
Function = " ",
|
||||
Interface = "ﰮ ",
|
||||
Keyword = " ",
|
||||
Method = "ƒ ",
|
||||
Module = " ",
|
||||
Property = " ",
|
||||
Snippet = " ",
|
||||
Struct = " ",
|
||||
Text = " ",
|
||||
Unit = " ",
|
||||
Value = " ",
|
||||
Variable = " ",
|
||||
}
|
||||
|
||||
function M.cmp_format()
|
||||
return function(_entry, vim_item)
|
||||
if M.icons[vim_item.kind] then
|
||||
vim_item.kind = M.icons[vim_item.kind] .. vim_item.kind
|
||||
end
|
||||
return vim_item
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
86
lua/plugins/lualine.lua
Normal file
86
lua/plugins/lualine.lua
Normal file
@ -0,0 +1,86 @@
|
||||
local M = {
|
||||
module = "lualine",
|
||||
event = "User PackerDefered",
|
||||
}
|
||||
|
||||
local function clock()
|
||||
return " " .. os.date("%H:%M")
|
||||
end
|
||||
|
||||
local function holidays()
|
||||
return "🌴🌊"
|
||||
-- return "\U0001f385\U0001f384\U0001f31f\U0001f381"
|
||||
end
|
||||
|
||||
function M.config()
|
||||
require("lualine").setup({
|
||||
options = {
|
||||
theme = "auto",
|
||||
section_separators = { left = "", right = "" },
|
||||
component_separators = { left = "", right = "" },
|
||||
icons_enabled = true,
|
||||
globalstatus = true,
|
||||
disabled_filetypes = { statusline = { "dashboard" } },
|
||||
},
|
||||
sections = {
|
||||
lualine_a = { "mode" },
|
||||
lualine_b = { "branch" },
|
||||
lualine_c = {
|
||||
{ "diagnostics", sources = { "nvim_diagnostic" } },
|
||||
{ "filetype", icon_only = true, separator = "", padding = { left = 1, right = 0 } },
|
||||
{ "filename", path = 1, symbols = { modified = " ", readonly = "", unnamed = "" } },
|
||||
{
|
||||
function()
|
||||
local navic = require("nvim-navic")
|
||||
local ret = navic.get_location()
|
||||
return ret:len() > 2000 and "navic error" or ret
|
||||
end,
|
||||
cond = function()
|
||||
local navic = require("nvim-navic")
|
||||
return navic.is_available()
|
||||
end,
|
||||
color = { fg = "#ff9e64" },
|
||||
},
|
||||
},
|
||||
lualine_x = {
|
||||
-- {
|
||||
-- require("noice.status").message.get_hl,
|
||||
-- cond = require("noice.status").message.has,
|
||||
-- },
|
||||
-- {
|
||||
-- require("noice.status").command.get,
|
||||
-- cond = require("noice.status").command.has,
|
||||
-- color = { fg = "#ff9e64" },
|
||||
-- },
|
||||
-- {
|
||||
-- require("noice.status").mode.get,
|
||||
-- cond = require("noice.status").mode.has,
|
||||
-- color = { fg = "#ff9e64" },
|
||||
-- },
|
||||
-- {
|
||||
-- require("noice.status").search.get,
|
||||
-- cond = require("noice.status").search.has,
|
||||
-- color = { fg = "#ff9e64" },
|
||||
-- },
|
||||
-- function()
|
||||
-- return require("messages.view").status
|
||||
-- end,
|
||||
-- { require("github-notifications").statusline_notification_count },
|
||||
{ holidays },
|
||||
},
|
||||
lualine_y = { "location" },
|
||||
lualine_z = { clock },
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = {},
|
||||
lualine_x = {},
|
||||
lualine_y = {},
|
||||
lualine_z = {},
|
||||
},
|
||||
extensions = { "nvim-tree" },
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
49
lua/plugins/luasnip.lua
Normal file
49
lua/plugins/luasnip.lua
Normal file
@ -0,0 +1,49 @@
|
||||
local M = {
|
||||
module = "luasnip",
|
||||
requires = {
|
||||
"rafamadriz/friendly-snippets",
|
||||
config = function()
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
function M.config()
|
||||
local util = require("util")
|
||||
local luasnip = require("luasnip")
|
||||
require("neogen")
|
||||
|
||||
luasnip.config.setup({
|
||||
history = true,
|
||||
enable_autosnippets = true,
|
||||
-- Update more often, :h events for more info.
|
||||
-- updateevents = "TextChanged,TextChangedI",
|
||||
})
|
||||
|
||||
--- <tab> to jump to next snippet's placeholder
|
||||
local function on_tab()
|
||||
return luasnip.jump(1) and "" or util.t("<Tab>")
|
||||
end
|
||||
|
||||
--- <s-tab> to jump to next snippet's placeholder
|
||||
local function on_s_tab()
|
||||
return luasnip.jump(-1) and "" or util.t("<S-Tab>")
|
||||
end
|
||||
|
||||
-- vim.keymap.set("i", "<Tab>", on_tab, { expr = true })
|
||||
-- vim.keymap.set("s", "<Tab>", on_tab, { expr = true })
|
||||
-- vim.keymap.set("i", "<S-Tab>", on_s_tab, { expr = true })
|
||||
-- vim.keymap.set("s", "<S-Tab>", on_s_tab, { expr = true })
|
||||
|
||||
vim.cmd([[
|
||||
" press <Tab> to expand or jump in a snippet. These can also be mapped separately
|
||||
" via <Plug>luasnip-expand-snippet and <Plug>luasnip-jump-next.
|
||||
imap <silent><expr> <Tab> luasnip#expand_or_jumpable() ? '<Plug>luasnip-expand-or-jump' : '<Tab>'
|
||||
" -1 for jumping backwards.
|
||||
inoremap <silent> <S-Tab> <cmd>lua require'luasnip'.jump(-1)<Cr>
|
||||
snoremap <silent> <Tab> <cmd>lua require('luasnip').jump(1)<Cr>
|
||||
snoremap <silent> <S-Tab> <cmd>lua require('luasnip').jump(-1)<Cr>
|
||||
]])
|
||||
end
|
||||
|
||||
return M
|
28
lua/plugins/mason.lua
Normal file
28
lua/plugins/mason.lua
Normal file
@ -0,0 +1,28 @@
|
||||
local M = {
|
||||
module = "mason",
|
||||
}
|
||||
|
||||
M.tools = {
|
||||
"stylua",
|
||||
"selene",
|
||||
}
|
||||
|
||||
function M.check()
|
||||
local mr = require("mason-registry")
|
||||
for _, tool in ipairs(M.tools) do
|
||||
local p = mr.get_package(tool)
|
||||
if not p:is_installed() then
|
||||
p:install()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function M.config()
|
||||
require("mason").setup()
|
||||
M.check()
|
||||
require("mason-lspconfig").setup({
|
||||
automatic_installation = true,
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
@ -3,6 +3,6 @@ return {
|
||||
config = function()
|
||||
vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]])
|
||||
|
||||
require("neo-tree").setup({filesystem = {follow_current_file = true}})
|
||||
require("neo-tree").setup({ filesystem = { follow_current_file = true } })
|
||||
end,
|
||||
}
|
||||
|
19
lua/plugins/neoscroll.lua
Normal file
19
lua/plugins/neoscroll.lua
Normal file
@ -0,0 +1,19 @@
|
||||
return {
|
||||
keys = { "<C-u>", "<C-d>", "gg", "G" },
|
||||
config = function()
|
||||
require("neoscroll").setup({})
|
||||
local map = {}
|
||||
|
||||
map["<C-u>"] = { "scroll", { "-vim.wo.scroll", "true", "80" } }
|
||||
map["<C-d>"] = { "scroll", { "vim.wo.scroll", "true", "80" } }
|
||||
map["<C-b>"] = { "scroll", { "-vim.api.nvim_win_get_height(0)", "true", "250" } }
|
||||
map["<C-f>"] = { "scroll", { "vim.api.nvim_win_get_height(0)", "true", "250" } }
|
||||
map["<C-y>"] = { "scroll", { "-0.10", "false", "80" } }
|
||||
map["<C-e>"] = { "scroll", { "0.10", "false", "80" } }
|
||||
map["zt"] = { "zt", { "150" } }
|
||||
map["zz"] = { "zz", { "150" } }
|
||||
map["zb"] = { "zb", { "150" } }
|
||||
|
||||
require("neoscroll.config").set_mappings(map)
|
||||
end,
|
||||
}
|
34
lua/plugins/null-ls.lua
Normal file
34
lua/plugins/null-ls.lua
Normal file
@ -0,0 +1,34 @@
|
||||
local M = { module = "null-ls" }
|
||||
|
||||
function M.setup(options)
|
||||
local nls = require("null-ls")
|
||||
nls.setup({
|
||||
debounce = 150,
|
||||
save_after_format = false,
|
||||
sources = {
|
||||
-- nls.builtins.formatting.prettierd,
|
||||
nls.builtins.formatting.stylua,
|
||||
nls.builtins.formatting.fish_indent,
|
||||
-- nls.builtins.formatting.fixjson.with({ filetypes = { "jsonc" } }),
|
||||
-- nls.builtins.formatting.eslint_d,
|
||||
-- nls.builtins.diagnostics.shellcheck,
|
||||
--nls.builtins.formatting.shfmt,
|
||||
--nls.builtins.diagnostics.markdownlint,
|
||||
-- nls.builtins.formatting.deno_fmt.with({
|
||||
-- filetypes = { "markdown" }, -- only runs `deno fmt` for markdown
|
||||
-- }),
|
||||
-- nls.builtins.diagnostics.selene,
|
||||
-- nls.builtins.code_actions.gitsigns,
|
||||
},
|
||||
on_attach = options.on_attach,
|
||||
root_dir = require("null-ls.utils").root_pattern(".null-ls-root", ".nvim.settings.json", ".git"),
|
||||
})
|
||||
end
|
||||
|
||||
function M.has_formatter(ft)
|
||||
local sources = require("null-ls.sources")
|
||||
local available = sources.get_available(ft, "NULL_LS_FORMATTING")
|
||||
return #available > 0
|
||||
end
|
||||
|
||||
return M
|
123
lua/plugins/telescope.lua
Normal file
123
lua/plugins/telescope.lua
Normal file
@ -0,0 +1,123 @@
|
||||
local M = {
|
||||
cmd = { "Telescope" },
|
||||
module = "telescope",
|
||||
requires = {
|
||||
{ "nvim-telescope/telescope-file-browser.nvim", module = "telescope._extensions.file_browser" },
|
||||
{ "nvim-telescope/telescope-z.nvim", module = "telescope._extensions.z" },
|
||||
{ "nvim-telescope/telescope-project.nvim", module = "telescope._extensions.project" },
|
||||
{ "nvim-telescope/telescope-symbols.nvim", module = "telescope._extensions.symbols" },
|
||||
{ "nvim-telescope/telescope-fzf-native.nvim", module = "telescope._extensions.fzf", run = "make" },
|
||||
},
|
||||
}
|
||||
|
||||
function M.project_files(opts)
|
||||
opts = opts or {}
|
||||
opts.show_untracked = true
|
||||
local ok = pcall(require("telescope.builtin").git_files, opts)
|
||||
if not ok then
|
||||
local client = vim.lsp.get_active_clients()[1]
|
||||
if client then
|
||||
opts.cwd = client.config.root_dir
|
||||
end
|
||||
require("telescope.builtin").find_files(opts)
|
||||
end
|
||||
end
|
||||
|
||||
function M.config()
|
||||
-- local actions = require("telescope.actions")
|
||||
local trouble = require("trouble.providers.telescope")
|
||||
|
||||
local telescope = require("telescope")
|
||||
local borderless = true
|
||||
telescope.setup({
|
||||
extensions = {
|
||||
-- fzf = {
|
||||
-- fuzzy = true, -- false will only do exact matching
|
||||
-- override_generic_sorter = true, -- override the generic sorter
|
||||
-- override_file_sorter = true, -- override the file sorter
|
||||
-- case_mode = "smart_case", -- or "ignore_case" or "respect_case"
|
||||
-- -- the default case_mode is "smart_case"
|
||||
-- },
|
||||
},
|
||||
defaults = {
|
||||
layout_strategy = "horizontal",
|
||||
layout_config = {
|
||||
prompt_position = "top",
|
||||
},
|
||||
sorting_strategy = "ascending",
|
||||
mappings = { i = { ["<c-t>"] = trouble.open_with_trouble } },
|
||||
-- mappings = { i = { ["<esc>"] = actions.close } },
|
||||
-- vimgrep_arguments = {
|
||||
-- 'rg',
|
||||
-- '--color=never',
|
||||
-- '--no-heading',
|
||||
-- '--with-filename',
|
||||
-- '--line-number',
|
||||
-- '--column',
|
||||
-- '--smart-case'
|
||||
-- },
|
||||
-- prompt_position = "bottom",
|
||||
prompt_prefix = " ",
|
||||
selection_caret = " ",
|
||||
-- entry_prefix = " ",
|
||||
-- initial_mode = "insert",
|
||||
-- selection_strategy = "reset",
|
||||
-- sorting_strategy = "descending",
|
||||
-- layout_strategy = "horizontal",
|
||||
-- layout_defaults = {
|
||||
-- horizontal = {
|
||||
-- mirror = false,
|
||||
-- },
|
||||
-- vertical = {
|
||||
-- mirror = false,
|
||||
-- },
|
||||
-- },
|
||||
-- file_sorter = require"telescope.sorters".get_fzy_file
|
||||
-- file_ignore_patterns = {},
|
||||
-- generic_sorter = require'telescope.sorters'.get_generic_fuzzy_sorter,
|
||||
-- shorten_path = true,
|
||||
winblend = borderless and 0 or 10,
|
||||
-- width = 0.7,
|
||||
-- preview_cutoff = 120,
|
||||
-- results_height = 1,
|
||||
-- results_width = 0.8,
|
||||
-- border = false,
|
||||
-- color_devicons = true,
|
||||
-- use_less = true,
|
||||
-- set_env = { ['COLORTERM'] = 'truecolor' }, -- default = nil,
|
||||
-- file_previewer = require'telescope.previewers'.vim_buffer_cat.new,
|
||||
-- grep_previewer = require'telescope.previewers'.vim_buffer_vimgrep.new,
|
||||
-- qflist_previewer = require'telescope.previewers'.vim_buffer_qflist.new,
|
||||
|
||||
-- -- Developer configurations: Not meant for general override
|
||||
-- buffer_previewer_maker = require'telescope.previewers'.buffer_previewer_maker
|
||||
},
|
||||
})
|
||||
|
||||
-- telescope.load_extension("frecency")
|
||||
telescope.load_extension("fzf")
|
||||
telescope.load_extension("z")
|
||||
telescope.load_extension("file_browser")
|
||||
telescope.load_extension("neoclip")
|
||||
-- telescope.load_extension("project")
|
||||
end
|
||||
|
||||
function M.init()
|
||||
vim.keymap.set("n", "<leader><space>", function()
|
||||
require("plugins.telescope").project_files()
|
||||
end, { desc = "Find File" })
|
||||
|
||||
vim.keymap.set("n", "<leader>fd", function()
|
||||
require("telescope.builtin").git_files({ cwd = "~/dot" })
|
||||
end, { desc = "Find Dot File" })
|
||||
|
||||
vim.keymap.set("n", "<leader>fz", function()
|
||||
require("telescope").extensions.z.list({ cmd = { vim.o.shell, "-c", "zoxide query -ls" } })
|
||||
end, { desc = "Find Zoxide" })
|
||||
|
||||
vim.keymap.set("n", "<leader>pp", function()
|
||||
require("telescope").extensions.project.project({})
|
||||
end, { desc = "Find Project" })
|
||||
end
|
||||
|
||||
return M
|
59
lua/plugins/tokyonight.lua
Normal file
59
lua/plugins/tokyonight.lua
Normal file
@ -0,0 +1,59 @@
|
||||
return {
|
||||
opt = false,
|
||||
config = function()
|
||||
-- vim.o.background = "dark"
|
||||
local tokyonight = require("tokyonight")
|
||||
tokyonight.setup({
|
||||
style = "moon",
|
||||
-- transparent = true,
|
||||
-- hide_inactive_statusline = false,
|
||||
sidebars = {
|
||||
"qf",
|
||||
"vista_kind",
|
||||
"terminal",
|
||||
"packer",
|
||||
"spectre_panel",
|
||||
"NeogitStatus",
|
||||
"help",
|
||||
"startuptime",
|
||||
"Outline",
|
||||
},
|
||||
on_colors = function(c) end,
|
||||
on_highlights = function(hl, c)
|
||||
-- make the current line cursor orange
|
||||
hl.CursorLineNr = { fg = c.orange, bold = true }
|
||||
|
||||
-- borderless telescope
|
||||
local prompt = "#2d3149"
|
||||
hl.TelescopeNormal = {
|
||||
bg = c.bg_dark,
|
||||
fg = c.fg_dark,
|
||||
}
|
||||
hl.TelescopeBorder = {
|
||||
bg = c.bg_dark,
|
||||
fg = c.bg_dark,
|
||||
}
|
||||
hl.TelescopePromptNormal = {
|
||||
bg = prompt,
|
||||
}
|
||||
hl.TelescopePromptBorder = {
|
||||
bg = prompt,
|
||||
fg = prompt,
|
||||
}
|
||||
hl.TelescopePromptTitle = {
|
||||
bg = c.fg_gutter,
|
||||
fg = c.orange,
|
||||
}
|
||||
hl.TelescopePreviewTitle = {
|
||||
bg = c.bg_dark,
|
||||
fg = c.bg_dark,
|
||||
}
|
||||
hl.TelescopeResultsTitle = {
|
||||
bg = c.bg_dark,
|
||||
fg = c.bg_dark,
|
||||
}
|
||||
end,
|
||||
})
|
||||
tokyonight.load()
|
||||
end,
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
local M = {
|
||||
run = ":TSUpdate",
|
||||
event = "User PackerDefered",
|
||||
module = "nvim-treesitter",
|
||||
requires = {
|
||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||
"RRethy/nvim-treesitter-textsubjects",
|
||||
@ -14,9 +15,100 @@ function M.config()
|
||||
"css",
|
||||
"go",
|
||||
"lua",
|
||||
"vim",
|
||||
"help",
|
||||
"fish",
|
||||
"gitignore",
|
||||
},
|
||||
sync_install = false,
|
||||
auto_install = true,
|
||||
highlight = { enable = true },
|
||||
indent = { enable = false },
|
||||
context_commentstring = { enable = true, enable_autocmd = false },
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
init_selection = "<C-n>",
|
||||
node_incremental = "<C-n>",
|
||||
scope_incremental = "<C-s>",
|
||||
node_decremental = "<C-r>",
|
||||
},
|
||||
},
|
||||
refactor = {
|
||||
smart_rename = {
|
||||
enable = true,
|
||||
client = {
|
||||
smart_rename = "<leader>cr",
|
||||
},
|
||||
},
|
||||
navigation = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
-- goto_definition = "gd",
|
||||
-- list_definitions = "gnD",
|
||||
-- list_definitions_toc = "gO",
|
||||
-- goto_next_usage = "<a-*>",
|
||||
-- goto_previous_usage = "<a-#>",
|
||||
},
|
||||
},
|
||||
},
|
||||
query_linter = {
|
||||
enable = true,
|
||||
use_virtual_text = true,
|
||||
lint_events = { "BufWrite", "CursorHold" },
|
||||
},
|
||||
textsubjects = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
["."] = "textsubjects-smart",
|
||||
[";"] = "textsubjects-container-outer",
|
||||
},
|
||||
},
|
||||
playground = {
|
||||
enable = true,
|
||||
disable = {},
|
||||
updatetime = 25, -- Debounced time for highlighting nodes in the playground from source code
|
||||
persist_queries = true, -- Whether the query persists across vim sessions
|
||||
keybindings = {
|
||||
toggle_query_editor = "o",
|
||||
toggle_hl_groups = "i",
|
||||
toggle_injected_languages = "t",
|
||||
toggle_anonymous_nodes = "a",
|
||||
toggle_language_display = "I",
|
||||
focus_language = "f",
|
||||
unfocus_language = "F",
|
||||
update = "R",
|
||||
goto_node = "<cr>",
|
||||
show_help = "?",
|
||||
},
|
||||
},
|
||||
textobjects = {
|
||||
select = {
|
||||
enable = true,
|
||||
lookahead = true,
|
||||
keymaps = {
|
||||
-- You can use the capture groups defined in textobjects.scm
|
||||
["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 = { ["]f"] = "@function.outer", ["]c"] = "@class.outer" },
|
||||
goto_next_end = { ["]F"] = "@function.outer", ["]C"] = "@class.outer" },
|
||||
goto_previous_start = { ["[f"] = "@function.outer", ["[c"] = "@class.outer" },
|
||||
goto_previous_end = { ["[F"] = "@function.outer", ["[C"] = "@class.outer" },
|
||||
},
|
||||
lsp_interop = {
|
||||
enable = true,
|
||||
peek_definition_code = {
|
||||
["gD"] = "@function.outer",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
|
21
lua/plugins/windows.lua
Normal file
21
lua/plugins/windows.lua
Normal file
@ -0,0 +1,21 @@
|
||||
local M = {
|
||||
event = "User PackerDefered",
|
||||
requires = {
|
||||
{ "anuvyklack/middleclass", module = "middleclass" },
|
||||
{ "anuvyklack/animation.nvim", module = "animation" },
|
||||
},
|
||||
}
|
||||
|
||||
function M.config()
|
||||
vim.o.winwidth = 5
|
||||
vim.o.winminwidth = 5
|
||||
vim.o.equalalways = false
|
||||
require("windows").setup({
|
||||
animation = {
|
||||
duration = 150,
|
||||
},
|
||||
})
|
||||
vim.keymap.set("n", "<leader>Z", "<Cmd>WindowsMaximize<CR>")
|
||||
end
|
||||
|
||||
return M
|
@ -1,7 +1,44 @@
|
||||
-- selene: allow(global_usage)
|
||||
_G.dump = function(...)
|
||||
vim.pretty_print(...)
|
||||
end
|
||||
|
||||
_G.dumpp = function(...)
|
||||
local msg = vim.inspect(...)
|
||||
vim.notify("```lua\n" .. msg .. "\n```", vim.log.levels.INFO, {
|
||||
title = "Debug",
|
||||
on_open = function(win)
|
||||
vim.api.nvim_win_set_option(win, "conceallevel", 3)
|
||||
local buf = vim.api.nvim_win_get_buf(win)
|
||||
vim.api.nvim_buf_set_option(buf, "filetype", "markdown")
|
||||
vim.api.nvim_win_set_option(win, "spell", false)
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
-- selene: allow(global_usage)
|
||||
_G.profile = function(cmd, times)
|
||||
times = times or 100
|
||||
local args = {}
|
||||
if type(cmd) == "string" then
|
||||
args = { cmd }
|
||||
cmd = vim.cmd
|
||||
end
|
||||
local start = vim.loop.hrtime()
|
||||
for _ = 1, times, 1 do
|
||||
local ok = pcall(cmd, unpack(args))
|
||||
if not ok then
|
||||
error("Command failed: " .. tostring(ok) .. " " .. vim.inspect({ cmd = cmd, args = args }))
|
||||
end
|
||||
end
|
||||
print(((vim.loop.hrtime() - start) / 1000000 / times) .. "ms")
|
||||
end
|
||||
|
||||
local M = {}
|
||||
|
||||
function M.packer_deferred()
|
||||
vim.cmd([[do User PackerDefered]])
|
||||
function M.packer_defered()
|
||||
--vim.cmd([[do User PackerDefered]])
|
||||
vim.api.nvim_exec_autocmds("User", { pattern = "PackerDefered" })
|
||||
end
|
||||
|
||||
function M.require(mod)
|
||||
@ -38,4 +75,157 @@ function M.info(msg, name)
|
||||
vim.notify(msg, vim.log.levels.INFO, { title = name or "init.lua" })
|
||||
end
|
||||
|
||||
function M.toggle(option, silent)
|
||||
local info = vim.api.nvim_get_option_info(option)
|
||||
local scopes = { buf = "bo", win = "wo", global = "o" }
|
||||
local scope = scopes[info.scope]
|
||||
local options = vim[scope]
|
||||
options[option] = not options[option]
|
||||
if silent ~= true then
|
||||
if options[option] then
|
||||
M.info("enabled vim." .. scope .. "." .. option, "Toggle")
|
||||
else
|
||||
M.warn("disabled vim." .. scope .. "." .. option, "Toggle")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
---@param fn fun(buf: buffer, win: window)
|
||||
function M.float(fn)
|
||||
local buf = vim.api.nvim_create_buf(false, true)
|
||||
local vpad = 4
|
||||
local hpad = 10
|
||||
local win = vim.api.nvim_open_win(buf, true, {
|
||||
relative = "editor",
|
||||
width = vim.o.columns - hpad * 2,
|
||||
height = vim.o.lines - vpad * 2,
|
||||
row = vpad,
|
||||
col = hpad,
|
||||
style = "minimal",
|
||||
border = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" },
|
||||
})
|
||||
|
||||
local function close()
|
||||
if vim.api.nvim_buf_is_valid(buf) then
|
||||
vim.api.nvim_buf_delete(buf, { force = true })
|
||||
end
|
||||
if vim.api.nvim_win_is_valid(win) then
|
||||
vim.api.nvim_win_close(win, true)
|
||||
end
|
||||
end
|
||||
|
||||
vim.keymap.set("n", "<ESC>", close, { buffer = buf, nowait = true })
|
||||
vim.keymap.set("n", "q", close, { buffer = buf, nowait = true })
|
||||
vim.api.nvim_create_autocmd({ "BufDelete", "BufLeave", "BufHidden" }, {
|
||||
once = true,
|
||||
buffer = buf,
|
||||
callback = close,
|
||||
})
|
||||
fn(buf, win)
|
||||
end
|
||||
|
||||
function M.float_cmd(cmd)
|
||||
M.float(function(buf)
|
||||
local output = vim.api.nvim_exec(cmd, true)
|
||||
local lines = vim.split(output, "\n")
|
||||
vim.api.nvim_buf_set_lines(buf, 0, -1, true, lines)
|
||||
end)
|
||||
end
|
||||
|
||||
function M.float_terminal(cmd)
|
||||
M.float(function(buf, win)
|
||||
vim.fn.termopen(cmd)
|
||||
local autocmd = {
|
||||
"autocmd! TermClose <buffer> lua",
|
||||
string.format("vim.api.nvim_win_close(%d, {force = true});", win),
|
||||
string.format("vim.api.nvim_buf_delete(%d, {force = true});", buf),
|
||||
}
|
||||
vim.cmd(table.concat(autocmd, " "))
|
||||
vim.cmd([[startinsert]])
|
||||
end)
|
||||
end
|
||||
|
||||
function M.exists(fname)
|
||||
local stat = vim.loop.fs_stat(fname)
|
||||
return (stat and stat.type) or false
|
||||
end
|
||||
|
||||
function M.fqn(fname)
|
||||
fname = vim.fn.fnamemodify(fname, ":p")
|
||||
return vim.loop.fs_realpath(fname) or fname
|
||||
end
|
||||
|
||||
function M.clipman()
|
||||
local file = M.fqn("~/.local/share/clipman.json")
|
||||
if M.exists(file) then
|
||||
local f = io.open(file)
|
||||
if not f then
|
||||
return
|
||||
end
|
||||
local data = f:read("*a")
|
||||
f:close()
|
||||
|
||||
-- allow empty files
|
||||
data = vim.trim(data)
|
||||
if data ~= "" then
|
||||
local ok, json = pcall(vim.fn.json_decode, data)
|
||||
if ok and json then
|
||||
local items = {}
|
||||
for i = #json, 1, -1 do
|
||||
items[#items + 1] = json[i]
|
||||
end
|
||||
vim.ui.select(items, {
|
||||
prompt = "Clipman",
|
||||
}, function(choice)
|
||||
if choice then
|
||||
vim.api.nvim_paste(choice, true, 1)
|
||||
-- vim.fn.setreg("+", choice)
|
||||
end
|
||||
end)
|
||||
else
|
||||
vim.notify(("failed to load clipman from %s"):format(file), vim.log.levels.ERROR)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function M.debounce(ms, fn)
|
||||
local timer = vim.loop.new_timer()
|
||||
return function(...)
|
||||
local argv = { ... }
|
||||
timer:start(ms, 0, function()
|
||||
timer:stop()
|
||||
vim.schedule_wrap(fn)(unpack(argv))
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
function M.throttle(ms, fn)
|
||||
local timer = vim.loop.new_timer()
|
||||
local running = false
|
||||
return function(...)
|
||||
if not running then
|
||||
local argv = { ... }
|
||||
local argc = select("#", ...)
|
||||
|
||||
timer:start(ms, 0, function()
|
||||
running = false
|
||||
pcall(vim.schedule_wrap(fn), unpack(argv, 1, argc))
|
||||
end)
|
||||
running = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function M.version()
|
||||
local v = vim.version()
|
||||
if not v.prerelease then
|
||||
vim.notify(
|
||||
("Neovim v%d.%d.%d"):format(v.major, v.minor, v.patch),
|
||||
vim.log.levels.WARN,
|
||||
{ title = "Neovim: not running nightly!" }
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
|
@ -8,10 +8,9 @@ function M.bootstrap()
|
||||
local fn = vim.fn
|
||||
local install_path = fn.stdpath("data") .. "/site/pack/packer/opt/packer.nvim"
|
||||
if fn.empty(fn.glob(install_path)) > 0 then
|
||||
fn.system({"git", "clone", "--depth", "1", "https://github.com/wbthomason/packer.nvim", install_path})
|
||||
fn.system({ "git", "clone", "--depth", "1", "https://github.com/wbthomason/packer.nvim", install_path })
|
||||
return true
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function M.auto_compile()
|
||||
@ -102,6 +101,7 @@ function M.plugin(pkg)
|
||||
end
|
||||
|
||||
function M.setup(config, fn)
|
||||
vim.fn.setenv("MACOSX_DEPLOYMENT_TARGET", "10.15")
|
||||
local bootstrapped = M.bootstrap()
|
||||
M.auto_compile()
|
||||
|
||||
|
@ -74,6 +74,193 @@ end
|
||||
time([[try_loadstring definition]], false)
|
||||
time([[Defining packer_plugins]], true)
|
||||
_G.packer_plugins = {
|
||||
LuaSnip = {
|
||||
after = { "friendly-snippets" },
|
||||
config = { 'require("plugins.luasnip").config()' },
|
||||
loaded = false,
|
||||
needs_bufread = true,
|
||||
only_cond = false,
|
||||
path = "/home/kjuulh/.local/share/nvim/site/pack/packer/opt/LuaSnip",
|
||||
url = "https://github.com/L3MON4D3/LuaSnip"
|
||||
},
|
||||
["animation.nvim"] = {
|
||||
load_after = {
|
||||
["windows.nvim"] = true
|
||||
},
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
only_cond = false,
|
||||
path = "/home/kjuulh/.local/share/nvim/site/pack/packer/opt/animation.nvim",
|
||||
url = "https://github.com/anuvyklack/animation.nvim"
|
||||
},
|
||||
["cmp-buffer"] = {
|
||||
after_files = { "/home/kjuulh/.local/share/nvim/site/pack/packer/opt/cmp-buffer/after/plugin/cmp_buffer.lua" },
|
||||
load_after = {
|
||||
["nvim-cmp"] = true
|
||||
},
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
path = "/home/kjuulh/.local/share/nvim/site/pack/packer/opt/cmp-buffer",
|
||||
url = "https://github.com/hrsh7th/cmp-buffer"
|
||||
},
|
||||
["cmp-cmdline"] = {
|
||||
after_files = { "/home/kjuulh/.local/share/nvim/site/pack/packer/opt/cmp-cmdline/after/plugin/cmp_cmdline.lua" },
|
||||
load_after = {
|
||||
["nvim-cmp"] = true
|
||||
},
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
path = "/home/kjuulh/.local/share/nvim/site/pack/packer/opt/cmp-cmdline",
|
||||
url = "https://github.com/hrsh7th/cmp-cmdline"
|
||||
},
|
||||
["cmp-cmdline-history"] = {
|
||||
after_files = { "/home/kjuulh/.local/share/nvim/site/pack/packer/opt/cmp-cmdline-history/after/plugin/cmp_cmdline_history.lua" },
|
||||
load_after = {
|
||||
["nvim-cmp"] = true
|
||||
},
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
path = "/home/kjuulh/.local/share/nvim/site/pack/packer/opt/cmp-cmdline-history",
|
||||
url = "https://github.com/dmitmel/cmp-cmdline-history"
|
||||
},
|
||||
["cmp-emoji"] = {
|
||||
after_files = { "/home/kjuulh/.local/share/nvim/site/pack/packer/opt/cmp-emoji/after/plugin/cmp_emoji.lua" },
|
||||
load_after = {
|
||||
["nvim-cmp"] = true
|
||||
},
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
path = "/home/kjuulh/.local/share/nvim/site/pack/packer/opt/cmp-emoji",
|
||||
url = "https://github.com/hrsh7th/cmp-emoji"
|
||||
},
|
||||
["cmp-nvim-lsp"] = {
|
||||
after_files = { "/home/kjuulh/.local/share/nvim/site/pack/packer/opt/cmp-nvim-lsp/after/plugin/cmp_nvim_lsp.lua" },
|
||||
load_after = {
|
||||
["nvim-cmp"] = true
|
||||
},
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
only_cond = false,
|
||||
path = "/home/kjuulh/.local/share/nvim/site/pack/packer/opt/cmp-nvim-lsp",
|
||||
url = "https://github.com/hrsh7th/cmp-nvim-lsp"
|
||||
},
|
||||
["cmp-nvim-lsp-signature-help"] = {
|
||||
after_files = { "/home/kjuulh/.local/share/nvim/site/pack/packer/opt/cmp-nvim-lsp-signature-help/after/plugin/cmp_nvim_lsp_signature_help.lua" },
|
||||
load_after = {
|
||||
["nvim-cmp"] = true
|
||||
},
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
path = "/home/kjuulh/.local/share/nvim/site/pack/packer/opt/cmp-nvim-lsp-signature-help",
|
||||
url = "https://github.com/hrsh7th/cmp-nvim-lsp-signature-help"
|
||||
},
|
||||
["cmp-path"] = {
|
||||
after_files = { "/home/kjuulh/.local/share/nvim/site/pack/packer/opt/cmp-path/after/plugin/cmp_path.lua" },
|
||||
load_after = {
|
||||
["nvim-cmp"] = true
|
||||
},
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
path = "/home/kjuulh/.local/share/nvim/site/pack/packer/opt/cmp-path",
|
||||
url = "https://github.com/hrsh7th/cmp-path"
|
||||
},
|
||||
cmp_luasnip = {
|
||||
after_files = { "/home/kjuulh/.local/share/nvim/site/pack/packer/opt/cmp_luasnip/after/plugin/cmp_luasnip.lua" },
|
||||
load_after = {
|
||||
["nvim-cmp"] = true
|
||||
},
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
path = "/home/kjuulh/.local/share/nvim/site/pack/packer/opt/cmp_luasnip",
|
||||
url = "https://github.com/saadparwaiz1/cmp_luasnip"
|
||||
},
|
||||
["dashboard-nvim"] = {
|
||||
config = { 'require("plugins.dashboard").config()' },
|
||||
loaded = true,
|
||||
path = "/home/kjuulh/.local/share/nvim/site/pack/packer/start/dashboard-nvim",
|
||||
url = "https://github.com/glepnir/dashboard-nvim"
|
||||
},
|
||||
["dressing.nvim"] = {
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
only_cond = false,
|
||||
path = "/home/kjuulh/.local/share/nvim/site/pack/packer/opt/dressing.nvim",
|
||||
url = "https://github.com/stevearc/dressing.nvim"
|
||||
},
|
||||
["fidget.nvim"] = {
|
||||
config = { "\27LJ\2\n¼\1\0\0\4\0\v\0\0156\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\4\0005\3\3\0=\3\5\2B\0\2\0016\0\6\0009\0\a\0009\0\b\0'\2\t\0005\3\n\0B\0\3\1K\0\1\0\1\0\1\fcommand\24silent! FidgetClose\16VimLeavePre\24nvim_create_autocmd\bapi\bvim\vwindow\1\0\0\1\0\1\rrelative\veditor\nsetup\vfidget\frequire\0" },
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
only_cond = false,
|
||||
path = "/home/kjuulh/.local/share/nvim/site/pack/packer/opt/fidget.nvim",
|
||||
url = "https://github.com/j-hui/fidget.nvim"
|
||||
},
|
||||
["friendly-snippets"] = {
|
||||
config = { "\27LJ\2\nM\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\14lazy_load luasnip.loaders.from_vscode\frequire\0" },
|
||||
load_after = {
|
||||
LuaSnip = true
|
||||
},
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
path = "/home/kjuulh/.local/share/nvim/site/pack/packer/opt/friendly-snippets",
|
||||
url = "https://github.com/rafamadriz/friendly-snippets"
|
||||
},
|
||||
["hlargs.nvim"] = {
|
||||
config = { "\27LJ\2\nv\0\0\6\0\a\0\0146\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\5\0006\3\0\0'\5\3\0B\3\2\0029\3\2\3B\3\1\0029\3\4\3=\3\6\2B\0\2\1K\0\1\0\ncolor\1\0\0\vyellow\22tokyonight.colors\nsetup\vhlargs\frequire\0" },
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
only_cond = false,
|
||||
path = "/home/kjuulh/.local/share/nvim/site/pack/packer/opt/hlargs.nvim",
|
||||
url = "https://github.com/m-demare/hlargs.nvim"
|
||||
},
|
||||
["indent-blankline.nvim"] = {
|
||||
config = { 'require("plugins.indent-blankline").config()' },
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
only_cond = false,
|
||||
path = "/home/kjuulh/.local/share/nvim/site/pack/packer/opt/indent-blankline.nvim",
|
||||
url = "https://github.com/lukas-reineke/indent-blankline.nvim"
|
||||
},
|
||||
["lua-dev.nvim"] = {
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
only_cond = false,
|
||||
path = "/home/kjuulh/.local/share/nvim/site/pack/packer/opt/lua-dev.nvim",
|
||||
url = "https://github.com/folke/lua-dev.nvim"
|
||||
},
|
||||
["lualine.nvim"] = {
|
||||
config = { 'require("plugins.lualine").config()' },
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
only_cond = false,
|
||||
path = "/home/kjuulh/.local/share/nvim/site/pack/packer/opt/lualine.nvim",
|
||||
url = "https://github.com/nvim-lualine/lualine.nvim"
|
||||
},
|
||||
["mason-lspconfig.nvim"] = {
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
only_cond = false,
|
||||
path = "/home/kjuulh/.local/share/nvim/site/pack/packer/opt/mason-lspconfig.nvim",
|
||||
url = "https://github.com/williamboman/mason-lspconfig.nvim"
|
||||
},
|
||||
["mason.nvim"] = {
|
||||
config = { 'require("plugins.mason").config()' },
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
only_cond = false,
|
||||
path = "/home/kjuulh/.local/share/nvim/site/pack/packer/opt/mason.nvim",
|
||||
url = "https://github.com/williamboman/mason.nvim"
|
||||
},
|
||||
middleclass = {
|
||||
load_after = {
|
||||
["windows.nvim"] = true
|
||||
},
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
only_cond = false,
|
||||
path = "/home/kjuulh/.local/share/nvim/site/pack/packer/opt/middleclass",
|
||||
url = "https://github.com/anuvyklack/middleclass"
|
||||
},
|
||||
["neo-tree.nvim"] = {
|
||||
commands = { "Neotree" },
|
||||
config = { 'require("plugins.neo-tree").config()' },
|
||||
@ -83,6 +270,31 @@ _G.packer_plugins = {
|
||||
path = "/home/kjuulh/.local/share/nvim/site/pack/packer/opt/neo-tree.nvim",
|
||||
url = "https://github.com/nvim-neo-tree/neo-tree.nvim"
|
||||
},
|
||||
neogen = {
|
||||
config = { "\27LJ\2\nR\0\0\3\0\4\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\3\0B\0\2\1K\0\1\0\1\0\1\19snippet_engine\fluasnip\nsetup\vneogen\frequire\0" },
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
only_cond = false,
|
||||
path = "/home/kjuulh/.local/share/nvim/site/pack/packer/opt/neogen",
|
||||
url = "https://github.com/danymat/neogen"
|
||||
},
|
||||
["neoscroll.nvim"] = {
|
||||
config = { 'require("plugins.neoscroll").config()' },
|
||||
keys = { { "", "<C-u>" }, { "", "<C-d>" }, { "", "gg" }, { "", "G" } },
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
only_cond = false,
|
||||
path = "/home/kjuulh/.local/share/nvim/site/pack/packer/opt/neoscroll.nvim",
|
||||
url = "https://github.com/karb94/neoscroll.nvim"
|
||||
},
|
||||
["noice.nvim"] = {
|
||||
config = { "\27LJ\2\n3\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\nnoice\frequire\0" },
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
only_cond = false,
|
||||
path = "/home/kjuulh/.local/share/nvim/site/pack/packer/opt/noice.nvim",
|
||||
url = "https://github.com/folke/noice.nvim"
|
||||
},
|
||||
["nui.nvim"] = {
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
@ -90,8 +302,81 @@ _G.packer_plugins = {
|
||||
path = "/home/kjuulh/.local/share/nvim/site/pack/packer/opt/nui.nvim",
|
||||
url = "https://github.com/MunifTanjim/nui.nvim"
|
||||
},
|
||||
["null-ls.nvim"] = {
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
only_cond = false,
|
||||
path = "/home/kjuulh/.local/share/nvim/site/pack/packer/opt/null-ls.nvim",
|
||||
url = "https://github.com/jose-elias-alvarez/null-ls.nvim"
|
||||
},
|
||||
["nvim-autopairs"] = {
|
||||
config = { 'require("plugins.autopairs").config()' },
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
only_cond = false,
|
||||
path = "/home/kjuulh/.local/share/nvim/site/pack/packer/opt/nvim-autopairs",
|
||||
url = "https://github.com/windwp/nvim-autopairs"
|
||||
},
|
||||
["nvim-bufferline.lua"] = {
|
||||
config = { 'require("plugins.bufferline").config()' },
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
only_cond = false,
|
||||
path = "/home/kjuulh/.local/share/nvim/site/pack/packer/opt/nvim-bufferline.lua",
|
||||
url = "https://github.com/akinsho/nvim-bufferline.lua"
|
||||
},
|
||||
["nvim-cmp"] = {
|
||||
after = { "cmp_luasnip", "cmp-buffer", "cmp-path", "cmp-cmdline-history", "cmp-cmdline", "cmp-emoji", "cmp-nvim-lsp", "cmp-nvim-lsp-signature-help" },
|
||||
config = { 'require("plugins.cmp").config()' },
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
only_cond = false,
|
||||
path = "/home/kjuulh/.local/share/nvim/site/pack/packer/opt/nvim-cmp",
|
||||
url = "https://github.com/hrsh7th/nvim-cmp"
|
||||
},
|
||||
["nvim-colorizer.lua"] = {
|
||||
config = { 'require("plugins.colorizer").config()' },
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
only_cond = false,
|
||||
path = "/home/kjuulh/.local/share/nvim/site/pack/packer/opt/nvim-colorizer.lua",
|
||||
url = "https://github.com/NvChad/nvim-colorizer.lua"
|
||||
},
|
||||
["nvim-lspconfig"] = {
|
||||
config = { 'require("plugins.lsp").config()' },
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
only_cond = false,
|
||||
path = "/home/kjuulh/.local/share/nvim/site/pack/packer/opt/nvim-lspconfig",
|
||||
url = "https://github.com/neovim/nvim-lspconfig"
|
||||
},
|
||||
["nvim-navic"] = {
|
||||
config = { "\27LJ\2\nˆ\1\0\0\3\0\a\0\v6\0\0\0009\0\1\0+\1\2\0=\1\2\0006\0\3\0'\2\4\0B\0\2\0029\0\5\0005\2\6\0B\0\2\1K\0\1\0\1\0\3\14separator\6 \16depth_limit\3\5\14highlight\2\nsetup\15nvim-navic\frequire\18navic_silence\6g\bvim\0" },
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
only_cond = false,
|
||||
path = "/home/kjuulh/.local/share/nvim/site/pack/packer/opt/nvim-navic",
|
||||
url = "https://github.com/SmiteshP/nvim-navic"
|
||||
},
|
||||
["nvim-neoclip.lua"] = {
|
||||
after = { "sqlite.lua" },
|
||||
config = { "\27LJ\2\nh\0\0\3\0\4\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\3\0B\0\2\1K\0\1\0\1\0\2\30enable_persistent_history\2\20continuous_sync\2\nsetup\fneoclip\frequire\0" },
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
only_cond = false,
|
||||
path = "/home/kjuulh/.local/share/nvim/site/pack/packer/opt/nvim-neoclip.lua",
|
||||
url = "https://github.com/AckslD/nvim-neoclip.lua"
|
||||
},
|
||||
["nvim-notify"] = {
|
||||
config = { "\27LJ\2\nƒ\1\0\0\4\0\t\0\0176\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\a\0006\3\3\0009\3\4\0039\3\5\0039\3\6\3=\3\b\2B\0\2\0016\0\3\0006\1\0\0'\3\1\0B\1\2\2=\1\1\0K\0\1\0\nlevel\1\0\1\bfps\3\20\tINFO\vlevels\blog\bvim\nsetup\vnotify\frequire\0" },
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
only_cond = false,
|
||||
path = "/home/kjuulh/.local/share/nvim/site/pack/packer/opt/nvim-notify",
|
||||
url = "https://github.com/rcarriga/nvim-notify"
|
||||
},
|
||||
["nvim-treesitter"] = {
|
||||
after = { "nvim-treesitter-textsubjects", "nvim-treesitter-textobjects", "nvim-treesitter-refactor" },
|
||||
after = { "nvim-treesitter-textobjects", "nvim-treesitter-textsubjects", "nvim-treesitter-refactor" },
|
||||
config = { 'require("plugins.treesitter").config()' },
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
@ -140,6 +425,14 @@ _G.packer_plugins = {
|
||||
path = "/home/kjuulh/.local/share/nvim/site/pack/packer/opt/packer.nvim",
|
||||
url = "https://github.com/wbthomason/packer.nvim"
|
||||
},
|
||||
["persistence.nvim"] = {
|
||||
config = { "\27LJ\2\n9\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\16persistence\frequire\0" },
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
only_cond = false,
|
||||
path = "/home/kjuulh/.local/share/nvim/site/pack/packer/opt/persistence.nvim",
|
||||
url = "https://github.com/folke/persistence.nvim"
|
||||
},
|
||||
playground = {
|
||||
commands = { "TSHighlightCapturesUnderCursor", "TSPlaygroundToggle" },
|
||||
loaded = false,
|
||||
@ -154,14 +447,153 @@ _G.packer_plugins = {
|
||||
only_cond = false,
|
||||
path = "/home/kjuulh/.local/share/nvim/site/pack/packer/opt/plenary.nvim",
|
||||
url = "https://github.com/nvim-lua/plenary.nvim"
|
||||
},
|
||||
["sqlite.lua"] = {
|
||||
load_after = {
|
||||
["nvim-neoclip.lua"] = true
|
||||
},
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
only_cond = false,
|
||||
path = "/home/kjuulh/.local/share/nvim/site/pack/packer/opt/sqlite.lua",
|
||||
url = "https://github.com/kkharji/sqlite.lua"
|
||||
},
|
||||
["telescope-file-browser.nvim"] = {
|
||||
load_after = {
|
||||
["telescope.nvim"] = true
|
||||
},
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
only_cond = false,
|
||||
path = "/home/kjuulh/.local/share/nvim/site/pack/packer/opt/telescope-file-browser.nvim",
|
||||
url = "https://github.com/nvim-telescope/telescope-file-browser.nvim"
|
||||
},
|
||||
["telescope-fzf-native.nvim"] = {
|
||||
load_after = {
|
||||
["telescope.nvim"] = true
|
||||
},
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
only_cond = false,
|
||||
path = "/home/kjuulh/.local/share/nvim/site/pack/packer/opt/telescope-fzf-native.nvim",
|
||||
url = "https://github.com/nvim-telescope/telescope-fzf-native.nvim"
|
||||
},
|
||||
["telescope-project.nvim"] = {
|
||||
load_after = {
|
||||
["telescope.nvim"] = true
|
||||
},
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
only_cond = false,
|
||||
path = "/home/kjuulh/.local/share/nvim/site/pack/packer/opt/telescope-project.nvim",
|
||||
url = "https://github.com/nvim-telescope/telescope-project.nvim"
|
||||
},
|
||||
["telescope-symbols.nvim"] = {
|
||||
load_after = {
|
||||
["telescope.nvim"] = true
|
||||
},
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
only_cond = false,
|
||||
path = "/home/kjuulh/.local/share/nvim/site/pack/packer/opt/telescope-symbols.nvim",
|
||||
url = "https://github.com/nvim-telescope/telescope-symbols.nvim"
|
||||
},
|
||||
["telescope-z.nvim"] = {
|
||||
load_after = {
|
||||
["telescope.nvim"] = true
|
||||
},
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
only_cond = false,
|
||||
path = "/home/kjuulh/.local/share/nvim/site/pack/packer/opt/telescope-z.nvim",
|
||||
url = "https://github.com/nvim-telescope/telescope-z.nvim"
|
||||
},
|
||||
["telescope.nvim"] = {
|
||||
after = { "telescope-z.nvim", "telescope-file-browser.nvim", "telescope-fzf-native.nvim", "telescope-symbols.nvim", "telescope-project.nvim" },
|
||||
commands = { "Telescope" },
|
||||
config = { 'require("plugins.telescope").config()' },
|
||||
loaded = false,
|
||||
needs_bufread = true,
|
||||
only_cond = false,
|
||||
path = "/home/kjuulh/.local/share/nvim/site/pack/packer/opt/telescope.nvim",
|
||||
url = "https://github.com/nvim-telescope/telescope.nvim"
|
||||
},
|
||||
["tokyonight.nvim"] = {
|
||||
config = { 'require("plugins.tokyonight").config()' },
|
||||
loaded = true,
|
||||
path = "/home/kjuulh/.local/share/nvim/site/pack/packer/start/tokyonight.nvim",
|
||||
url = "https://github.com/folke/tokyonight.nvim"
|
||||
},
|
||||
["trouble.nvim"] = {
|
||||
commands = { "TroubleToggle", "Trouble" },
|
||||
config = { "\27LJ\2\n]\0\0\3\0\4\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\3\0B\0\2\1K\0\1\0\1\0\2\25use_diagnostic_signs\2\14auto_open\1\nsetup\ftrouble\frequire\0" },
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
only_cond = false,
|
||||
path = "/home/kjuulh/.local/share/nvim/site/pack/packer/opt/trouble.nvim",
|
||||
url = "https://github.com/folke/trouble.nvim"
|
||||
},
|
||||
["vim-startuptime"] = {
|
||||
commands = { "StartupTime" },
|
||||
config = { "\27LJ\2\n3\0\0\2\0\3\0\0056\0\0\0009\0\1\0)\1\n\0=\1\2\0K\0\1\0\22startuptime_tries\6g\bvim\0" },
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
only_cond = false,
|
||||
path = "/home/kjuulh/.local/share/nvim/site/pack/packer/opt/vim-startuptime",
|
||||
url = "https://github.com/dstein64/vim-startuptime"
|
||||
},
|
||||
["which-key.nvim"] = {
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
only_cond = false,
|
||||
path = "/home/kjuulh/.local/share/nvim/site/pack/packer/opt/which-key.nvim",
|
||||
url = "https://github.com/folke/which-key.nvim"
|
||||
},
|
||||
["windows.nvim"] = {
|
||||
after = { "animation.nvim", "middleclass" },
|
||||
config = { 'require("plugins.windows").config()' },
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
only_cond = false,
|
||||
path = "/home/kjuulh/.local/share/nvim/site/pack/packer/opt/windows.nvim",
|
||||
url = "https://github.com/anuvyklack/windows.nvim"
|
||||
}
|
||||
}
|
||||
|
||||
time([[Defining packer_plugins]], false)
|
||||
local module_lazy_loads = {
|
||||
["^animation"] = "animation.nvim",
|
||||
["^cmp"] = "nvim-cmp",
|
||||
["^cmp_nvim_lsp"] = "cmp-nvim-lsp",
|
||||
["^fidget"] = "fidget.nvim",
|
||||
["^hlargs"] = "hlargs.nvim",
|
||||
["^lua%-dev"] = "lua-dev.nvim",
|
||||
["^lualine"] = "lualine.nvim",
|
||||
["^luasnip"] = "LuaSnip",
|
||||
["^mason"] = "mason.nvim",
|
||||
["^mason%-lspconfig"] = "mason-lspconfig.nvim",
|
||||
["^middleclass"] = "middleclass",
|
||||
["^neogen"] = "neogen",
|
||||
["^noice"] = "noice.nvim",
|
||||
["^notify"] = "nvim-notify",
|
||||
["^nui"] = "nui.nvim",
|
||||
["^null%-ls"] = "null-ls.nvim",
|
||||
["^nvim%-autopairs"] = "nvim-autopairs",
|
||||
["^nvim%-navic"] = "nvim-navic",
|
||||
["^nvim%-treesitter"] = "nvim-treesitter",
|
||||
["^nvim%-web%-devicons"] = "nvim-web-devicons",
|
||||
["^plenary"] = "plenary.nvim"
|
||||
["^persistence"] = "persistence.nvim",
|
||||
["^plenary"] = "plenary.nvim",
|
||||
["^sqlite"] = "sqlite.lua",
|
||||
["^telescope"] = "telescope.nvim",
|
||||
["^telescope%._extensions%.file_browser"] = "telescope-file-browser.nvim",
|
||||
["^telescope%._extensions%.fzf"] = "telescope-fzf-native.nvim",
|
||||
["^telescope%._extensions%.neoclip"] = "nvim-neoclip.lua",
|
||||
["^telescope%._extensions%.project"] = "telescope-project.nvim",
|
||||
["^telescope%._extensions%.symbols"] = "telescope-symbols.nvim",
|
||||
["^telescope%._extensions%.z"] = "telescope-z.nvim",
|
||||
["^trouble"] = "trouble.nvim",
|
||||
["^which%-key"] = "which-key.nvim"
|
||||
}
|
||||
local lazy_load_called = {['packer.load'] = true}
|
||||
local function lazy_load_module(module_name)
|
||||
@ -188,19 +620,47 @@ if not vim.g.packer_custom_loader_enabled then
|
||||
vim.g.packer_custom_loader_enabled = true
|
||||
end
|
||||
|
||||
-- Setup for: telescope.nvim
|
||||
time([[Setup for telescope.nvim]], true)
|
||||
require("plugins.telescope").init()
|
||||
time([[Setup for telescope.nvim]], false)
|
||||
-- Config for: dashboard-nvim
|
||||
time([[Config for dashboard-nvim]], true)
|
||||
require("plugins.dashboard").config()
|
||||
time([[Config for dashboard-nvim]], false)
|
||||
-- Config for: tokyonight.nvim
|
||||
time([[Config for tokyonight.nvim]], true)
|
||||
require("plugins.tokyonight").config()
|
||||
time([[Config for tokyonight.nvim]], false)
|
||||
|
||||
-- Command lazy-loads
|
||||
time([[Defining lazy-load commands]], true)
|
||||
pcall(vim.cmd, [[command -nargs=* -range -bang -complete=file TSHighlightCapturesUnderCursor lua require("packer.load")({'playground'}, { cmd = "TSHighlightCapturesUnderCursor", l1 = <line1>, l2 = <line2>, bang = <q-bang>, args = <q-args>, mods = "<mods>" }, _G.packer_plugins)]])
|
||||
pcall(vim.cmd, [[command -nargs=* -range -bang -complete=file Telescope lua require("packer.load")({'telescope.nvim'}, { cmd = "Telescope", l1 = <line1>, l2 = <line2>, bang = <q-bang>, args = <q-args>, mods = "<mods>" }, _G.packer_plugins)]])
|
||||
pcall(vim.cmd, [[command -nargs=* -range -bang -complete=file TroubleToggle lua require("packer.load")({'trouble.nvim'}, { cmd = "TroubleToggle", l1 = <line1>, l2 = <line2>, bang = <q-bang>, args = <q-args>, mods = "<mods>" }, _G.packer_plugins)]])
|
||||
pcall(vim.cmd, [[command -nargs=* -range -bang -complete=file Trouble lua require("packer.load")({'trouble.nvim'}, { cmd = "Trouble", l1 = <line1>, l2 = <line2>, bang = <q-bang>, args = <q-args>, mods = "<mods>" }, _G.packer_plugins)]])
|
||||
pcall(vim.cmd, [[command -nargs=* -range -bang -complete=file Neotree lua require("packer.load")({'neo-tree.nvim'}, { cmd = "Neotree", l1 = <line1>, l2 = <line2>, bang = <q-bang>, args = <q-args>, mods = "<mods>" }, _G.packer_plugins)]])
|
||||
pcall(vim.cmd, [[command -nargs=* -range -bang -complete=file TSPlaygroundToggle lua require("packer.load")({'playground'}, { cmd = "TSPlaygroundToggle", l1 = <line1>, l2 = <line2>, bang = <q-bang>, args = <q-args>, mods = "<mods>" }, _G.packer_plugins)]])
|
||||
pcall(vim.cmd, [[command -nargs=* -range -bang -complete=file TSHighlightCapturesUnderCursor lua require("packer.load")({'playground'}, { cmd = "TSHighlightCapturesUnderCursor", l1 = <line1>, l2 = <line2>, bang = <q-bang>, args = <q-args>, mods = "<mods>" }, _G.packer_plugins)]])
|
||||
pcall(vim.cmd, [[command -nargs=* -range -bang -complete=file StartupTime lua require("packer.load")({'vim-startuptime'}, { cmd = "StartupTime", l1 = <line1>, l2 = <line2>, bang = <q-bang>, args = <q-args>, mods = "<mods>" }, _G.packer_plugins)]])
|
||||
time([[Defining lazy-load commands]], false)
|
||||
|
||||
-- Keymap lazy-loads
|
||||
time([[Defining lazy-load keymaps]], true)
|
||||
vim.cmd [[noremap <silent> <C-u> <cmd>lua require("packer.load")({'neoscroll.nvim'}, { keys = "<lt>C-u>", prefix = "" }, _G.packer_plugins)<cr>]]
|
||||
vim.cmd [[noremap <silent> G <cmd>lua require("packer.load")({'neoscroll.nvim'}, { keys = "G", prefix = "" }, _G.packer_plugins)<cr>]]
|
||||
vim.cmd [[noremap <silent> gg <cmd>lua require("packer.load")({'neoscroll.nvim'}, { keys = "gg", prefix = "" }, _G.packer_plugins)<cr>]]
|
||||
vim.cmd [[noremap <silent> <C-d> <cmd>lua require("packer.load")({'neoscroll.nvim'}, { keys = "<lt>C-d>", prefix = "" }, _G.packer_plugins)<cr>]]
|
||||
time([[Defining lazy-load keymaps]], false)
|
||||
|
||||
vim.cmd [[augroup packer_load_aucmds]]
|
||||
vim.cmd [[au!]]
|
||||
-- Event lazy-loads
|
||||
time([[Defining lazy-load event autocommands]], true)
|
||||
vim.cmd [[au User PackerDefered ++once lua require("packer.load")({'nvim-treesitter'}, { event = "User PackerDefered" }, _G.packer_plugins)]]
|
||||
vim.cmd [[au User PackerDefered ++once lua require("packer.load")({'dressing.nvim', 'hlargs.nvim', 'windows.nvim', 'nvim-notify', 'lualine.nvim', 'nvim-treesitter'}, { event = "User PackerDefered" }, _G.packer_plugins)]]
|
||||
vim.cmd [[au InsertEnter * ++once lua require("packer.load")({'nvim-cmp'}, { event = "InsertEnter *" }, _G.packer_plugins)]]
|
||||
vim.cmd [[au VimEnter * ++once lua require("packer.load")({'noice.nvim'}, { event = "VimEnter *" }, _G.packer_plugins)]]
|
||||
vim.cmd [[au BufReadPre * ++once lua require("packer.load")({'nvim-bufferline.lua', 'nvim-colorizer.lua', 'indent-blankline.nvim', 'nvim-lspconfig', 'trouble.nvim', 'persistence.nvim'}, { event = "BufReadPre *" }, _G.packer_plugins)]]
|
||||
vim.cmd [[au TextYankPost * ++once lua require("packer.load")({'nvim-neoclip.lua'}, { event = "TextYankPost *" }, _G.packer_plugins)]]
|
||||
time([[Defining lazy-load event autocommands]], false)
|
||||
vim.cmd("augroup END")
|
||||
|
||||
|
1
selene.toml
Normal file
1
selene.toml
Normal file
@ -0,0 +1 @@
|
||||
std="lua51+vim"
|
55
sessions/%home%kjuulh%.config%nvim.vim
Normal file
55
sessions/%home%kjuulh%.config%nvim.vim
Normal file
@ -0,0 +1,55 @@
|
||||
let SessionLoad = 1
|
||||
let s:so_save = &g:so | let s:siso_save = &g:siso | setg so=0 siso=0 | setl so=-1 siso=-1
|
||||
let v:this_session=expand("<sfile>:p")
|
||||
silent only
|
||||
silent tabonly
|
||||
cd ~/.config/nvim
|
||||
if expand('%') == '' && !&modified && line('$') <= 1 && getline(1) == ''
|
||||
let s:wipebuf = bufnr('%')
|
||||
endif
|
||||
let s:shortmess_save = &shortmess
|
||||
if &shortmess =~ 'A'
|
||||
set shortmess=aoOA
|
||||
else
|
||||
set shortmess=aoO
|
||||
endif
|
||||
badd +1 .
|
||||
badd +7 lua/plugins/tokyonight.lua
|
||||
argglobal
|
||||
%argdel
|
||||
$argadd .
|
||||
edit lua/plugins/tokyonight.lua
|
||||
wincmd t
|
||||
let s:save_winminheight = &winminheight
|
||||
let s:save_winminwidth = &winminwidth
|
||||
set winminheight=0
|
||||
set winheight=1
|
||||
set winminwidth=0
|
||||
set winwidth=1
|
||||
argglobal
|
||||
balt .
|
||||
let s:l = 7 - ((6 * winheight(0) + 30) / 60)
|
||||
if s:l < 1 | let s:l = 1 | endif
|
||||
keepjumps exe s:l
|
||||
normal! zt
|
||||
keepjumps 7
|
||||
normal! 07|
|
||||
tabnext 1
|
||||
if exists('s:wipebuf') && len(win_findbuf(s:wipebuf)) == 0 && getbufvar(s:wipebuf, '&buftype') isnot# 'terminal'
|
||||
silent exe 'bwipe ' . s:wipebuf
|
||||
endif
|
||||
unlet! s:wipebuf
|
||||
set winheight=1 winwidth=5
|
||||
let &shortmess = s:shortmess_save
|
||||
let &winminheight = s:save_winminheight
|
||||
let &winminwidth = s:save_winminwidth
|
||||
let s:sx = expand("<sfile>:p:r")."x.vim"
|
||||
if filereadable(s:sx)
|
||||
exe "source " . fnameescape(s:sx)
|
||||
endif
|
||||
let &g:so = s:so_save | let &g:siso = s:siso_save
|
||||
set hlsearch
|
||||
nohlsearch
|
||||
doautoall SessionLoadPost
|
||||
unlet SessionLoad
|
||||
" vim: set ft=vim :
|
3
stylua.toml
Normal file
3
stylua.toml
Normal file
@ -0,0 +1,3 @@
|
||||
indent_type = "Spaces"
|
||||
indent_width = 2
|
||||
column_width = 120
|
Loading…
Reference in New Issue
Block a user