many updates
This commit is contained in:
parent
802517b65b
commit
913df8f0e9
123
.config/alacritty/alacritty.toml
Normal file
123
.config/alacritty/alacritty.toml
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
args = ["--login"]
|
||||||
|
program = "/usr/bin/zsh"
|
||||||
|
|
||||||
|
[[keyboard.bindings]]
|
||||||
|
action = "Paste"
|
||||||
|
key = "V"
|
||||||
|
mods = "Control|Shift"
|
||||||
|
|
||||||
|
[[keyboard.bindings]]
|
||||||
|
action = "Copy"
|
||||||
|
key = "C"
|
||||||
|
mods = "Control|Shift"
|
||||||
|
|
||||||
|
[[keyboard.bindings]]
|
||||||
|
action = "PasteSelection"
|
||||||
|
key = "Insert"
|
||||||
|
mods = "Shift"
|
||||||
|
|
||||||
|
[[keyboard.bindings]]
|
||||||
|
action = "ResetFontSize"
|
||||||
|
key = "Numpad0"
|
||||||
|
mods = "Control"
|
||||||
|
|
||||||
|
[[keyboard.bindings]]
|
||||||
|
action = "IncreaseFontSize"
|
||||||
|
key = "NumpadEquals"
|
||||||
|
mods = "Control"
|
||||||
|
|
||||||
|
[[keyboard.bindings]]
|
||||||
|
action = "DecreaseFontSize"
|
||||||
|
key = "NumpadSubtract"
|
||||||
|
mods = "Control"
|
||||||
|
|
||||||
|
[[keyboard.bindings]]
|
||||||
|
action = "Paste"
|
||||||
|
key = "Paste"
|
||||||
|
|
||||||
|
[[keyboard.bindings]]
|
||||||
|
action = "Copy"
|
||||||
|
key = "Copy"
|
||||||
|
|
||||||
|
[[keyboard.bindings]]
|
||||||
|
action = "ClearLogNotice"
|
||||||
|
key = "L"
|
||||||
|
mods = "Control"
|
||||||
|
|
||||||
|
[[keyboard.bindings]]
|
||||||
|
chars = "\f"
|
||||||
|
key = "L"
|
||||||
|
mods = "Control"
|
||||||
|
|
||||||
|
[[keyboard.bindings]]
|
||||||
|
action = "ScrollPageUp"
|
||||||
|
key = "PageUp"
|
||||||
|
mode = "~Alt"
|
||||||
|
mods = "Shift"
|
||||||
|
|
||||||
|
[[keyboard.bindings]]
|
||||||
|
action = "ScrollPageDown"
|
||||||
|
key = "PageDown"
|
||||||
|
mode = "~Alt"
|
||||||
|
mods = "Shift"
|
||||||
|
|
||||||
|
[[keyboard.bindings]]
|
||||||
|
action = "ScrollToTop"
|
||||||
|
key = "Home"
|
||||||
|
mode = "~Alt"
|
||||||
|
mods = "Shift"
|
||||||
|
|
||||||
|
[[keyboard.bindings]]
|
||||||
|
action = "ScrollToBottom"
|
||||||
|
key = "End"
|
||||||
|
mode = "~Alt"
|
||||||
|
mods = "Shift"
|
||||||
|
|
||||||
|
[general]
|
||||||
|
import = ["/path/to/dracula.yml"]
|
||||||
|
|
||||||
|
[env]
|
||||||
|
TERM = "xterm-256color"
|
||||||
|
|
||||||
|
[font]
|
||||||
|
size = 10.0
|
||||||
|
|
||||||
|
[font.bold]
|
||||||
|
family = "FiraCode Nerd Font"
|
||||||
|
style = "Bold"
|
||||||
|
|
||||||
|
[font.bold_italic]
|
||||||
|
family = "FiraCode Nerd Font"
|
||||||
|
style = "Bold Italic"
|
||||||
|
|
||||||
|
[font.italic]
|
||||||
|
family = "FiraCode Nerd Font"
|
||||||
|
style = "Italic"
|
||||||
|
|
||||||
|
[font.normal]
|
||||||
|
family = "FiraCode Nerd Font"
|
||||||
|
style = "Regular"
|
||||||
|
|
||||||
|
[font.offset]
|
||||||
|
x = 0
|
||||||
|
y = 0
|
||||||
|
|
||||||
|
[scrolling]
|
||||||
|
history = 5000
|
||||||
|
|
||||||
|
[window]
|
||||||
|
opacity = 0.7
|
||||||
|
title = "Alacritty"
|
||||||
|
|
||||||
|
[window.class]
|
||||||
|
general = "Alacritty"
|
||||||
|
instance = "Alacritty"
|
||||||
|
|
||||||
|
[window.padding]
|
||||||
|
x = 6
|
||||||
|
y = 6
|
||||||
|
|
||||||
|
[colors]
|
||||||
|
draw_bold_text_with_bright_colors = true
|
||||||
|
|
||||||
|
[keyboard]
|
||||||
58
.config/nvim/lazy-lock.json
Normal file
58
.config/nvim/lazy-lock.json
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
{
|
||||||
|
"LuaSnip": { "branch": "master", "commit": "33b06d72d220aa56a7ce80a0dd6f06c70cd82b9d" },
|
||||||
|
"aerial.nvim": { "branch": "master", "commit": "1160fb7a15a34b03b7381d95d45560712b5f19d0" },
|
||||||
|
"base16-vim": { "branch": "master", "commit": "3be3cd82cd31acfcab9a41bad853d9c68d30478d" },
|
||||||
|
"blink.cmp": { "branch": "main", "commit": "5f442681df24fe705d1ee7ce5b4d435aa4b4dee4" },
|
||||||
|
"conform.nvim": { "branch": "master", "commit": "9180320205d250429f0f80e073326c674e2a7149" },
|
||||||
|
"dressing.nvim": { "branch": "master", "commit": "3a45525bb182730fe462325c99395529308f431e" },
|
||||||
|
"flash.nvim": { "branch": "main", "commit": "34c7be146a91fec3555c33fe89c7d643f6ef5cf1" },
|
||||||
|
"friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" },
|
||||||
|
"git-blame.nvim": { "branch": "master", "commit": "2883a7460f611c2705b23f12d58d398d5ce6ec00" },
|
||||||
|
"gitsigns.nvim": { "branch": "main", "commit": "5f808b5e4fef30bd8aca1b803b4e555da07fc412" },
|
||||||
|
"go.nvim": { "branch": "master", "commit": "c6d5ca26377d01c4de1f7bff1cd62c8b43baa6bc" },
|
||||||
|
"gruvbox-material": { "branch": "master", "commit": "055aefde5fd49018f3a858bca7b529bc2e08c02b" },
|
||||||
|
"gruvbox.nvim": { "branch": "main", "commit": "68c3460a5d1d1a362318960035c9f3466d5011f5" },
|
||||||
|
"harpoon": { "branch": "master", "commit": "1bc17e3e42ea3c46b33c0bbad6a880792692a1b3" },
|
||||||
|
"indent-blankline.nvim": { "branch": "master", "commit": "259357fa4097e232730341fa60988087d189193a" },
|
||||||
|
"lazy.nvim": { "branch": "main", "commit": "7e6c863bc7563efbdd757a310d17ebc95166cef3" },
|
||||||
|
"lazydev.nvim": { "branch": "main", "commit": "8620f82ee3f59ff2187647167b6b47387a13a018" },
|
||||||
|
"lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" },
|
||||||
|
"mason-lspconfig.nvim": { "branch": "main", "commit": "c6c686781f9841d855bf1b926e10aa5e19430a38" },
|
||||||
|
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
|
||||||
|
"mini.base16": { "branch": "main", "commit": "23453dacc1606e5d42238d82f0b42a2985386b62" },
|
||||||
|
"mini.bufremove": { "branch": "main", "commit": "285bdac9596ee7375db50c0f76ed04336dcd2685" },
|
||||||
|
"mini.comment": { "branch": "main", "commit": "a56581c40c19fa26f2b39da72504398de3173c5a" },
|
||||||
|
"mini.icons": { "branch": "main", "commit": "6787321f70d674a481776b7cc2c781fb7002c644" },
|
||||||
|
"mini.surround": { "branch": "main", "commit": "aa5e245829dd12d8ff0c96ef11da28681d6049aa" },
|
||||||
|
"neo-tree.nvim": { "branch": "v3.x", "commit": "a77af2e764c5ed4038d27d1c463fa49cd4794e07" },
|
||||||
|
"neogen": { "branch": "main", "commit": "dd0301bfba1f83a3bc009b5430fce7aa3cee6941" },
|
||||||
|
"neorg": { "branch": "main", "commit": "6b945909d84b5aeadc875f9b3f529ec44b9bc60f" },
|
||||||
|
"noice.nvim": { "branch": "main", "commit": "eaed6cc9c06aa2013b5255349e4f26a6b17ab70f" },
|
||||||
|
"nui.nvim": { "branch": "main", "commit": "53e907ffe5eedebdca1cd503b00aa8692068ca46" },
|
||||||
|
"numb.nvim": { "branch": "master", "commit": "3f7d4a74bd456e747a1278ea1672b26116e0824d" },
|
||||||
|
"nvim-cmp": { "branch": "main", "commit": "b555203ce4bd7ff6192e759af3362f9d217e8c89" },
|
||||||
|
"nvim-colorizer.lua": { "branch": "master", "commit": "8a65c448122fc8fac9c67b2e857b6e830a4afd0b" },
|
||||||
|
"nvim-lspconfig": { "branch": "master", "commit": "8b15a1a597a59f4f5306fad9adfe99454feab743" },
|
||||||
|
"nvim-navic": { "branch": "master", "commit": "8649f694d3e76ee10c19255dece6411c29206a54" },
|
||||||
|
"nvim-treesitter": { "branch": "master", "commit": "e947d35bbf919ea88a24c21cb8afa4621e3cf547" },
|
||||||
|
"nvim-ts-context-commentstring": { "branch": "main", "commit": "1b212c2eee76d787bbea6aa5e92a2b534e7b4f8f" },
|
||||||
|
"nvim-web-devicons": { "branch": "master", "commit": "4adeeaa7a32d46cf3b5833341358c797304f950a" },
|
||||||
|
"oil.nvim": { "branch": "master", "commit": "ba858b662599eab8ef1cba9ab745afded99cb180" },
|
||||||
|
"plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" },
|
||||||
|
"popup.nvim": { "branch": "master", "commit": "b7404d35d5d3548a82149238289fa71f7f6de4ac" },
|
||||||
|
"rust-tools.nvim": { "branch": "master", "commit": "676187908a1ce35ffcd727c654ed68d851299d3e" },
|
||||||
|
"sonokai": { "branch": "master", "commit": "1d7ca954792dfddd9e73c53563d85adaeb8c8437" },
|
||||||
|
"telescope.nvim": { "branch": "master", "commit": "2eca9ba22002184ac05eddbe47a7fe2d5a384dfc" },
|
||||||
|
"todo-comments.nvim": { "branch": "main", "commit": "ae0a2afb47cf7395dc400e5dc4e05274bf4fb9e0" },
|
||||||
|
"tokyonight.nvim": { "branch": "main", "commit": "45d22cf0e1b93476d3b6d362d720412b3d34465c" },
|
||||||
|
"treesitter-context": { "branch": "master", "commit": "2bcf700b59bc92850ca83a1c02e86ba832e0fae0" },
|
||||||
|
"trouble.nvim": { "branch": "main", "commit": "46cf952fc115f4c2b98d4e208ed1e2dce08c9bf6" },
|
||||||
|
"undotree": { "branch": "master", "commit": "78b5241191852ffa9bb5da5ff2ee033160798c3b" },
|
||||||
|
"vim": { "branch": "master", "commit": "65f4225e0526516a67d56c8ac09925a209138e53" },
|
||||||
|
"vim-illuminate": { "branch": "master", "commit": "5eeb7951fc630682c322e88a9bbdae5c224ff0aa" },
|
||||||
|
"vim-markdown": { "branch": "master", "commit": "8f6cb3a6ca4e3b6bcda0730145a0b700f3481b51" },
|
||||||
|
"vim-slash": { "branch": "master", "commit": "31aee09b7ea8893a18fa34f65e63e364fc998444" },
|
||||||
|
"which-key.nvim": { "branch": "main", "commit": "8ab96b38a2530eacba5be717f52e04601eb59326" },
|
||||||
|
"zen-mode.nvim": { "branch": "main", "commit": "863f150ca321b3dd8aa1a2b69b5f411a220e144f" },
|
||||||
|
"zk-nvim": { "branch": "main", "commit": "6beea6fafe2c781cb10e80878e68d5e32937692a" }
|
||||||
|
}
|
||||||
81
.config/nvim/lua/lazyvim/config/autocmds.lua
Executable file
81
.config/nvim/lua/lazyvim/config/autocmds.lua
Executable file
@ -0,0 +1,81 @@
|
|||||||
|
-- highlight on yank
|
||||||
|
vim.api.nvim_create_autocmd('TextYankPost', {
|
||||||
|
group = vim.api.nvim_create_augroup('highlight_yank', {}),
|
||||||
|
desc = 'Hightlight selection on yank',
|
||||||
|
pattern = '*',
|
||||||
|
callback = function()
|
||||||
|
vim.highlight.on_yank { higroup = 'IncSearch', timeout = 500 }
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd({ "VimEnter" }, {
|
||||||
|
callback = function()
|
||||||
|
vim.cmd("hi link illuminatedWord LspReferenceText")
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- go to last loc when opening a buffer
|
||||||
|
vim.api.nvim_create_autocmd("BufReadPost", {
|
||||||
|
callback = function()
|
||||||
|
local mark = vim.api.nvim_buf_get_mark(0, '"')
|
||||||
|
local lcount = vim.api.nvim_buf_line_count(0)
|
||||||
|
if mark[1] > 0 and mark[1] <= lcount then
|
||||||
|
pcall(vim.api.nvim_win_set_cursor, 0, mark)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- close some filetypes with <q>
|
||||||
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
|
pattern = {
|
||||||
|
"qf",
|
||||||
|
"help",
|
||||||
|
"man",
|
||||||
|
"notify",
|
||||||
|
"lspinfo",
|
||||||
|
"spectre_panel",
|
||||||
|
"startuptime",
|
||||||
|
"tsplayground",
|
||||||
|
"PlenaryTestPopup",
|
||||||
|
},
|
||||||
|
callback = function(event)
|
||||||
|
vim.bo[event.buf].buflisted = false
|
||||||
|
vim.keymap.set("n", "q", "<cmd>close<cr>", { buffer = event.buf, silent = true })
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- add spellcheck and wrapping to some file types
|
||||||
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
|
pattern = { "gitcommit", "markdown" },
|
||||||
|
callback = function()
|
||||||
|
vim.opt_local.wrap = true
|
||||||
|
vim.opt_local.spell = true
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Prevent auto comment on next line
|
||||||
|
vim.cmd('autocmd BufEnter * set formatoptions-=cro')
|
||||||
|
vim.cmd('autocmd BufEnter * setlocal formatoptions-=cro')
|
||||||
|
|
||||||
|
-- Set filetype to tex for .tex files?
|
||||||
|
vim.cmd([[autocmd BufRead,BufNewFile *.tex set filetype=tex]])
|
||||||
|
|
||||||
|
-- Trim whitespace from files on save
|
||||||
|
vim.cmd([[
|
||||||
|
autocmd BufWritePre * let currPos = getpos(".")
|
||||||
|
autocmd BufWritePre * %s/\s\+$//e
|
||||||
|
autocmd BufWritePre * %s/\n\+\%$//e
|
||||||
|
autocmd BufWritePre *.[ch] %s/\%$/\r/e
|
||||||
|
autocmd BufWritePre * cal cursor(currPos[1], currPos[2])
|
||||||
|
]])
|
||||||
|
|
||||||
|
-- Run custom textclear command when exiting a .tex file (cleanup files)
|
||||||
|
vim.cmd([[autocmd VimLeave *.tex !texclear %]])
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("TermOpen", {
|
||||||
|
group = vim.api.nvim_create_augroup("custom-term-open", { clear = true }),
|
||||||
|
callback = function()
|
||||||
|
vim.opt.number = false
|
||||||
|
vim.opt.relativenumber = false
|
||||||
|
end
|
||||||
|
})
|
||||||
@ -56,6 +56,7 @@ vim.keymap.set("n", "<leader>x", ":.lua<CR>", { desc = "Source Line" })
|
|||||||
vim.keymap.set("v", "<leader>x", ":lua<CR>", { desc = "Source Selection" })
|
vim.keymap.set("v", "<leader>x", ":lua<CR>", { desc = "Source Selection" })
|
||||||
vim.keymap.set("n", "<leader>-", "<cmd>Oil<CR>")
|
vim.keymap.set("n", "<leader>-", "<cmd>Oil<CR>")
|
||||||
vim.keymap.set("t", "<esc><esc>", "<c-\\><c-n>")
|
vim.keymap.set("t", "<esc><esc>", "<c-\\><c-n>")
|
||||||
|
vim.keymap.set("n", "<leader>xt", "<cmd>PlenaryBustedFile %<cr>")
|
||||||
|
|
||||||
local job_id = 0
|
local job_id = 0
|
||||||
vim.keymap.set("n", "<leader>Ts", function()
|
vim.keymap.set("n", "<leader>Ts", function()
|
||||||
|
|||||||
@ -1,48 +1,48 @@
|
|||||||
local options = {
|
local options = {
|
||||||
backup = false, -- creates a backup file
|
backup = false, -- creates a backup file
|
||||||
clipboard = "unnamedplus", -- gives nvim access to clipboard
|
clipboard = "unnamedplus", -- gives nvim access to clipboard
|
||||||
cmdheight = 1, -- more space in nvim cmd line
|
cmdheight = 1, -- more space in nvim cmd line
|
||||||
completeopt = { "menuone", "noselect" }, -- cmp related
|
completeopt = { "menuone", "noselect" }, -- cmp related
|
||||||
conceallevel = 3, -- don't hide `` in md
|
conceallevel = 0, -- don't hide ``` in markdown
|
||||||
fileencoding = "utf-8",
|
fileencoding = "utf-8",
|
||||||
hlsearch = false,
|
hlsearch = false,
|
||||||
ignorecase = true,
|
ignorecase = true,
|
||||||
mouse = "a", -- allow use of mouse (bad I know but sometimes useful)
|
mouse = "a", -- allow use of mouse (bad I know but sometimes useful)
|
||||||
pumheight = 10, -- popup menu height
|
pumheight = 10, -- popup menu height
|
||||||
showmode = true,
|
showmode = true,
|
||||||
smartcase = true,
|
smartcase = true,
|
||||||
smartindent = true,
|
smartindent = true,
|
||||||
splitbelow = true,
|
splitbelow = true,
|
||||||
splitright = true,
|
splitright = true,
|
||||||
swapfile = false,
|
swapfile = false,
|
||||||
termguicolors = true,
|
termguicolors = true,
|
||||||
timeoutlen = 500,
|
timeoutlen = 500,
|
||||||
ttimeoutlen = 10,
|
ttimeoutlen = 10,
|
||||||
undofile = true,
|
undofile = true,
|
||||||
updatetime = 100,
|
updatetime = 100,
|
||||||
writebackup = false,
|
writebackup = false,
|
||||||
expandtab = true, -- use spaces instead of tab
|
expandtab = true, -- use spaces instead of tab
|
||||||
shiftwidth = 4, -- insert 4 spaces for indentation
|
shiftwidth = 4, -- insert 4 spaces for indentation
|
||||||
tabstop = 4, -- insert 4 spaces for tab
|
tabstop = 4, -- insert 4 spaces for tab
|
||||||
cursorline = false,
|
cursorline = false,
|
||||||
number = true,
|
number = true,
|
||||||
laststatus = 3,
|
laststatus = 3,
|
||||||
showcmd = false,
|
showcmd = false,
|
||||||
ruler = false,
|
ruler = false,
|
||||||
relativenumber = true,
|
relativenumber = true,
|
||||||
numberwidth = 2,
|
numberwidth = 2,
|
||||||
signcolumn = "yes",
|
signcolumn = "yes:1",
|
||||||
wrap = false,
|
wrap = false,
|
||||||
scrolloff = 8,
|
scrolloff = 8,
|
||||||
sidescrolloff = 8,
|
sidescrolloff = 8,
|
||||||
guifont = "monospace:h17",
|
guifont = "monospace:h17",
|
||||||
title = true,
|
title = true,
|
||||||
spelllang = "en_gb",
|
spelllang = "en_gb",
|
||||||
autowrite = true,
|
autowrite = true,
|
||||||
confirm = true,
|
confirm = true,
|
||||||
formatoptions = "jcroqlnt", -- tcqj
|
formatoptions = "jcroqlnt", -- tcqj
|
||||||
grepformat = "%f:%l:%c:%m",
|
grepformat = "%f:%l:%c:%m",
|
||||||
grepprg = "rg --vimgrep",
|
grepprg = "rg --vimgrep",
|
||||||
}
|
}
|
||||||
|
|
||||||
vim.opt.fillchars = vim.opt.fillchars + "eob: "
|
vim.opt.fillchars = vim.opt.fillchars + "eob: "
|
||||||
@ -50,7 +50,7 @@ vim.opt.fillchars = vim.opt.fillchars + "eob: "
|
|||||||
vim.opt.shortmess:append("c")
|
vim.opt.shortmess:append("c")
|
||||||
|
|
||||||
for k, v in pairs(options) do
|
for k, v in pairs(options) do
|
||||||
vim.opt[k] = v
|
vim.opt[k] = v
|
||||||
end
|
end
|
||||||
|
|
||||||
vim.cmd("set whichwrap+=<,>,[,],h,l")
|
vim.cmd("set whichwrap+=<,>,[,],h,l")
|
||||||
|
|||||||
@ -1,10 +1,11 @@
|
|||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
"stevearc/aerial.nvim",
|
"stevearc/aerial.nvim",
|
||||||
opts = {},
|
enabled = false,
|
||||||
dependencies = {
|
opts = {},
|
||||||
"nvim-treesitter/nvim-treesitter",
|
dependencies = {
|
||||||
"nvim-tree/nvim-web-devicons",
|
"nvim-treesitter/nvim-treesitter",
|
||||||
},
|
"nvim-tree/nvim-web-devicons",
|
||||||
},
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
'saghen/blink.cmp',
|
'saghen/blink.cmp',
|
||||||
|
enabled = true,
|
||||||
-- optional: provides snippets for the snippet source
|
-- optional: provides snippets for the snippet source
|
||||||
dependencies = 'rafamadriz/friendly-snippets',
|
dependencies = 'rafamadriz/friendly-snippets',
|
||||||
|
|
||||||
@ -14,6 +15,11 @@ return {
|
|||||||
---@module 'blink.cmp'
|
---@module 'blink.cmp'
|
||||||
---@type blink.cmp.Config
|
---@type blink.cmp.Config
|
||||||
opts = {
|
opts = {
|
||||||
|
enabled = function()
|
||||||
|
-- you list filetypes where you dob't want blink blink to work here
|
||||||
|
local disabled_filetypes = { "oil_preview", "oil", "TelescopePrompt" } -- you can add extra fileypes you do not want blink enabled.
|
||||||
|
return not vim.tbl_contains(disabled_filetypes, vim.bo.filetype)
|
||||||
|
end,
|
||||||
-- 'default' for mappings similar to built-in completion
|
-- 'default' for mappings similar to built-in completion
|
||||||
-- 'super-tab' for mappings similar to vscode (tab to accept, arrow keys to navigate)
|
-- 'super-tab' for mappings similar to vscode (tab to accept, arrow keys to navigate)
|
||||||
-- 'enter' for mappings similar to 'super-tab' but with 'enter' to accept
|
-- 'enter' for mappings similar to 'super-tab' but with 'enter' to accept
|
||||||
@ -34,6 +40,7 @@ return {
|
|||||||
-- elsewhere in your config, without redefining it, due to `opts_extend`
|
-- elsewhere in your config, without redefining it, due to `opts_extend`
|
||||||
sources = {
|
sources = {
|
||||||
default = { 'lsp', 'path', 'snippets', 'buffer' },
|
default = { 'lsp', 'path', 'snippets', 'buffer' },
|
||||||
|
cmdline = {}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
opts_extend = { "sources.default" }
|
opts_extend = { "sources.default" }
|
||||||
|
|||||||
@ -1,41 +1,49 @@
|
|||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
"sainnhe/gruvbox-material",
|
"sainnhe/gruvbox-material",
|
||||||
|
enabled = true,
|
||||||
lazy = true,
|
lazy = true,
|
||||||
priority = 1000,
|
priority = 1000,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ellisonleao/gruvbox.nvim",
|
"ellisonleao/gruvbox.nvim",
|
||||||
|
enabled = true,
|
||||||
lazy = true,
|
lazy = true,
|
||||||
priority = 1000,
|
priority = 1000,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"sainnhe/sonokai",
|
"sainnhe/sonokai",
|
||||||
|
enabled = true,
|
||||||
lazy = true,
|
lazy = true,
|
||||||
priority = 1000,
|
priority = 1000,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"dracula/vim",
|
"dracula/vim",
|
||||||
|
enabled = true,
|
||||||
lazy = true,
|
lazy = true,
|
||||||
priority = 1000,
|
priority = 1000,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"folke/tokyonight.nvim",
|
"folke/tokyonight.nvim",
|
||||||
|
enabled = true,
|
||||||
lazy = true,
|
lazy = true,
|
||||||
priority = 1000,
|
priority = 1000,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"echasnovski/mini.base16",
|
"echasnovski/mini.base16",
|
||||||
|
enabled = true,
|
||||||
lazy = false,
|
lazy = false,
|
||||||
priority = 1000,
|
priority = 1000,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"chriskempson/base16-vim",
|
"chriskempson/base16-vim",
|
||||||
|
enabled = true,
|
||||||
lazy = false,
|
lazy = false,
|
||||||
priority = 1000,
|
priority = 1000,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"NvChad/nvim-colorizer.lua",
|
"NvChad/nvim-colorizer.lua",
|
||||||
|
enabled = true,
|
||||||
opts = function()
|
opts = function()
|
||||||
require("colorizer").setup({})
|
require("colorizer").setup({})
|
||||||
end,
|
end,
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
"folke/todo-comments.nvim",
|
"folke/todo-comments.nvim",
|
||||||
|
enabled = true,
|
||||||
cmd = { "TodoTrouble", "TodoTelescope" },
|
cmd = { "TodoTrouble", "TodoTelescope" },
|
||||||
event = "BufReadPost",
|
event = "BufReadPost",
|
||||||
config = true,
|
config = true,
|
||||||
@ -13,9 +14,10 @@ return {
|
|||||||
{ "<leader>tf", "<cmd>TodoTelescope<cr>", desc = "Todo Telescope" },
|
{ "<leader>tf", "<cmd>TodoTelescope<cr>", desc = "Todo Telescope" },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ "JoosepAlviste/nvim-ts-context-commentstring" },
|
{ "JoosepAlviste/nvim-ts-context-commentstring", enabled = true },
|
||||||
{
|
{
|
||||||
"echasnovski/mini.comment",
|
"echasnovski/mini.comment",
|
||||||
|
enabled = true,
|
||||||
event = "VeryLazy",
|
event = "VeryLazy",
|
||||||
opts = {
|
opts = {
|
||||||
hooks = {
|
hooks = {
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
"folke/lazy.nvim",
|
"folke/lazy.nvim",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
7
.config/nvim/lua/lazyvim/plugins/dev.lua
Normal file
7
.config/nvim/lua/lazyvim/plugins/dev.lua
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
return {
|
||||||
|
{
|
||||||
|
dir = "~/repos/neovim-plugins/present.nvim",
|
||||||
|
enabled = true,
|
||||||
|
lazy = false,
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,17 +1,18 @@
|
|||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
"stevearc/dressing.nvim",
|
"stevearc/dressing.nvim",
|
||||||
init = function()
|
enabled = false,
|
||||||
---@diagnostic disable-next-line: duplicate-set-field
|
init = function()
|
||||||
vim.ui.select = function(...)
|
---@diagnostic disable-next-line: duplicate-set-field
|
||||||
require("lazy").load({ plugins = { "dressing.nvim" } })
|
vim.ui.select = function(...)
|
||||||
return vim.ui.select(...)
|
require("lazy").load({ plugins = { "dressing.nvim" } })
|
||||||
end
|
return vim.ui.select(...)
|
||||||
---@diagnostic disable-next-line: duplicate-set-field
|
end
|
||||||
vim.ui.input = function(...)
|
---@diagnostic disable-next-line: duplicate-set-field
|
||||||
require("lazy").load({ plugins = { "dressing.nvim" } })
|
vim.ui.input = function(...)
|
||||||
return vim.ui.input(...)
|
require("lazy").load({ plugins = { "dressing.nvim" } })
|
||||||
end
|
return vim.ui.input(...)
|
||||||
end,
|
end
|
||||||
},
|
end,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
"folke/flash.nvim",
|
"folke/flash.nvim",
|
||||||
|
enabled = false,
|
||||||
event = "VeryLazy",
|
event = "VeryLazy",
|
||||||
opts = {},
|
opts = {},
|
||||||
-- stylua: ignore
|
-- stylua: ignore
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
"lewis6991/gitsigns.nvim",
|
"lewis6991/gitsigns.nvim",
|
||||||
|
enabled = true,
|
||||||
event = "BufReadPre",
|
event = "BufReadPre",
|
||||||
opts = {
|
opts = {
|
||||||
signs = {
|
signs = {
|
||||||
@ -36,6 +37,7 @@ return {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"f-person/git-blame.nvim",
|
"f-person/git-blame.nvim",
|
||||||
|
enabled = true,
|
||||||
event = "BufEnter",
|
event = "BufEnter",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
"ray-x/go.nvim",
|
"ray-x/go.nvim",
|
||||||
|
enabled = true,
|
||||||
requires = {
|
requires = {
|
||||||
"ray-x/guihua.lua",
|
"ray-x/guihua.lua",
|
||||||
"neovim/nvim-lspconfig",
|
"neovim/nvim-lspconfig",
|
||||||
|
|||||||
@ -1,16 +1,17 @@
|
|||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
"ThePrimeagen/harpoon",
|
"ThePrimeagen/harpoon",
|
||||||
keys = {
|
enabled = true,
|
||||||
{ "]m", '<cmd>lua require("harpoon.ui").nav_next()<cr>', desc = "Harpoon Next" },
|
keys = {
|
||||||
{ "[m", '<cmd>lua require("harpoon.ui").nav_prev()<cr>', desc = "Harpoon Prev" },
|
{ "]m", '<cmd>lua require("harpoon.ui").nav_next()<cr>', desc = "Harpoon Next" },
|
||||||
{ "mm", '<cmd>lua require("harpoon.mark").add_file()<cr>', desc = "Harpoon" },
|
{ "[m", '<cmd>lua require("harpoon.ui").nav_prev()<cr>', desc = "Harpoon Prev" },
|
||||||
{ "ms", "<cmd>Telescope harpoon marks<cr>", desc = "Search Files" },
|
{ "mm", '<cmd>lua require("harpoon.mark").add_file()<cr>', desc = "Harpoon" },
|
||||||
{ "mu", '<cmd>lua require("harpoon.ui").toggle_quick_menu()<cr>', desc = "Harpoon UI" },
|
{ "ms", "<cmd>Telescope harpoon marks<cr>", desc = "Search Files" },
|
||||||
{ "m1", '<cmd> lua require("harpoon.ui").nav_file(1)<cr>', desc = "Goto 1" },
|
{ "mu", '<cmd>lua require("harpoon.ui").toggle_quick_menu()<cr>', desc = "Harpoon UI" },
|
||||||
{ "m2", '<cmd> lua require("harpoon.ui").nav_file(2)<cr>', desc = "Goto 2" },
|
{ "m1", '<cmd> lua require("harpoon.ui").nav_file(1)<cr>', desc = "Goto 1" },
|
||||||
{ "m3", '<cmd> lua require("harpoon.ui").nav_file(3)<cr>', desc = "Goto 3" },
|
{ "m2", '<cmd> lua require("harpoon.ui").nav_file(2)<cr>', desc = "Goto 2" },
|
||||||
{ "m4", '<cmd> lua require("harpoon.ui").nav_file(4)<cr>', desc = "Goto 4" },
|
{ "m3", '<cmd> lua require("harpoon.ui").nav_file(3)<cr>', desc = "Goto 3" },
|
||||||
},
|
{ "m4", '<cmd> lua require("harpoon.ui").nav_file(4)<cr>', desc = "Goto 4" },
|
||||||
},
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,7 @@ return {
|
|||||||
-- lspconfig
|
-- lspconfig
|
||||||
{
|
{
|
||||||
"neovim/nvim-lspconfig",
|
"neovim/nvim-lspconfig",
|
||||||
|
enabled = true,
|
||||||
event = "BufReadPre",
|
event = "BufReadPre",
|
||||||
dependencies = {
|
dependencies = {
|
||||||
{
|
{
|
||||||
@ -192,6 +193,7 @@ return {
|
|||||||
-- cmdline tools and lsp servers
|
-- cmdline tools and lsp servers
|
||||||
{
|
{
|
||||||
"williamboman/mason.nvim",
|
"williamboman/mason.nvim",
|
||||||
|
enabled = true,
|
||||||
cmd = "Mason",
|
cmd = "Mason",
|
||||||
keys = { { "<leader>lM", "<cmd>Mason<cr>", desc = "Mason" } },
|
keys = { { "<leader>lM", "<cmd>Mason<cr>", desc = "Mason" } },
|
||||||
opts = {
|
opts = {
|
||||||
@ -217,6 +219,7 @@ return {
|
|||||||
-- language specific tooling
|
-- language specific tooling
|
||||||
{
|
{
|
||||||
"simrat39/rust-tools.nvim",
|
"simrat39/rust-tools.nvim",
|
||||||
|
enabled = true,
|
||||||
opts = {
|
opts = {
|
||||||
server = {
|
server = {
|
||||||
on_attach = function(_, bufnr)
|
on_attach = function(_, bufnr)
|
||||||
|
|||||||
@ -7,7 +7,7 @@ function M.disable_deno_formatting(client)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function M.resolve_tsserver_deno(client)
|
function M.resolve_tsserver_deno(client)
|
||||||
local active_clients = vim.lsp.get_active_clients()
|
local active_clients = vim.lsp.get_clients()
|
||||||
if client.name == "denols" then
|
if client.name == "denols" then
|
||||||
for _, client_ in pairs(active_clients) do
|
for _, client_ in pairs(active_clients) do
|
||||||
-- stop tsserver if denols is already active
|
-- stop tsserver if denols is already active
|
||||||
@ -26,7 +26,7 @@ function M.resolve_tsserver_deno(client)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function M.disable_others_when_zk(client)
|
function M.disable_others_when_zk(client)
|
||||||
local active_clients = vim.lsp.get_active_clients()
|
local active_clients = vim.lsp.get_clients()
|
||||||
if client.name == "zk" then
|
if client.name == "zk" then
|
||||||
for _, client_ in pairs(active_clients) do
|
for _, client_ in pairs(active_clients) do
|
||||||
-- stop ltex if zk is already active
|
-- stop ltex if zk is already active
|
||||||
|
|||||||
@ -1,115 +1,116 @@
|
|||||||
return {
|
return {
|
||||||
"nvim-lualine/lualine.nvim",
|
"nvim-lualine/lualine.nvim",
|
||||||
event = "VeryLazy",
|
enabled = true,
|
||||||
opts = function()
|
event = "VeryLazy",
|
||||||
local colors = {
|
opts = function()
|
||||||
red = "#ca1243",
|
local colors = {
|
||||||
grey = "#a0a1a7",
|
red = "#ca1243",
|
||||||
black = "#383a42",
|
grey = "#a0a1a7",
|
||||||
white = "#f3f3f3",
|
black = "#383a42",
|
||||||
light_green = "#83a598",
|
white = "#f3f3f3",
|
||||||
orange = "#fe8019",
|
light_green = "#83a598",
|
||||||
green = "#8ec07c",
|
orange = "#fe8019",
|
||||||
}
|
green = "#8ec07c",
|
||||||
|
}
|
||||||
|
|
||||||
-- Put proper separators and gaps between components in sections
|
-- Put proper separators and gaps between components in sections
|
||||||
local function process_sections(sections)
|
local function process_sections(sections)
|
||||||
for name, section in pairs(sections) do
|
for name, section in pairs(sections) do
|
||||||
local left = name:sub(9, 10) < "x"
|
local left = name:sub(9, 10) < "x"
|
||||||
for pos = 1, name ~= "lualine_z" and #section or #section - 1 do
|
for pos = 1, name ~= "lualine_z" and #section or #section - 1 do
|
||||||
table.insert(section, pos * 2, { color = { fg = colors.white, bg = colors.white } })
|
table.insert(section, pos * 2, { color = { fg = colors.white, bg = colors.white } })
|
||||||
end
|
end
|
||||||
for id, comp in ipairs(section) do
|
for id, comp in ipairs(section) do
|
||||||
if type(comp) ~= "table" then
|
if type(comp) ~= "table" then
|
||||||
comp = { comp }
|
comp = { comp }
|
||||||
section[id] = comp
|
section[id] = comp
|
||||||
end
|
end
|
||||||
comp.separator = left and { right = "" } or { left = "" }
|
comp.separator = left and { right = "" } or { left = "" }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return sections
|
return sections
|
||||||
end
|
end
|
||||||
|
|
||||||
local function search_result()
|
local function search_result()
|
||||||
if vim.v.hlsearch == 0 then
|
if vim.v.hlsearch == 0 then
|
||||||
return ""
|
return ""
|
||||||
end
|
end
|
||||||
local last_search = vim.fn.getreg("/")
|
local last_search = vim.fn.getreg("/")
|
||||||
if not last_search or last_search == "" then
|
if not last_search or last_search == "" then
|
||||||
return ""
|
return ""
|
||||||
end
|
end
|
||||||
local searchcount = vim.fn.searchcount({ maxcount = 9999 })
|
local searchcount = vim.fn.searchcount({ maxcount = 9999 })
|
||||||
return last_search .. "(" .. searchcount.current .. "/" .. searchcount.total .. ")"
|
return last_search .. "(" .. searchcount.current .. "/" .. searchcount.total .. ")"
|
||||||
end
|
end
|
||||||
|
|
||||||
local function modified()
|
local function modified()
|
||||||
if vim.bo.modified then
|
if vim.bo.modified then
|
||||||
return "+"
|
return "+"
|
||||||
elseif vim.bo.modifiable == false or vim.bo.readonly == true then
|
elseif vim.bo.modifiable == false or vim.bo.readonly == true then
|
||||||
return "-"
|
return "-"
|
||||||
end
|
end
|
||||||
return ""
|
return ""
|
||||||
end
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
options = {
|
options = {
|
||||||
theme = "auto",
|
theme = "auto",
|
||||||
globalstatus = true,
|
globalstatus = true,
|
||||||
disabled_filetypes = { statusline = { "dashboard", "lazy", "alpha" } },
|
disabled_filetypes = { statusline = { "dashboard", "lazy", "alpha" } },
|
||||||
},
|
},
|
||||||
sections = process_sections({
|
sections = process_sections({
|
||||||
lualine_a = { "mode" },
|
lualine_a = { "mode" },
|
||||||
lualine_b = {
|
lualine_b = {
|
||||||
"branch",
|
"branch",
|
||||||
"diff",
|
"diff",
|
||||||
{
|
{
|
||||||
"diagnostics",
|
"diagnostics",
|
||||||
source = { "nvim" },
|
source = { "nvim" },
|
||||||
sections = { "error" },
|
sections = { "error" },
|
||||||
-- diagnostics_color = { error = { bg = colors.red, fg = colors.white } },
|
-- diagnostics_color = { error = { bg = colors.red, fg = colors.white } },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"diagnostics",
|
"diagnostics",
|
||||||
source = { "nvim" },
|
source = { "nvim" },
|
||||||
sections = { "warn" },
|
sections = { "warn" },
|
||||||
-- diagnostics_color = { warn = { bg = colors.orange, fg = colors.white } },
|
-- diagnostics_color = { warn = { bg = colors.orange, fg = colors.white } },
|
||||||
},
|
},
|
||||||
{ "filename", file_status = false, path = 1 },
|
{ "filename", file_status = false, path = 1 },
|
||||||
{ modified, color = { bg = colors.red } },
|
{ modified, color = { bg = colors.red } },
|
||||||
{
|
{
|
||||||
"%w",
|
"%w",
|
||||||
cond = function()
|
cond = function()
|
||||||
return vim.wo.previewwindow
|
return vim.wo.previewwindow
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"%r",
|
"%r",
|
||||||
cond = function()
|
cond = function()
|
||||||
return vim.bo.readonly
|
return vim.bo.readonly
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"%q",
|
"%q",
|
||||||
cond = function()
|
cond = function()
|
||||||
return vim.bo.buftype == "quickfix"
|
return vim.bo.buftype == "quickfix"
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
lualine_c = {
|
lualine_c = {
|
||||||
{
|
{
|
||||||
function()
|
function()
|
||||||
return require("nvim-navic").get_location()
|
return require("nvim-navic").get_location()
|
||||||
end,
|
end,
|
||||||
cond = function()
|
cond = function()
|
||||||
return package.loaded["nvim-navic"] and require("nvim-navic").is_available()
|
return package.loaded["nvim-navic"] and require("nvim-navic").is_available()
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
lualine_x = {},
|
lualine_x = {},
|
||||||
lualine_y = { search_result, "filetype" },
|
lualine_y = { search_result, "filetype" },
|
||||||
-- lualine_y = { "filetype " },
|
-- lualine_y = { "filetype " },
|
||||||
lualine_z = { "%l:%c", "%p%%/%L" },
|
lualine_z = { "%l:%c", "%p%%/%L" },
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,37 +1,38 @@
|
|||||||
return {
|
return {
|
||||||
"nvim-neorg/neorg",
|
"nvim-neorg/neorg",
|
||||||
ft = "norg",
|
enabled = false,
|
||||||
cmd = "Neorg",
|
ft = "norg",
|
||||||
build = ":Neorg sync-parsers",
|
cmd = "Neorg",
|
||||||
dependencies = {
|
build = ":Neorg sync-parsers",
|
||||||
{ "nvim-lua/plenary.nvim" },
|
dependencies = {
|
||||||
},
|
{ "nvim-lua/plenary.nvim" },
|
||||||
opts = {
|
},
|
||||||
load = {
|
opts = {
|
||||||
["core.defaults"] = {},
|
load = {
|
||||||
["core.concealer"] = {},
|
["core.defaults"] = {},
|
||||||
["core.dirman"] = {
|
["core.concealer"] = {},
|
||||||
config = {
|
["core.dirman"] = {
|
||||||
workspaces = {
|
config = {
|
||||||
default = "~/notes/neorg",
|
workspaces = {
|
||||||
work = "~/notes/neorg/work",
|
default = "~/notes/neorg",
|
||||||
personal = "~/notes/neorg/personal",
|
work = "~/notes/neorg/work",
|
||||||
journal = "~/notes/neorg/journal",
|
personal = "~/notes/neorg/personal",
|
||||||
},
|
journal = "~/notes/neorg/journal",
|
||||||
default_workspace = "default",
|
},
|
||||||
},
|
default_workspace = "default",
|
||||||
},
|
},
|
||||||
["core.completion"] = {
|
},
|
||||||
config = {
|
["core.completion"] = {
|
||||||
engine = "nvim-cmp",
|
config = {
|
||||||
},
|
engine = "nvim-cmp",
|
||||||
},
|
},
|
||||||
["core.presenter"] = {
|
},
|
||||||
config = {
|
["core.presenter"] = {
|
||||||
zen_mode = "zen-mode",
|
config = {
|
||||||
},
|
zen_mode = "zen-mode",
|
||||||
},
|
},
|
||||||
["core.ui"] = {},
|
},
|
||||||
},
|
["core.ui"] = {},
|
||||||
},
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
"folke/noice.nvim",
|
"folke/noice.nvim",
|
||||||
|
enabled = false,
|
||||||
event = "VeryLazy",
|
event = "VeryLazy",
|
||||||
opts = {
|
opts = {
|
||||||
lsp = {
|
lsp = {
|
||||||
|
|||||||
9
.config/nvim/lua/lazyvim/plugins/oil.lua
Normal file
9
.config/nvim/lua/lazyvim/plugins/oil.lua
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
return {
|
||||||
|
'stevearc/oil.nvim',
|
||||||
|
enabled = true,
|
||||||
|
lazy = false,
|
||||||
|
opts = {
|
||||||
|
default_file_explorer = true,
|
||||||
|
},
|
||||||
|
dependencies = { { "echasnovski/mini.icons", opts = {} } },
|
||||||
|
}
|
||||||
@ -1,6 +1,7 @@
|
|||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
"L3MON4D3/LuaSnip",
|
"L3MON4D3/LuaSnip",
|
||||||
|
enabled = true,
|
||||||
dependencies = {
|
dependencies = {
|
||||||
"rafamadriz/friendly-snippets",
|
"rafamadriz/friendly-snippets",
|
||||||
config = function()
|
config = function()
|
||||||
|
|||||||
@ -3,30 +3,31 @@ local util = require("lazyvim.utils")
|
|||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
"nvim-telescope/telescope.nvim",
|
"nvim-telescope/telescope.nvim",
|
||||||
|
enabled = true,
|
||||||
event = "VeryLazy",
|
event = "VeryLazy",
|
||||||
keys = {
|
keys = {
|
||||||
{ "<leader>/", util.telescope("live_grep"), desc = "Telescope Find in Files (Grep)" },
|
{ "<leader>/", util.telescope("live_grep"), desc = "Telescope Find in Files (Grep)" },
|
||||||
{ "<leader><space>", util.telescope("find_files"), desc = "Telescope Find Files (root dir)" },
|
{ "<leader><space>", util.telescope("find_files"), desc = "Telescope Find Files (root dir)" },
|
||||||
{ "<leader>ff", util.telescope("find_files"), desc = "Telescope Find Files (root dir)" },
|
{ "<leader>fn", util.telescope("find_files", { dir = "~/.config/nvim/" }), desc = "Telescope Find Files (config)" },
|
||||||
{ "<leader>fF", util.telescope("find_files", { cwd = false }), desc = "Telescope Find Files (cwd)" },
|
{ "<leader>ff", util.telescope("find_files", { cwd = false }), desc = "Telescope Find Files (cwd)" },
|
||||||
{ "<leader>fr", "<cmd>Telescope oldfiles<cr>", desc = "Telescope Recent" },
|
{ "<leader>fr", "<cmd>Telescope oldfiles<cr>", desc = "Telescope Recent" },
|
||||||
{ "<leader>gc", "<cmd>Telescope git_commits<CR>", desc = "Telescope commits" },
|
{ "<leader>gc", "<cmd>Telescope git_commits<CR>", desc = "Telescope commits" },
|
||||||
{ "<leader>gs", "<cmd>Telescope git_status<CR>", desc = "Telescope status" },
|
{ "<leader>gs", "<cmd>Telescope git_status<CR>", desc = "Telescope status" },
|
||||||
{ "<leader>gb", "<cmd>Telescope git_branches<CR>", desc = "Telescope branches" },
|
{ "<leader>gb", "<cmd>Telescope git_branches<CR>", desc = "Telescope branches" },
|
||||||
{ "<leader>ha", "<cmd>Telescope autocommands<cr>", desc = "Telescope Auto Commands" },
|
{ "<leader>ha", "<cmd>Telescope autocommands<cr>", desc = "Telescope Auto Commands" },
|
||||||
{ "<leader>hc", "<cmd>Telescope commands<cr>", desc = "Telescope Commands" },
|
{ "<leader>hc", "<cmd>Telescope commands<cr>", desc = "Telescope Commands" },
|
||||||
{ "<leader>hf", "<cmd>Telescope filetypes<cr>", desc = "Telescope File Types" },
|
{ "<leader>hf", "<cmd>Telescope filetypes<cr>", desc = "Telescope File Types" },
|
||||||
{ "<leader>hh", "<cmd>Telescope help_tags<cr>", desc = "Telescope Help Pages" },
|
{ "<leader>hh", "<cmd>Telescope help_tags<cr>", desc = "Telescope Help Pages" },
|
||||||
{ "<leader>hk", "<cmd>Telescope keymaps<cr>", desc = "Telescope Key Maps" },
|
{ "<leader>hk", "<cmd>Telescope keymaps<cr>", desc = "Telescope Key Maps" },
|
||||||
{ "<leader>hm", "<cmd>Telescope man_pages<cr>", desc = "Telescope Man Pages" },
|
{ "<leader>hm", "<cmd>Telescope man_pages<cr>", desc = "Telescope Man Pages" },
|
||||||
{ "<leader>ho", "<cmd>Telescope vim_options<cr>", desc = "Telescope Options" },
|
{ "<leader>ho", "<cmd>Telescope vim_options<cr>", desc = "Telescope Options" },
|
||||||
{ "<leader>hs", "<cmd>Telescope highlights<cr>", desc = "Telescope Search Highlight Groups" },
|
{ "<leader>hs", "<cmd>Telescope highlights<cr>", desc = "Telescope Search Highlight Groups" },
|
||||||
{ "<leader>ht", "<cmd>Telescope builtin<cr>", desc = "Telescope" },
|
{ "<leader>ht", "<cmd>Telescope builtin<cr>", desc = "Telescope" },
|
||||||
{ "<leader>sb", "<cmd>Telescope current_buffer_fuzzy_find<cr>", desc = "Telescope Buffer" },
|
{ "<leader>sb", "<cmd>Telescope current_buffer_fuzzy_find<cr>", desc = "Telescope in Buffer" },
|
||||||
{ "<leader>sc", "<cmd>Telescope command_history<cr>", desc = "Telescope Command History" },
|
{ "<leader>sc", "<cmd>Telescope command_history<cr>", desc = "Telescope Command History" },
|
||||||
{ "<leader>sg", util.telescope("live_grep", { cwd = false }), desc = "Telescope Grep (cwd)" },
|
{ "<leader>sg", util.telescope("live_grep", { cwd = false }), desc = "Telescope Grep (cwd)" },
|
||||||
{ "<leader>sm", "<cmd>Telescope marks<cr>", desc = "Telescope Jump to Mark" },
|
{ "<leader>sm", "<cmd>Telescope marks<cr>", desc = "Telescope Jump to Mark" },
|
||||||
{ "<leader>so", "<cmd>Telescope resume<cr>", desc = "Telescope Resume last search" },
|
{ "<leader>so", "<cmd>Telescope resume<cr>", desc = "Telescope Resume last search" },
|
||||||
{
|
{
|
||||||
"<leader>ss",
|
"<leader>ss",
|
||||||
util.telescope("lsp_document_symbols", {
|
util.telescope("lsp_document_symbols", {
|
||||||
@ -45,8 +46,8 @@ return {
|
|||||||
}),
|
}),
|
||||||
desc = "Goto Symbol",
|
desc = "Goto Symbol",
|
||||||
},
|
},
|
||||||
{ "<leader>,", "<cmd>Telescope buffers show_all_buffers=true<cr>", desc = "Switch Buffer" },
|
{ "<leader>fb", "<cmd>Telescope buffers show_all_buffers=true<cr>", desc = "Switch Buffer" },
|
||||||
{ "<leader>:", "<cmd>Telescope command_history<cr>", desc = "Command History" },
|
{ "<leader>:", "<cmd>Telescope command_history<cr>", desc = "Command History" },
|
||||||
},
|
},
|
||||||
opts = {
|
opts = {
|
||||||
defaults = {
|
defaults = {
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
"nvim-treesitter/nvim-treesitter",
|
"nvim-treesitter/nvim-treesitter",
|
||||||
build = ":TSUpdate",
|
|
||||||
enable = true,
|
enable = true,
|
||||||
|
build = ":TSUpdate",
|
||||||
disable = function(lang, buf)
|
disable = function(lang, buf)
|
||||||
local max_filesize = 100 * 1024 -- 100 KB
|
local max_filesize = 100 * 1024 -- 100 KB
|
||||||
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
|
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
"folke/trouble.nvim",
|
"folke/trouble.nvim",
|
||||||
|
enabled = true,
|
||||||
cmd = { "Trouble" },
|
cmd = { "Trouble" },
|
||||||
opts = { use_diagnostic_signs = true },
|
opts = { use_diagnostic_signs = true },
|
||||||
keys = {
|
keys = {
|
||||||
|
|||||||
@ -3,9 +3,11 @@ local icons = require("lazyvim.config.icons")
|
|||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
"nvim-lua/plenary.nvim",
|
"nvim-lua/plenary.nvim",
|
||||||
|
enabled = true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"RRethy/vim-illuminate",
|
"RRethy/vim-illuminate",
|
||||||
|
enabled = true,
|
||||||
event = "BufReadPost",
|
event = "BufReadPost",
|
||||||
config = function()
|
config = function()
|
||||||
require("illuminate").configure({ delay = 200 })
|
require("illuminate").configure({ delay = 200 })
|
||||||
@ -18,6 +20,7 @@ return {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"nvim-lua/popup.nvim",
|
"nvim-lua/popup.nvim",
|
||||||
|
enabled = true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"rcarriga/nvim-notify",
|
"rcarriga/nvim-notify",
|
||||||
@ -51,6 +54,7 @@ return {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"echasnovski/mini.bufremove",
|
"echasnovski/mini.bufremove",
|
||||||
|
enabled = true,
|
||||||
event = "VeryLazy",
|
event = "VeryLazy",
|
||||||
-- stylua: ignore
|
-- stylua: ignore
|
||||||
keys = {
|
keys = {
|
||||||
@ -93,16 +97,20 @@ return {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"mbbill/undotree",
|
"mbbill/undotree",
|
||||||
|
enabled = true,
|
||||||
cmd = { "UndotreeToggle" },
|
cmd = { "UndotreeToggle" },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"MunifTanjim/nui.nvim",
|
"MunifTanjim/nui.nvim",
|
||||||
|
enabled = true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kyazdani42/nvim-web-devicons",
|
"kyazdani42/nvim-web-devicons",
|
||||||
|
enabled = true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"lukas-reineke/indent-blankline.nvim",
|
"lukas-reineke/indent-blankline.nvim",
|
||||||
|
enabled = true,
|
||||||
opts = {},
|
opts = {},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -119,9 +127,11 @@ return {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"preservim/vim-markdown",
|
"preservim/vim-markdown",
|
||||||
|
enabled = true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"nacro90/numb.nvim",
|
"nacro90/numb.nvim",
|
||||||
|
enabled = true,
|
||||||
event = "BufEnter",
|
event = "BufEnter",
|
||||||
config = function()
|
config = function()
|
||||||
require("numb").setup({
|
require("numb").setup({
|
||||||
@ -132,44 +142,11 @@ return {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"junegunn/vim-slash",
|
"junegunn/vim-slash",
|
||||||
},
|
enabled = true,
|
||||||
{
|
|
||||||
"folke/zen-mode.nvim",
|
|
||||||
cmd = { "ZenMode" },
|
|
||||||
config = function()
|
|
||||||
require("zen-mode").setup({
|
|
||||||
window = {
|
|
||||||
backdrop = 1,
|
|
||||||
height = 0.9,
|
|
||||||
width = 80,
|
|
||||||
options = {
|
|
||||||
signcolumn = "no",
|
|
||||||
number = false,
|
|
||||||
relativenumber = false,
|
|
||||||
cursorline = true,
|
|
||||||
cursorcolumn = false, -- disable cursor column
|
|
||||||
},
|
|
||||||
},
|
|
||||||
plugins = {
|
|
||||||
gitsigns = { enabled = false },
|
|
||||||
tmux = { enabled = false },
|
|
||||||
twilight = { enabled = false },
|
|
||||||
},
|
|
||||||
on_open = function()
|
|
||||||
vim.g.cmp_active = false
|
|
||||||
vim.cmd([[LspStop]])
|
|
||||||
vim.opt.sidescrolloff = 0
|
|
||||||
end,
|
|
||||||
on_close = function()
|
|
||||||
vim.g.cmp_active = true
|
|
||||||
vim.cmd([[LspStart]])
|
|
||||||
vim.opt.sidescrolloff = 8
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"echasnovski/mini.surround",
|
"echasnovski/mini.surround",
|
||||||
|
enabled = true,
|
||||||
keys = { "gz" },
|
keys = { "gz" },
|
||||||
opts = {
|
opts = {
|
||||||
mappings = {
|
mappings = {
|
||||||
@ -189,6 +166,7 @@ return {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"danymat/neogen",
|
"danymat/neogen",
|
||||||
|
enabled = true,
|
||||||
event = "BufEnter",
|
event = "BufEnter",
|
||||||
config = function()
|
config = function()
|
||||||
require("neogen").setup({
|
require("neogen").setup({
|
||||||
@ -199,6 +177,7 @@ return {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"SmiteshP/nvim-navic",
|
"SmiteshP/nvim-navic",
|
||||||
|
enabled = true,
|
||||||
init = function()
|
init = function()
|
||||||
vim.g.navic_silence = true
|
vim.g.navic_silence = true
|
||||||
require("lazyvim.utils").on_attach(function(client, buffer)
|
require("lazyvim.utils").on_attach(function(client, buffer)
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
return {
|
return {
|
||||||
"folke/which-key.nvim",
|
"folke/which-key.nvim",
|
||||||
|
enabled = true,
|
||||||
dependencies = { "echasnovski/mini.icons" },
|
dependencies = { "echasnovski/mini.icons" },
|
||||||
event = "VeryLazy",
|
event = "VeryLazy",
|
||||||
opts = {
|
opts = {
|
||||||
@ -267,8 +268,7 @@ return {
|
|||||||
{
|
{
|
||||||
"<leader>oc",
|
"<leader>oc",
|
||||||
function()
|
function()
|
||||||
local conceallevel = vim.o.conceallevel > 0 and vim.o.conceallevel or 3
|
utils.toggle("conceallevel", false, { 0, 3 })
|
||||||
utils.toggle("conceallevel", false, { 0, conceallevel })
|
|
||||||
end,
|
end,
|
||||||
desc = "Toggle conceal"
|
desc = "Toggle conceal"
|
||||||
},
|
},
|
||||||
|
|||||||
38
.config/nvim/lua/lazyvim/plugins/zen.lua
Normal file
38
.config/nvim/lua/lazyvim/plugins/zen.lua
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
return {
|
||||||
|
{
|
||||||
|
"folke/zen-mode.nvim",
|
||||||
|
enabled = false,
|
||||||
|
cmd = { "ZenMode" },
|
||||||
|
config = function()
|
||||||
|
require("zen-mode").setup({
|
||||||
|
window = {
|
||||||
|
backdrop = 1,
|
||||||
|
height = 0.9,
|
||||||
|
width = 80,
|
||||||
|
options = {
|
||||||
|
signcolumn = "no",
|
||||||
|
number = false,
|
||||||
|
relativenumber = false,
|
||||||
|
cursorline = true,
|
||||||
|
cursorcolumn = false, -- disable cursor column
|
||||||
|
},
|
||||||
|
},
|
||||||
|
plugins = {
|
||||||
|
gitsigns = { enabled = false },
|
||||||
|
tmux = { enabled = false },
|
||||||
|
twilight = { enabled = false },
|
||||||
|
},
|
||||||
|
on_open = function()
|
||||||
|
vim.g.cmp_active = false
|
||||||
|
vim.cmd([[LspStop]])
|
||||||
|
vim.opt.sidescrolloff = 0
|
||||||
|
end,
|
||||||
|
on_close = function()
|
||||||
|
vim.g.cmp_active = true
|
||||||
|
vim.cmd([[LspStart]])
|
||||||
|
vim.opt.sidescrolloff = 8
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
@ -1,6 +1,7 @@
|
|||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
"mickael-menu/zk-nvim",
|
"mickael-menu/zk-nvim",
|
||||||
|
enabled = true,
|
||||||
event = "VeryLazy",
|
event = "VeryLazy",
|
||||||
opts = {
|
opts = {
|
||||||
picker = "telescope",
|
picker = "telescope",
|
||||||
|
|||||||
@ -30,7 +30,7 @@ function M.get_root()
|
|||||||
---@type string[]
|
---@type string[]
|
||||||
local roots = {}
|
local roots = {}
|
||||||
if path then
|
if path then
|
||||||
for _, client in pairs(vim.lsp.get_active_clients({ bufnr = 0 })) do
|
for _, client in pairs(vim.lsp.get_clients({ bufnr = 0 })) do
|
||||||
local workspace = client.config.workspace_folders
|
local workspace = client.config.workspace_folders
|
||||||
local paths = workspace
|
local paths = workspace
|
||||||
and vim.tbl_map(function(ws)
|
and vim.tbl_map(function(ws)
|
||||||
@ -128,8 +128,10 @@ function M.get_buf_option(opt)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function M.telescope(builtin, opts)
|
function M.telescope(builtin, opts)
|
||||||
|
opts = opts or {}
|
||||||
|
opts.dir = opts.dir or M.get_root()
|
||||||
return function()
|
return function()
|
||||||
require("telescope.builtin")[builtin](vim.tbl_deep_extend("force", { cwd = M.get_root() }, opts or {}))
|
require("telescope.builtin")[builtin](vim.tbl_deep_extend("force", { cwd = opts.dir }, opts))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -141,7 +143,7 @@ function M.setColorscheme(scheme)
|
|||||||
|
|
||||||
if not okay then
|
if not okay then
|
||||||
vim.notify("Colorscheme " .. colorscheme .. " not found!")
|
vim.notify("Colorscheme " .. colorscheme .. " not found!")
|
||||||
vim.cmd("colorsheme habamax")
|
vim.cmd("colorscheme habamax")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
37
.config/nvim/lua/lazyvim/utils/menu.lua
Normal file
37
.config/nvim/lua/lazyvim/utils/menu.lua
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
vim.cmd [[
|
||||||
|
aunmenu PopUp
|
||||||
|
anoremenu PopUp.Inspect <cmd>Inspect<CR>
|
||||||
|
amenu PopUp.-1- <NOP>
|
||||||
|
anoremenu PopUp.Definition <cmd>lua vim.lsp.buf.definition()<CR>
|
||||||
|
anoremenu PopUp.References <cmd>Telescope lsp_references<CR>
|
||||||
|
nnoremenu PopUp.Back <C-t>
|
||||||
|
amenu PopUp.-2- <NOP>
|
||||||
|
amenu PopUp.URL gx
|
||||||
|
]]
|
||||||
|
|
||||||
|
local group = vim.api.nvim_create_augroup("nvim_popupmenu", { clear = true })
|
||||||
|
vim.api.nvim_create_autocmd("MenuPopup", {
|
||||||
|
pattern = "*",
|
||||||
|
group = group,
|
||||||
|
desc = "Custom PopUp Setup",
|
||||||
|
callback = function()
|
||||||
|
vim.cmd [[
|
||||||
|
amenu disable PopUp.Definition
|
||||||
|
amenu disable PopUp.References
|
||||||
|
amenu disable PopUp.URL
|
||||||
|
]]
|
||||||
|
|
||||||
|
if vim.lsp.get_clients({ bufnr = 0 })[1] then
|
||||||
|
vim.cmd [[
|
||||||
|
amenu enable PopUp.Definition
|
||||||
|
amenu enable PopUp.References
|
||||||
|
]]
|
||||||
|
end
|
||||||
|
|
||||||
|
local urls = require("vim.ui")._get_urls()
|
||||||
|
if vim.startswith(urls[1], "http") then
|
||||||
|
vim.cmd [[amenu enable PopUp.URL]]
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
-- TODO: Add autocoommand
|
||||||
52
.config/nvim/lua/lazyvim/utils/telescope/multigrep.lua
Normal file
52
.config/nvim/lua/lazyvim/utils/telescope/multigrep.lua
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
local pickers = require "telescope.pickers"
|
||||||
|
local finders = require "telescope.finders"
|
||||||
|
local make_entry = require "telescope.make_entry"
|
||||||
|
local conf = require "telescope.config".values
|
||||||
|
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
local live_multigrep = function(opts)
|
||||||
|
opts = opts or {}
|
||||||
|
opts.cwd = opts.cwd or vim.uv.cwd()
|
||||||
|
|
||||||
|
local finder = finders.new_async_job({
|
||||||
|
command_generator = function(prompt)
|
||||||
|
if not prompt or prompt == "" then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
local pieces = vim.split(prompt, " ")
|
||||||
|
local args = { "rg" }
|
||||||
|
if pieces[1] then
|
||||||
|
table.insert(args, "-e")
|
||||||
|
table.insert(args, pieces[1])
|
||||||
|
end
|
||||||
|
|
||||||
|
if pieces[2] then
|
||||||
|
table.insert(args, "-g")
|
||||||
|
table.insert(args, pieces[2])
|
||||||
|
end
|
||||||
|
|
||||||
|
---@diagnostic disable-next-line: deprecated
|
||||||
|
return vim.tbl_flatten({ args,
|
||||||
|
{ "--color=never", "--no-heading", "--with-filename", "--line-number", "--column", "--smart-case" }
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
entry_maker = make_entry.gen_from_vimgrep(opts),
|
||||||
|
cwd = opts.cwd,
|
||||||
|
})
|
||||||
|
|
||||||
|
pickers.new(opts, {
|
||||||
|
debounce = 100,
|
||||||
|
prompt_title = "Multi Grep",
|
||||||
|
finder = finder,
|
||||||
|
previewer = conf.grep_previewer(opts),
|
||||||
|
sorter = require("telescope.sorters").empty()
|
||||||
|
}):find()
|
||||||
|
end
|
||||||
|
|
||||||
|
M.setup = function()
|
||||||
|
vim.keymap.set("n", "<leader>sG", live_multigrep, { desc = "Live Multigrep" })
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
53
.config/nvim/lua/lazyvim/utils/term.lua
Normal file
53
.config/nvim/lua/lazyvim/utils/term.lua
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
local state = {
|
||||||
|
floating = {
|
||||||
|
buf = -1,
|
||||||
|
win = -1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function create_floating_window(opts)
|
||||||
|
-- Set default options if not provided
|
||||||
|
opts = opts or {}
|
||||||
|
opts.width = opts.width or math.floor(vim.o.columns * 0.8) -- Default 80% of screen width
|
||||||
|
opts.height = opts.height or math.floor(vim.o.lines * 0.8) -- Default 80% of screen height
|
||||||
|
|
||||||
|
-- Create buffer
|
||||||
|
local buf = nil
|
||||||
|
if vim.api.nvim_buf_is_valid(opts.buf) then
|
||||||
|
buf = opts.buf
|
||||||
|
else
|
||||||
|
buf = vim.api.nvim_create_buf(false, true) -- no file, scratch buffer
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Calculate center position
|
||||||
|
local row = math.floor((vim.o.lines - opts.height) / 2)
|
||||||
|
local col = math.floor((vim.o.columns - opts.width) / 2)
|
||||||
|
|
||||||
|
-- Floating window options
|
||||||
|
local win_opts = {
|
||||||
|
relative = "editor",
|
||||||
|
width = opts.width,
|
||||||
|
height = opts.height,
|
||||||
|
col = col,
|
||||||
|
row = row,
|
||||||
|
style = "minimal",
|
||||||
|
border = "rounded", -- You can use "none", "single", "double", or "rounded"
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Create the floating window
|
||||||
|
local win = vim.api.nvim_open_win(buf, true, win_opts)
|
||||||
|
|
||||||
|
return { buf = buf, win = win }
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Emable usage:
|
||||||
|
vim.api.nvim_create_user_command("FloatTerminal", function()
|
||||||
|
if not vim.api.nvim_win_is_valid(state.floating.win) then
|
||||||
|
state.floating = create_floating_window({ buf = state.floating.buf })
|
||||||
|
if vim.bo[state.floating.buf].buftype ~= "terminal" then
|
||||||
|
vim.cmd.term()
|
||||||
|
end
|
||||||
|
else
|
||||||
|
vim.api.nvim_win_hide(state.floating.win)
|
||||||
|
end
|
||||||
|
end, {})
|
||||||
Loading…
Reference in New Issue
Block a user