initial commit
This commit is contained in:
7
homemanager/neovim/lua/config/autocommands.lua
Normal file
7
homemanager/neovim/lua/config/autocommands.lua
Normal file
@@ -0,0 +1,7 @@
|
||||
vim.api.nvim_create_autocmd({ 'TextYankPost' }, {
|
||||
desc = "Highlight when yanking",
|
||||
group = vim.api.nvim_create_augroup("YankHighlight", { clear = true }),
|
||||
callback = function()
|
||||
vim.highlight.on_yank()
|
||||
end,
|
||||
})
|
||||
44
homemanager/neovim/lua/config/commands.lua
Normal file
44
homemanager/neovim/lua/config/commands.lua
Normal file
@@ -0,0 +1,44 @@
|
||||
local lib = require('lib.window')
|
||||
|
||||
local command = function(name, callback)
|
||||
vim.api.nvim_create_user_command(name, callback, {})
|
||||
end
|
||||
|
||||
command('Settings', function()
|
||||
local path = vim.fn.expand('~/.config/dotfiles/homes/quirinecker/.config/nvim')
|
||||
lib.new_window(path, 'Settings')
|
||||
end)
|
||||
|
||||
command('TransparencyFix', function()
|
||||
require('lualine').setup(require('plugins.lualine').opts)
|
||||
end)
|
||||
|
||||
command('MavenStartCommand', function()
|
||||
local Path = require("plenary.path")
|
||||
local cwd = Path:new(vim.fn.getcwd()):absolute()
|
||||
local baseName = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(0), ":t")
|
||||
|
||||
if vim.fn.filereadable(cwd .. "/pom.xml") ~= 1 then
|
||||
vim.notify("No pom.xml found in current directory", vim.log.levels.ERROR)
|
||||
return
|
||||
end
|
||||
|
||||
if not baseName:match(".java$") then
|
||||
vim.notify("Current buffer is not a java file", vim.log.levels.ERROR)
|
||||
return
|
||||
end
|
||||
|
||||
local lines = vim.api.nvim_buf_get_lines(0, 0, -1, false)
|
||||
|
||||
local className = baseName:gsub(".java", "")
|
||||
local packageName = ""
|
||||
for _, line in ipairs(lines) do
|
||||
if line:match("^package ") then
|
||||
local value = vim.split(line, " ")[2]
|
||||
packageName = value:gsub(";", "")
|
||||
end
|
||||
end
|
||||
|
||||
vim.fn.setreg("+", "mvn exec:java -Dexec.mainClass=" .. packageName .. "." .. className)
|
||||
vim.notify("Copied Start Command to Clipboard", vim.log.levels.INFO)
|
||||
end)
|
||||
6
homemanager/neovim/lua/config/init.lua
Normal file
6
homemanager/neovim/lua/config/init.lua
Normal file
@@ -0,0 +1,6 @@
|
||||
require('config.settings')
|
||||
require('config.keymap')
|
||||
require('config.commands')
|
||||
require('config.setup')
|
||||
require('config.lazy')
|
||||
require('config.autocommands')
|
||||
44
homemanager/neovim/lua/config/keymap.lua
Normal file
44
homemanager/neovim/lua/config/keymap.lua
Normal file
@@ -0,0 +1,44 @@
|
||||
local keymap = vim.keymap.set
|
||||
keymap({ 'v', 'n' }, ' ', '', {})
|
||||
|
||||
local function vn_map(map, action)
|
||||
keymap({ 'v', 'n' }, map, action)
|
||||
end
|
||||
|
||||
-- splitting
|
||||
|
||||
|
||||
-- Clipboard
|
||||
vn_map('<leader>y', [["+y]])
|
||||
keymap('n', '<leader>yy', [["+yy]])
|
||||
vn_map('<leader>op', [[o<Esc>"+p]])
|
||||
vn_map('<leader>p', [["+p]])
|
||||
|
||||
vn_map('<leader>cl', ':bd <cr>')
|
||||
vn_map('<leader>ss', ':w <cr>')
|
||||
vn_map('<leader>sq', ':wq <cr>')
|
||||
vn_map('<leader>sc', ':w <cr> :bd <cr>')
|
||||
|
||||
-- Quickfix List
|
||||
|
||||
vim.keymap.set('n', '<alt>n', ':cnext<cr>')
|
||||
vim.keymap.set('n', '<alt>p', ':cprevious<cr>')
|
||||
|
||||
-- Terminal
|
||||
vim.keymap.set('n', '<leader>tt', function()
|
||||
os.execute("kitty")
|
||||
end)
|
||||
|
||||
-- Copy Path to clipboard
|
||||
vim.keymap.set('n', '<leader>yrp', function()
|
||||
local path = vim.fn.expand("%:p")
|
||||
local relative_path = vim.fn.fnamemodify(path, ":~:.")
|
||||
vim.fn.setreg("+", relative_path)
|
||||
vim.notify('Copied "' .. relative_path .. '" to the clipboard!')
|
||||
end)
|
||||
|
||||
vim.keymap.set('n', '<leader>yap', function()
|
||||
local path = vim.fn.expand("%:p")
|
||||
vim.fn.setreg("+", path)
|
||||
vim.notify('Copied "' .. path .. '" to the clipboard!')
|
||||
end)
|
||||
6
homemanager/neovim/lua/config/lazy.lua
Normal file
6
homemanager/neovim/lua/config/lazy.lua
Normal file
@@ -0,0 +1,6 @@
|
||||
-- require('lazy').setup("plugins")
|
||||
require('lazy').setup({
|
||||
spec = {
|
||||
{import = "plugins.spec"},
|
||||
}
|
||||
})
|
||||
35
homemanager/neovim/lua/config/settings.lua
Normal file
35
homemanager/neovim/lua/config/settings.lua
Normal file
@@ -0,0 +1,35 @@
|
||||
-- Mapleader
|
||||
vim.g.mapleader = ' '
|
||||
|
||||
-- Colors
|
||||
vim.opt.termguicolors = true
|
||||
|
||||
-- tabsize
|
||||
vim.opt.tabstop = 4
|
||||
vim.opt.shiftwidth = 4
|
||||
vim.opt.softtabstop = 4
|
||||
vim.opt.expandtab = true
|
||||
|
||||
-- Line Wrap
|
||||
vim.opt.wrap = false
|
||||
|
||||
-- Searching
|
||||
vim.opt.hlsearch = false
|
||||
vim.opt.incsearch = true
|
||||
|
||||
-- Line Numbering
|
||||
vim.opt.number = true
|
||||
vim.opt.relativenumber = true
|
||||
|
||||
-- Other
|
||||
vim.opt.scrolloff = 8
|
||||
vim.opt.signcolumn = "yes"
|
||||
vim.opt.colorcolumn = "120"
|
||||
vim.opt.smartindent = true
|
||||
|
||||
-- Disabling Netrw
|
||||
vim.g.loaded_netrw = 1
|
||||
vim.g.loaded_netrwPlugin = 1
|
||||
|
||||
-- Tabline
|
||||
vim.opt.showtabline = 1
|
||||
12
homemanager/neovim/lua/config/setup.lua
Normal file
12
homemanager/neovim/lua/config/setup.lua
Normal file
@@ -0,0 +1,12 @@
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
vim.fn.system({
|
||||
"git",
|
||||
"clone",
|
||||
"--filter=blob:none",
|
||||
"https://github.com/folke/lazy.nvim.git",
|
||||
"--branch=stable", -- latest stable release
|
||||
lazypath,
|
||||
})
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
1
homemanager/neovim/lua/config/test.txt
Normal file
1
homemanager/neovim/lua/config/test.txt
Normal file
@@ -0,0 +1 @@
|
||||
package com.example.demo;
|
||||
7
homemanager/neovim/lua/lib/lsp.lua
Normal file
7
homemanager/neovim/lua/lib/lsp.lua
Normal file
@@ -0,0 +1,7 @@
|
||||
M = {}
|
||||
|
||||
function M.has_file(filename)
|
||||
return vim.fn.filereadable(filename) == 1
|
||||
end
|
||||
|
||||
return M
|
||||
15
homemanager/neovim/lua/lib/window.lua
Normal file
15
homemanager/neovim/lua/lib/window.lua
Normal file
@@ -0,0 +1,15 @@
|
||||
return {
|
||||
new_window = function(o_path, o_title)
|
||||
if o_path == nil then
|
||||
o_path = vim.fn.getcwd()
|
||||
end
|
||||
|
||||
if o_title == nil then
|
||||
o_title = "neovim"
|
||||
end
|
||||
|
||||
print(string.format("ghostty --working-directory='%s' --title='%s' -e nvim .", o_path, o_title))
|
||||
return vim.fn.jobstart(string.format("ghostty --working-directory='%s' --title='%s' -e nvim .", o_path, o_title),
|
||||
{ detach = true })
|
||||
end
|
||||
}
|
||||
62
homemanager/neovim/lua/plugins/config/lualine.lua
Normal file
62
homemanager/neovim/lua/plugins/config/lualine.lua
Normal file
@@ -0,0 +1,62 @@
|
||||
local function CurrentTime()
|
||||
return os.date("%H:%M:%S")
|
||||
end
|
||||
|
||||
local function Text(text)
|
||||
return function()
|
||||
return text
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local theme = require('plugins.config.lualine.nord_theme')
|
||||
|
||||
|
||||
local opts = {
|
||||
options = {
|
||||
theme = theme.spec,
|
||||
component_separators = '|',
|
||||
section_separators = { left = ' ', right = ' ' },
|
||||
},
|
||||
sections = {
|
||||
lualine_a = {
|
||||
{ 'mode', separator = { left = ' ', right = '' } },
|
||||
},
|
||||
lualine_b = { {
|
||||
'tabs',
|
||||
seperator = " ",
|
||||
cond = function()
|
||||
return #vim.fn.gettabinfo() >= 2
|
||||
end,
|
||||
tabs_color = {
|
||||
inactive = { fg = theme.colors.nord5 },
|
||||
active = { fg = theme.colors.nord8 },
|
||||
}
|
||||
}, 'filename', 'branch', 'diff' },
|
||||
lualine_c = {},
|
||||
lualine_x = {},
|
||||
lualine_y = { 'filetype', { 'diagnostics', always_visible = true }, 'progress' },
|
||||
lualine_z = {
|
||||
{ CurrentTime, separator = { right = ' ', left = '' } },
|
||||
},
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = {},
|
||||
lualine_x = {},
|
||||
lualine_y = {},
|
||||
lualine_z = {},
|
||||
},
|
||||
tabline = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = {},
|
||||
lualine_x = {},
|
||||
lualine_y = {},
|
||||
lualine_z = {},
|
||||
},
|
||||
extensions = {},
|
||||
}
|
||||
|
||||
require('lualine').setup(opts)
|
||||
@@ -0,0 +1,31 @@
|
||||
local M = {}
|
||||
|
||||
M.colors = {
|
||||
blue = '#80a0ff',
|
||||
cyan = '#79dac8',
|
||||
transparent = nil,
|
||||
white = '#c6c6c6',
|
||||
red = '#ff5189',
|
||||
violet = '#d183e8',
|
||||
grey = '#303030',
|
||||
}
|
||||
|
||||
M.theme = {
|
||||
normal = {
|
||||
a = { fg = M.colors.transparent, bg = M.colors.violet },
|
||||
b = { fg = M.colors.white, bg = M.colors.grey },
|
||||
c = { fg = M.colors.transparent, bg = M.colors.transparent },
|
||||
},
|
||||
|
||||
insert = { a = { fg = M.colors.transparent, bg = M.colors.blue } },
|
||||
visual = { a = { fg = M.colors.transparent, bg = M.colors.cyan } },
|
||||
replace = { a = { fg = M.colors.transparent, bg = M.colors.red } },
|
||||
|
||||
inactive = {
|
||||
a = { fg = M.colors.white, bg = M.colors.transparent },
|
||||
b = { fg = M.colors.white, bg = M.colors.transparent },
|
||||
c = { fg = M.colors.transparent, bg = M.colors.transparent },
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
||||
30
homemanager/neovim/lua/plugins/config/lualine/nord_theme.lua
Normal file
30
homemanager/neovim/lua/plugins/config/lualine/nord_theme.lua
Normal file
@@ -0,0 +1,30 @@
|
||||
local M = {}
|
||||
|
||||
M.colors = {
|
||||
nord1 = '#3B4252',
|
||||
nord3 = '#4C566A',
|
||||
nord5 = '#E5E9F0',
|
||||
nord6 = '#ECEFF4',
|
||||
nord7 = '#8FBCBB',
|
||||
nord8 = '#88C0D0',
|
||||
nord13 = '#EBCB8B',
|
||||
transparent = nil,
|
||||
}
|
||||
|
||||
M.spec = {
|
||||
normal = {
|
||||
a = { fg = M.colors.transparent, bg = M.colors.nord8, gui = 'bold' },
|
||||
b = { fg = M.colors.nord5, bg = M.colors.nord1 },
|
||||
c = { fg = M.colors.transparent, bg = M.colors.transparent },
|
||||
},
|
||||
insert = { a = { fg = M.colors.transparent, bg = M.colors.nord6, gui = 'bold' } },
|
||||
visual = { a = { fg = M.colors.transparent, bg = M.colors.nord7, gui = 'bold' } },
|
||||
replace = { a = { fg = M.colors.transparent, bg = M.colors.nord13, gui = 'bold' } },
|
||||
inactive = {
|
||||
a = { fg = M.colors.nord1, bg = M.colors.transparent, gui = 'bold' },
|
||||
b = { fg = M.colors.nord5, bg = M.colors.transparent },
|
||||
c = { fg = M.colors.transparent, bg = M.colors.transparent },
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
||||
6
homemanager/neovim/lua/plugins/spec/2048.lua
Normal file
6
homemanager/neovim/lua/plugins/spec/2048.lua
Normal file
@@ -0,0 +1,6 @@
|
||||
return {
|
||||
"NStefan002/2048.nvim",
|
||||
cmd = "Play2048",
|
||||
enabled = false,
|
||||
config = true,
|
||||
}
|
||||
4
homemanager/neovim/lua/plugins/spec/color_hints.lua
Normal file
4
homemanager/neovim/lua/plugins/spec/color_hints.lua
Normal file
@@ -0,0 +1,4 @@
|
||||
return {
|
||||
"brenoprata10/nvim-highlight-colors",
|
||||
opts = {}
|
||||
}
|
||||
5
homemanager/neovim/lua/plugins/spec/comment.lua
Normal file
5
homemanager/neovim/lua/plugins/spec/comment.lua
Normal file
@@ -0,0 +1,5 @@
|
||||
return {
|
||||
'numToStr/Comment.nvim',
|
||||
lazy = false,
|
||||
opts = {}
|
||||
}
|
||||
105
homemanager/neovim/lua/plugins/spec/completions.lua
Normal file
105
homemanager/neovim/lua/plugins/spec/completions.lua
Normal file
@@ -0,0 +1,105 @@
|
||||
local function setup()
|
||||
-- Set up nvim-cmp
|
||||
local cmp = require 'cmp'
|
||||
local lspkind = require('lspkind')
|
||||
local cmp_select = { behavior = cmp.SelectBehavior.Select }
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
-- REQUIRED - you must specify a snippet engine
|
||||
expand = function(args)
|
||||
local luasnip = require("luasnip")
|
||||
if not luasnip then
|
||||
return
|
||||
end
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
window = {
|
||||
-- completion = cmp.config.window.bordered(),
|
||||
-- documentation = cmp.config.window.bordered(),
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
['<C-p>'] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }),
|
||||
['<C-n>'] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }),
|
||||
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
['<C-e>'] = cmp.mapping.abort(),
|
||||
['<CR>'] = cmp.mapping.confirm({ select = false }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'luasnip' }, -- For luasnip users.
|
||||
-- { name = 'emoji' }
|
||||
}, {
|
||||
{ name = 'buffer' },
|
||||
}),
|
||||
formatting = {
|
||||
format = lspkind.cmp_format({
|
||||
mode = 'symbol',
|
||||
maxwidth = 50,
|
||||
ellipsis_char = 'b',
|
||||
before = function(entry, vim_item)
|
||||
return vim_item
|
||||
end
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
-- Set configuration for specific filetype.
|
||||
cmp.setup.filetype('gitcommit', {
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'cmp_git' }, -- You can specify the `cmp_git` source if you were installed it.
|
||||
}, {
|
||||
{ name = 'buffer' },
|
||||
})
|
||||
})
|
||||
|
||||
-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline({ '/', '?' }, {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = {
|
||||
{ name = 'buffer' }
|
||||
}
|
||||
})
|
||||
|
||||
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline(':', {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'path' }
|
||||
}, {
|
||||
{ name = 'cmdline' }
|
||||
})
|
||||
})
|
||||
|
||||
-- auto pairs
|
||||
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
|
||||
cmp.event:on(
|
||||
'confirm_done',
|
||||
cmp_autopairs.on_confirm_done()
|
||||
)
|
||||
end
|
||||
|
||||
return {
|
||||
'hrsh7th/nvim-cmp',
|
||||
event = { "InsertEnter", "CmdlineEnter" },
|
||||
config = function()
|
||||
setup()
|
||||
end,
|
||||
dependencies = {
|
||||
'hrsh7th/cmp-nvim-lsp',
|
||||
'hrsh7th/cmp-buffer',
|
||||
'hrsh7th/cmp-path',
|
||||
'hrsh7th/cmp-cmdline',
|
||||
'hrsh7th/nvim-cmp',
|
||||
'onsails/lspkind.nvim',
|
||||
'saadparwaiz1/cmp_luasnip',
|
||||
'hrsh7th/cmp-emoji',
|
||||
{ 'windwp/nvim-autopairs', opts = {} },
|
||||
require('plugins.spec.snippets'),
|
||||
require('plugins.spec.lsp'),
|
||||
require('plugins.spec.jdtls')
|
||||
}
|
||||
}
|
||||
23
homemanager/neovim/lua/plugins/spec/dadbod.lua
Normal file
23
homemanager/neovim/lua/plugins/spec/dadbod.lua
Normal file
@@ -0,0 +1,23 @@
|
||||
return {
|
||||
"tpope/vim-dadbod",
|
||||
config = function()
|
||||
local augroup = vim.api.nvim_create_augroup("SqlCompletion", {})
|
||||
|
||||
vim.api.nvim_create_autocmd({ "FileType" }, {
|
||||
group = augroup,
|
||||
pattern = { "sql", "mysql", "plsql" },
|
||||
callback = function()
|
||||
require('cmp').setup.buffer({
|
||||
sources = {
|
||||
{ name = 'vim-dadbod-completion' }
|
||||
}
|
||||
})
|
||||
end
|
||||
})
|
||||
end,
|
||||
dependencies = {
|
||||
"kristijanhusak/vim-dadbod-ui",
|
||||
"pbogut/vim-dadbod-ssh",
|
||||
"kristijanhusak/vim-dadbod-completion"
|
||||
}
|
||||
}
|
||||
13
homemanager/neovim/lua/plugins/spec/fugitive.lua
Normal file
13
homemanager/neovim/lua/plugins/spec/fugitive.lua
Normal file
@@ -0,0 +1,13 @@
|
||||
return {
|
||||
'tpope/vim-fugitive',
|
||||
keys = {
|
||||
{ '<leader>gg', ':Git<cr>', 'Git Status' },
|
||||
{ '<leader>gc', function()
|
||||
if vim.bo.filetype == 'fugitive' then
|
||||
vim.cmd.close()
|
||||
end
|
||||
vim.cmd("Git commit")
|
||||
end, '(g)it (c)ommit' }
|
||||
},
|
||||
cmd = 'Git'
|
||||
}
|
||||
28
homemanager/neovim/lua/plugins/spec/gen.lua
Normal file
28
homemanager/neovim/lua/plugins/spec/gen.lua
Normal file
@@ -0,0 +1,28 @@
|
||||
return {
|
||||
"David-Kunz/gen.nvim",
|
||||
opts = {
|
||||
model = "deepseek-r1:14b", -- The default model to use.
|
||||
host = "localhost", -- The host running the Ollama service.
|
||||
port = "11434", -- The port on which the Ollama service is listening.
|
||||
quit_map = "q", -- set keymap for close the response window
|
||||
retry_map = "<c-r>", -- set keymap to re-send the current prompt
|
||||
init = function(options) pcall(io.popen, "ollama serve > /dev/null 2>&1 &") end,
|
||||
-- Function to initialize Ollama
|
||||
command = function(options)
|
||||
local body = { model = options.model, stream = true }
|
||||
return "curl --silent --no-buffer -X POST http://" ..
|
||||
options.host .. ":" .. options.port .. "/api/chat -d $body"
|
||||
end,
|
||||
-- The command for the Ollama service. You can use placeholders $prompt, $model and $body (shellescaped).
|
||||
-- This can also be a command string.
|
||||
-- The executed command must return a JSON object with { response, context }
|
||||
-- (context property is optional).
|
||||
-- list_models = '<omitted lua function>', -- Retrieves a list of model names
|
||||
display_mode = "split", -- The display mode. Can be "float" or "split".
|
||||
show_prompt = true, -- Shows the prompt submitted to Ollama.
|
||||
show_model = true, -- Displays which model you are using at the beginning of your chat session.
|
||||
no_auto_close = true, -- Never closes the window automatically.
|
||||
debug = false -- Prints errors and the command which is run.
|
||||
}
|
||||
}
|
||||
|
||||
8
homemanager/neovim/lua/plugins/spec/hologram.lua
Normal file
8
homemanager/neovim/lua/plugins/spec/hologram.lua
Normal file
@@ -0,0 +1,8 @@
|
||||
return {
|
||||
'edluffy/hologram.nvim',
|
||||
event = 'VeryLazy',
|
||||
enabled = false,
|
||||
opts = {
|
||||
auto_display = true
|
||||
}
|
||||
}
|
||||
5
homemanager/neovim/lua/plugins/spec/init.lua
Normal file
5
homemanager/neovim/lua/plugins/spec/init.lua
Normal file
@@ -0,0 +1,5 @@
|
||||
local plugins = {
|
||||
'mfussenegger/nvim-jdtls',
|
||||
}
|
||||
|
||||
return plugins
|
||||
15
homemanager/neovim/lua/plugins/spec/jdtls.lua
Normal file
15
homemanager/neovim/lua/plugins/spec/jdtls.lua
Normal file
@@ -0,0 +1,15 @@
|
||||
return {
|
||||
enabled = false,
|
||||
"mfussenegger/nvim-jdtls",
|
||||
config = function()
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
require("jdtls").start_or_attach({
|
||||
cmd = { "jdtls" },
|
||||
root_dir = vim.fs.dirname(vim.fs.find({ 'gradlew', '.git', 'mvnw', 'pom.xml' }, { upward = true })[1]),
|
||||
capabilities = capabilities
|
||||
})
|
||||
end,
|
||||
dependencies = {
|
||||
require("plugins.spec.lsp")
|
||||
}
|
||||
}
|
||||
188
homemanager/neovim/lua/plugins/spec/lsp.lua
Normal file
188
homemanager/neovim/lua/plugins/spec/lsp.lua
Normal file
@@ -0,0 +1,188 @@
|
||||
local function keymap(args)
|
||||
-- get client
|
||||
local bufnr = args.buf
|
||||
local client = vim.lsp.get_client_by_id(args.data.client_id)
|
||||
if not client then
|
||||
return
|
||||
end
|
||||
|
||||
-- loading workspace diagnostics
|
||||
require('workspace-diagnostics').populate_workspace_diagnostics(client, bufnr)
|
||||
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||
|
||||
-- Mappings.
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
local bufopts = { noremap = true, silent = true, buffer = bufnr }
|
||||
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
|
||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
|
||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts)
|
||||
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
|
||||
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts)
|
||||
vim.keymap.set('n', '<A-k>', function()
|
||||
vim.diagnostic.open_float({ focusable = false, border = "rounded" })
|
||||
end, bufopts)
|
||||
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, bufopts)
|
||||
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, bufopts)
|
||||
vim.keymap.set('n', '<space>wl', function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, bufopts)
|
||||
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, bufopts)
|
||||
vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts)
|
||||
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts)
|
||||
|
||||
-- autoformat
|
||||
|
||||
if client.supports_method('textDocument/formatting') then
|
||||
vim.api.nvim_create_autocmd('BufWritePre', {
|
||||
group = vim.api.nvim_create_augroup('LspFormatting', { clear = true }),
|
||||
buffer = args.buf,
|
||||
callback = function()
|
||||
if vim.fn.exists(":LspEslintFixAll") == 1 then
|
||||
vim.cmd(":LspEslintFixAll")
|
||||
else
|
||||
vim.lsp.buf.format { bufnr = args.buf, id = client.id }
|
||||
end
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
-- vim.lsp.inlay_hint.enable(true, { bufnr })
|
||||
end
|
||||
|
||||
local function diagnostic_icons()
|
||||
local signs = {
|
||||
Error = " ",
|
||||
Warn = " ",
|
||||
Hint = " ",
|
||||
Info = " "
|
||||
}
|
||||
|
||||
for type, icon in pairs(signs) do
|
||||
local hl = "DiagnosticSign" .. type
|
||||
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
|
||||
end
|
||||
end
|
||||
|
||||
local function configToHandler(server, config)
|
||||
return function()
|
||||
require("lspconfig")[server].setup(config)
|
||||
end
|
||||
end
|
||||
|
||||
local function lsp_setup()
|
||||
local lspconfig = require("lspconfig")
|
||||
-- adding edge cases for workspace diagnostics
|
||||
require('workspace-diagnostics').setup {
|
||||
workspace_files = function()
|
||||
local gitPath = vim.fn.systemlist("git rev-parse --show-toplevel")[1]
|
||||
local workspace_files = vim.fn.split(vim.fn.system("git ls-files " .. gitPath), "\n")
|
||||
-- this makes nuxt laod the nuxt typescript definition
|
||||
table.insert(workspace_files, '.nuxt/nuxt.d.ts')
|
||||
return workspace_files
|
||||
end
|
||||
}
|
||||
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
desc = "LSP actions",
|
||||
callback = keymap
|
||||
})
|
||||
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
|
||||
local with_defaults = function(config)
|
||||
config.capabilities = capabilities
|
||||
return config
|
||||
end
|
||||
|
||||
require('mason').setup({})
|
||||
require('mason-lspconfig').setup { ensure_installed = {} }
|
||||
|
||||
vim.lsp.enable({
|
||||
'vue_ls',
|
||||
'nil_ls',
|
||||
'nixd',
|
||||
'rust_analyzer',
|
||||
'lua_ls',
|
||||
'gdscript',
|
||||
'jsonls',
|
||||
'r_language_server',
|
||||
'tailwindcss',
|
||||
'html',
|
||||
'taplo',
|
||||
'protols',
|
||||
'yamlls',
|
||||
'clangd',
|
||||
'eslint',
|
||||
'nushell',
|
||||
'tinymist'
|
||||
-- 'jdtls'
|
||||
})
|
||||
|
||||
-- not collision between deno lsp and ts lsp
|
||||
if require("lib.lsp").has_file("deno.json") then
|
||||
vim.lsp.enable("denols")
|
||||
else
|
||||
vim.lsp.enable("vtsls")
|
||||
-- vim.lsp.enable("ts_ls") this is disabled vtsls for vue required
|
||||
end
|
||||
|
||||
vim.lsp.config('*', with_defaults({}))
|
||||
vim.lsp.config('vue_ls', with_defaults(require("plugins.spec.server_configurations.vue")))
|
||||
vim.lsp.config('nil_ls', with_defaults(require("plugins.spec.server_configurations.nix")['nil']))
|
||||
vim.lsp.config('nixd', with_defaults(require("plugins.spec.server_configurations.nix")['nixd']))
|
||||
vim.lsp.config('rust_analyzer', with_defaults(require("plugins.spec.server_configurations.rust")))
|
||||
vim.lsp.config('lua_ls', with_defaults(require("plugins.spec.server_configurations.lua")))
|
||||
vim.lsp.config('gdscript', with_defaults(require("plugins.spec.server_configurations.gdscript")))
|
||||
vim.lsp.config('ts_ls', with_defaults(require("plugins.spec.server_configurations.typescript").config()))
|
||||
vim.lsp.config('jsonls', with_defaults(require("plugins.spec.server_configurations.json")))
|
||||
vim.lsp.config('yamlls', with_defaults(require("plugins.spec.server_configurations.yaml")))
|
||||
vim.lsp.config('denols', with_defaults(require("plugins.spec.server_configurations.deno").config()))
|
||||
vim.lsp.config('r_language_server', with_defaults({
|
||||
cmd = { "R", "--no-echo", "-e", "languageserver::run()" }
|
||||
}))
|
||||
vim.lsp.config('jdtls', with_defaults(require("plugins.spec.server_configurations.java")))
|
||||
vim.lsp.config('tailwindcss', with_defaults(require("plugins.spec.server_configurations.tailwindcss")))
|
||||
vim.lsp.config('html', with_defaults(require("plugins.spec.server_configurations.html")))
|
||||
vim.lsp.config('taplo', with_defaults(require("plugins.spec.server_configurations.taplo")))
|
||||
vim.lsp.config('protols', with_defaults(require("plugins.spec.server_configurations.proto")))
|
||||
vim.lsp.config('clangd', with_defaults(require("plugins.spec.server_configurations.clang")))
|
||||
vim.lsp.config('vtsls', with_defaults(require("plugins.spec.server_configurations.vtsls").config()))
|
||||
vim.lsp.config('eslint', with_defaults(require("plugins.spec.server_configurations.eslint")))
|
||||
vim.lsp.config('tinymist', with_defaults({
|
||||
cmd = { "tinymist" }
|
||||
}))
|
||||
|
||||
vim.diagnostic.config({
|
||||
virtual_text = {
|
||||
prefix = '●', -- or '■', '▎', 'x', '' whatever you want
|
||||
spacing = 2,
|
||||
},
|
||||
underline = true,
|
||||
update_in_insert = false, -- set to true if you want real-time errors while typing
|
||||
severity_sort = true,
|
||||
signs = {
|
||||
text = {
|
||||
[vim.diagnostic.severity.ERROR] = "",
|
||||
[vim.diagnostic.severity.WARN] = "",
|
||||
[vim.diagnostic.severity.INFO] = "",
|
||||
[vim.diagnostic.severity.HINT] = "",
|
||||
}
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
return {
|
||||
'neovim/nvim-lspconfig',
|
||||
event = { "BufReadPost", "BufNewFile" },
|
||||
config = function()
|
||||
lsp_setup()
|
||||
end,
|
||||
dependencies = {
|
||||
{ 'williamboman/mason.nvim' },
|
||||
{ 'williamboman/mason-lspconfig.nvim' },
|
||||
'artemave/workspace-diagnostics.nvim',
|
||||
}
|
||||
}
|
||||
11
homemanager/neovim/lua/plugins/spec/lualine.lua
Normal file
11
homemanager/neovim/lua/plugins/spec/lualine.lua
Normal file
@@ -0,0 +1,11 @@
|
||||
return {
|
||||
'nvim-lualine/lualine.nvim',
|
||||
event = "VeryLazy",
|
||||
lazy = false,
|
||||
config = function()
|
||||
require('plugins.config.lualine')
|
||||
end,
|
||||
dependencies = {
|
||||
require("plugins.spec.theme")
|
||||
}
|
||||
}
|
||||
20
homemanager/neovim/lua/plugins/spec/markdown.lua
Normal file
20
homemanager/neovim/lua/plugins/spec/markdown.lua
Normal file
@@ -0,0 +1,20 @@
|
||||
function preview()
|
||||
if vim.bo.filetype ~= "markdown" then
|
||||
return nil
|
||||
end
|
||||
|
||||
vim.cmd("MarkdownPreview")
|
||||
end
|
||||
|
||||
return {
|
||||
"iamcco/markdown-preview.nvim",
|
||||
cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" },
|
||||
build = "cd app && yarn install",
|
||||
keys = {
|
||||
{ "<leader>p", preview, desc = "Markdown Preview" },
|
||||
},
|
||||
init = function()
|
||||
vim.g.mkdp_filetypes = { "markdown" }
|
||||
end,
|
||||
ft = { "markdown" },
|
||||
}
|
||||
4
homemanager/neovim/lua/plugins/spec/mini.bracketed.lua
Normal file
4
homemanager/neovim/lua/plugins/spec/mini.bracketed.lua
Normal file
@@ -0,0 +1,4 @@
|
||||
return {
|
||||
"echasnovski/mini.bracketed",
|
||||
opts = {},
|
||||
}
|
||||
39
homemanager/neovim/lua/plugins/spec/noice.lua
Normal file
39
homemanager/neovim/lua/plugins/spec/noice.lua
Normal file
@@ -0,0 +1,39 @@
|
||||
return {
|
||||
'folke/noice.nvim',
|
||||
event = "UIEnter",
|
||||
enabled = true,
|
||||
opts = {
|
||||
messages = {
|
||||
enabled = false,
|
||||
view = "mini",
|
||||
view_warn = "mini",
|
||||
view_error = "mini"
|
||||
},
|
||||
lsp = {
|
||||
-- override makdown rendering so that **cmp** and other plugins use **Treesitter**
|
||||
override = {
|
||||
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
|
||||
["vim.lsp.util.stylize_markdown"] = true,
|
||||
["cmp.entry.get_documentation"] = true,
|
||||
},
|
||||
hover = {
|
||||
enabled = false,
|
||||
},
|
||||
signature = {
|
||||
enabled = false
|
||||
}
|
||||
},
|
||||
-- you can enable a preset for easier configuration
|
||||
presets = {
|
||||
bottom_search = true, -- use a classic bottom cmdline for search
|
||||
command_palette = true, -- position the cmdline and popupmenu together
|
||||
long_message_to_split = true, -- long messages will be sent to a split
|
||||
inc_rename = false, -- enables an input dialog for inc-rename.nvim
|
||||
lsp_doc_border = false, -- add a border to hover docs and signature help
|
||||
},
|
||||
},
|
||||
dependencies = {
|
||||
'MunifTanjim/nui.nvim',
|
||||
require("plugins.spec.notify")
|
||||
}
|
||||
}
|
||||
12
homemanager/neovim/lua/plugins/spec/notify.lua
Normal file
12
homemanager/neovim/lua/plugins/spec/notify.lua
Normal file
@@ -0,0 +1,12 @@
|
||||
return {
|
||||
'rcarriga/nvim-notify',
|
||||
event = "UIEnter",
|
||||
lazy = false,
|
||||
config = function()
|
||||
require('notify').setup {
|
||||
background_colour = "#000000",
|
||||
}
|
||||
|
||||
vim.notify = require('notify')
|
||||
end
|
||||
}
|
||||
20
homemanager/neovim/lua/plugins/spec/nvim_dap.lua
Normal file
20
homemanager/neovim/lua/plugins/spec/nvim_dap.lua
Normal file
@@ -0,0 +1,20 @@
|
||||
return {
|
||||
'mfussenegger/nvim-dap',
|
||||
dependencies = {
|
||||
{'jay-babu/mason-nvim-dap.nvim', opts = {
|
||||
handlers = {
|
||||
function (config)
|
||||
require('mason-nvim-dap').default_setup(config)
|
||||
end,
|
||||
cppdbg = function (config)
|
||||
config.adapters.lldb = {
|
||||
type = 'executable',
|
||||
command = 'lldb-vscode',
|
||||
name = 'lldb'
|
||||
}
|
||||
require('mason-nvim-dap').default_setup(config)
|
||||
end
|
||||
}
|
||||
}}
|
||||
}
|
||||
}
|
||||
20
homemanager/neovim/lua/plugins/spec/oil.lua
Normal file
20
homemanager/neovim/lua/plugins/spec/oil.lua
Normal file
@@ -0,0 +1,20 @@
|
||||
local function oil()
|
||||
require("oil").open()
|
||||
end
|
||||
|
||||
return {
|
||||
'stevearc/oil.nvim',
|
||||
opts = {
|
||||
view_options = {
|
||||
show_hidden = true
|
||||
}
|
||||
},
|
||||
lazy = false,
|
||||
cmd = 'Oil',
|
||||
keys = {
|
||||
{"<leader>ft", oil, ""}
|
||||
},
|
||||
dependencies = {
|
||||
'kyazdani42/nvim-web-devicons',
|
||||
}
|
||||
}
|
||||
6
homemanager/neovim/lua/plugins/spec/project_config.lua
Normal file
6
homemanager/neovim/lua/plugins/spec/project_config.lua
Normal file
@@ -0,0 +1,6 @@
|
||||
return {
|
||||
'windwp/nvim-projectconfig',
|
||||
enabled = true,
|
||||
opts = {},
|
||||
lazy = false
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
return {
|
||||
cmd = { "clangd" },
|
||||
filetypes = { "c", "cpp", "objc", "objcpp" },
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
return {
|
||||
config = function()
|
||||
return {}
|
||||
end
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
return {
|
||||
cmd = { "vscode-eslint-language-server", "--stdio" }
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
return {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
return {
|
||||
cmd = { "vscode-html-language-server", "--stdio" },
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
return {
|
||||
cmd = { "jdtls", "-configuration", "/home/quirinecker/.cache/jdtls/config", "-data", "/home/quirinecker/.cache/jdtls/workspace" },
|
||||
java = {
|
||||
contentProvider = { preferred = 'fernflower' },
|
||||
configuration = {
|
||||
updateBuildConfiguration = 'interactive',
|
||||
},
|
||||
},
|
||||
{
|
||||
jvm_args = {},
|
||||
workspace = "/home/quirinecker/.cache/jdtls/workspace"
|
||||
},
|
||||
init_options = {
|
||||
jvm_args = {
|
||||
"--enable-preview"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
return {
|
||||
cmd = { "vscode-json-language-server", "--stdio" },
|
||||
settings = {
|
||||
json = {
|
||||
schemas = {
|
||||
{
|
||||
fileMatch = { 'package.json' },
|
||||
url = 'https://json.schemastore.org/package.json',
|
||||
},
|
||||
{
|
||||
fileMatch = { 'tsconfig.json', 'tsconfig.*.json' },
|
||||
url = 'https://json.schemastore.org/tsconfig.json'
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
function should_load_nvim_workspace()
|
||||
return true
|
||||
end
|
||||
|
||||
return {
|
||||
on_init = function(client)
|
||||
if not should_load_nvim_workspace() then
|
||||
return
|
||||
end
|
||||
|
||||
client.config.settings.Lua = vim.tbl_deep_extend('force', client.config.settings.Lua, {
|
||||
runtime = {
|
||||
-- Tell the language server which version of Lua you're using (most
|
||||
-- likely LuaJIT in the case of Neovim)
|
||||
version = 'LuaJIT',
|
||||
-- Tell the language server how to find Lua modules same way as Neovim
|
||||
-- (see `:h lua-module-load`)
|
||||
path = {
|
||||
'lua/?.lua',
|
||||
'lua/?/init.lua',
|
||||
},
|
||||
},
|
||||
-- Make the server aware of Neovim runtime files
|
||||
workspace = {
|
||||
checkThirdParty = false,
|
||||
library = {
|
||||
vim.env.VIMRUNTIME
|
||||
-- Depending on the usage, you might want to add additional paths
|
||||
-- here.
|
||||
-- '${3rd}/luv/library'
|
||||
-- '${3rd}/busted/library'
|
||||
}
|
||||
-- Or pull in all of 'runtimepath'.
|
||||
-- NOTE: this is a lot slower and will cause issues when working on
|
||||
-- your own configuration.
|
||||
-- See https://github.com/neovim/nvim-lspconfig/issues/3189
|
||||
-- library = {
|
||||
-- vim.api.nvim_get_runtime_file('', true),
|
||||
-- }
|
||||
}
|
||||
})
|
||||
end,
|
||||
settings = {
|
||||
Lua = {}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
return {
|
||||
['nil'] = {
|
||||
cmd = { "nil" },
|
||||
settings = {
|
||||
["nil"] = {
|
||||
formatting = {
|
||||
command = { "nixfmt" },
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
},
|
||||
['nixd'] = {
|
||||
cmd = { "nixd" },
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
return {
|
||||
cmd = {"protols"}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
return {
|
||||
cmd = { "pyright" },
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
return {
|
||||
cmd = { "rust-analyzer" },
|
||||
settings = {
|
||||
["rust-analyzer"] = {
|
||||
rustfmt = {
|
||||
overrideCommand = { "rustfmt" },
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
return {
|
||||
cmd = { "tailwindcss-language-server", "--stdio" },
|
||||
root_markers = { "package.json" },
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
return {
|
||||
cmd = { "taplo", "lsp", "stdio" }
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
return {
|
||||
config = function()
|
||||
local vuePluginPath = vim.fn.expand(
|
||||
"~/.config/dotfiles/homes/quirinecker/.npm_global/node_modules/@vue/typescript-plugin/")
|
||||
|
||||
return {
|
||||
cmd = { "typescript-language-server", "--stdio" },
|
||||
single_file_support = true,
|
||||
init_options = {
|
||||
plugins = {
|
||||
{
|
||||
name = "@vue/typescript-plugin",
|
||||
location = vuePluginPath,
|
||||
languages = { "javascript", "typescript", "vue" },
|
||||
},
|
||||
},
|
||||
},
|
||||
filetypes = {
|
||||
"javascript",
|
||||
"typescript",
|
||||
-- currently disabled because no attribute completions
|
||||
-- "vue",
|
||||
}
|
||||
}
|
||||
end
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
return {
|
||||
config = function()
|
||||
local vuePluginPath = vim.fn.expand(
|
||||
"~/.config/dotfiles/homes/quirinecker/.npm_global/node_modules/@vue/typescript-plugin/")
|
||||
local vue_plugin = {
|
||||
name = '@vue/typescript-plugin',
|
||||
location = vuePluginPath,
|
||||
languages = { 'vue' },
|
||||
configNamespace = 'typescript',
|
||||
}
|
||||
|
||||
return {
|
||||
settings = {
|
||||
vtsls = {
|
||||
tsserver = {
|
||||
globalPlugins = {
|
||||
vue_plugin,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
filetypes = { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue' },
|
||||
}
|
||||
end
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
return {
|
||||
cmd = { "vue-language-server", "--stdio" },
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
return {
|
||||
cmd = { "yaml-language-server", "--stdio" },
|
||||
settings = {
|
||||
yaml = {
|
||||
schemas = {
|
||||
["https://raw.githubusercontent.com/compose-spec/compose-spec/master/schema/compose-spec.json"] =
|
||||
"compose.yaml",
|
||||
["https://raw.githubusercontent.com/SchemaStore/schemastore/refs/heads/master/src/schemas/json/github-workflow.json"] = "**/.github/workflows/*"
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
9
homemanager/neovim/lua/plugins/spec/snippets.lua
Normal file
9
homemanager/neovim/lua/plugins/spec/snippets.lua
Normal file
@@ -0,0 +1,9 @@
|
||||
return {
|
||||
"L3MON4D3/LuaSnip",
|
||||
version = "v2.*",
|
||||
run = "make install_jsregexp",
|
||||
config = function()
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
end,
|
||||
dependencies = { 'rafamadriz/friendly-snippets' }
|
||||
}
|
||||
0
homemanager/neovim/lua/plugins/spec/something.md
Normal file
0
homemanager/neovim/lua/plugins/spec/something.md
Normal file
6
homemanager/neovim/lua/plugins/spec/supermaven.lua
Normal file
6
homemanager/neovim/lua/plugins/spec/supermaven.lua
Normal file
@@ -0,0 +1,6 @@
|
||||
return {
|
||||
enabled = true,
|
||||
"supermaven-inc/supermaven-nvim",
|
||||
-- lazy = false,
|
||||
opts = {}
|
||||
}
|
||||
5297
homemanager/neovim/lua/plugins/spec/telescope-picker/emojis.txt
Normal file
5297
homemanager/neovim/lua/plugins/spec/telescope-picker/emojis.txt
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,24 @@
|
||||
local M = {}
|
||||
|
||||
M.find_directories = function()
|
||||
local pickers = require("telescope.pickers")
|
||||
local finders = require("telescope.finders")
|
||||
local conf = require("telescope.config").values
|
||||
|
||||
pickers.new({}, {
|
||||
prompt_title = "Finde Directories",
|
||||
__locations_input = true,
|
||||
finder = finders.new_oneshot_job({ "find", "-type", "d" }, {
|
||||
entry_maker = function(entry)
|
||||
return {
|
||||
value = entry,
|
||||
display = ' ' .. entry,
|
||||
ordinal = entry,
|
||||
}
|
||||
end
|
||||
}),
|
||||
sorter = conf.file_sorter()
|
||||
}):find()
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,101 @@
|
||||
local pickers = require("telescope.pickers")
|
||||
local finders = require("telescope.finders")
|
||||
local conf = require("telescope.config").values
|
||||
local actions = require("telescope.actions")
|
||||
local action_state = require("telescope.actions.state")
|
||||
|
||||
local M = {}
|
||||
|
||||
local function trim(s)
|
||||
return (string.gsub(s, "^%s*(.-)%s*$", "%1"))
|
||||
end
|
||||
|
||||
local function parse_emoji_line(line)
|
||||
if not line or vim.startswith(line, "#") then
|
||||
return nil
|
||||
end
|
||||
|
||||
local id_element_split = vim.split(line, ";")
|
||||
local element = id_element_split[2]
|
||||
|
||||
if not element then
|
||||
return nil
|
||||
end
|
||||
|
||||
local state_emoji_split = vim.split(element, "#")
|
||||
local qualified = state_emoji_split[1]
|
||||
local emoji = state_emoji_split[2]
|
||||
|
||||
if not qualified or trim(qualified) ~= "fully-qualified" then
|
||||
return nil
|
||||
end
|
||||
|
||||
if not emoji then
|
||||
return nil
|
||||
end
|
||||
|
||||
local icon_description_split = vim.split(emoji, " ")
|
||||
local icon = icon_description_split[2]
|
||||
local description = icon_description_split[4]
|
||||
|
||||
if not description then
|
||||
return nil
|
||||
end
|
||||
|
||||
return {
|
||||
display = trim(icon) .. " " .. trim(description),
|
||||
value = trim(icon)
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
function M.find_emojis()
|
||||
local path = vim.fn.stdpath("config") .. "/lua/plugins/spec/telescope-picker/emojis.txt"
|
||||
print(path)
|
||||
local file = io.open(path, "r")
|
||||
|
||||
if not file then
|
||||
print("Emoji File not found")
|
||||
return nil
|
||||
end
|
||||
|
||||
local t = {}
|
||||
for line in file:lines() do
|
||||
local parsed_line = parse_emoji_line(line)
|
||||
if parsed_line then
|
||||
table.insert(t, parsed_line)
|
||||
end
|
||||
end
|
||||
|
||||
file:close()
|
||||
|
||||
local finder = finders.new_table({
|
||||
results = t,
|
||||
entry_maker = function(entry)
|
||||
return {
|
||||
value = entry.value,
|
||||
display = entry.display,
|
||||
ordinal = entry.display,
|
||||
}
|
||||
end
|
||||
})
|
||||
|
||||
pickers.new(conf, {
|
||||
prompt_title = "Find Emojis",
|
||||
finder = finder,
|
||||
sorter = conf.generic_sorter(t),
|
||||
attach_mappings = function(prompt_bufnr, _)
|
||||
actions.select_default:replace(function()
|
||||
actions.close(prompt_bufnr)
|
||||
local selection = action_state.get_selected_entry()
|
||||
local buf = vim.api.nvim_get_current_buf()
|
||||
local cursor = vim.api.nvim_win_get_cursor(0)
|
||||
vim.api.nvim_buf_set_text(buf, cursor[1] - 1, cursor[2], cursor[1] - 1, cursor[2], { selection.value })
|
||||
vim.api.nvim_win_set_cursor(0, { cursor[1], cursor[2] + 1 })
|
||||
end)
|
||||
return true
|
||||
end,
|
||||
}):find()
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,50 @@
|
||||
local M = {}
|
||||
|
||||
M.multi_grep = function(opts)
|
||||
local pickers = require("telescope.pickers")
|
||||
local finders = require("telescope.finders")
|
||||
local conf = require("telescope.config").values
|
||||
local make_entry = require "telescope.make_entry"
|
||||
opts = opts or {}
|
||||
opts.cwd = opts.cwd or vim.fn.getcwd()
|
||||
|
||||
local finder = finders.new_async_job {
|
||||
command_generator = function(prompt)
|
||||
if not prompt or prompt == "" then
|
||||
return nil
|
||||
end
|
||||
|
||||
local segments = vim.split(prompt, " ")
|
||||
local args = { "rg" }
|
||||
|
||||
if segments[1] then
|
||||
table.insert(args, "-e")
|
||||
table.insert(args, segments[1])
|
||||
end
|
||||
|
||||
if segments[2] then
|
||||
table.insert(args, "-g")
|
||||
table.insert(args, segments[2])
|
||||
end
|
||||
|
||||
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({}, {
|
||||
debounce = 100,
|
||||
prompt_title = "Multi Grep",
|
||||
finder = finder,
|
||||
previewer = conf.grep_previewer(opts),
|
||||
sorter = require("telescope.sorters").empty(),
|
||||
}):find()
|
||||
end
|
||||
|
||||
M.multi_grep()
|
||||
|
||||
return M
|
||||
86
homemanager/neovim/lua/plugins/spec/telescope.lua
Normal file
86
homemanager/neovim/lua/plugins/spec/telescope.lua
Normal file
@@ -0,0 +1,86 @@
|
||||
local dropdown_configs = {
|
||||
layout_strategy = 'horizontal',
|
||||
layout_config = {
|
||||
prompt_position = 'bottom',
|
||||
horizontal = {
|
||||
width = 0.8,
|
||||
height = 100,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
local function find_files()
|
||||
require("telescope.builtin").find_files()
|
||||
end
|
||||
|
||||
local function find_references()
|
||||
require('telescope.builtin').lsp_references()
|
||||
end
|
||||
local function find_buffers()
|
||||
require('telescope.builtin').buffers()
|
||||
end
|
||||
|
||||
local function find_helptags()
|
||||
require('telescope.builtin').help_tags()
|
||||
end
|
||||
|
||||
local function find_text()
|
||||
require('telescope.builtin').live_grep()
|
||||
end
|
||||
|
||||
local function find_directories()
|
||||
require('plugins.spec.telescope-picker.find_directories').find_directories()
|
||||
end
|
||||
|
||||
local function find_grep()
|
||||
require('plugins.spec.telescope-picker.multi_grep').multi_grep()
|
||||
end
|
||||
|
||||
local function find_emojis()
|
||||
require('plugins.spec.telescope-picker.find_emojis').find_emojis()
|
||||
end
|
||||
|
||||
return {
|
||||
'nvim-telescope/telescope.nvim',
|
||||
config = function()
|
||||
require('telescope').setup({
|
||||
extensions = {
|
||||
['ui-select'] = {
|
||||
require('telescope.themes').get_dropdown(dropdown_configs),
|
||||
},
|
||||
},
|
||||
pickers = {
|
||||
find_files = {
|
||||
hidden = true,
|
||||
find_command = { 'rg', '--files', '--hidden', '--glob', '!**/.git/*' },
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
require('telescope').load_extension('ui-select')
|
||||
|
||||
vim.api.nvim_create_user_command("FindPluginFiles", function()
|
||||
require('telescope.builtin').find_files({
|
||||
cwd = vim.fs.joinpath(vim.fn.stdpath('data'), 'lazy'),
|
||||
})
|
||||
end, {})
|
||||
|
||||
vim.api.nvim_create_user_command("FindEmojis", function()
|
||||
find_emojis()
|
||||
end, {})
|
||||
end,
|
||||
keys = {
|
||||
{ '<leader>ff', find_files, desc = "(f)ind (f)iles" },
|
||||
{ '<leader>gr', find_references, desc = "(g)o to (r)eferences" },
|
||||
{ '<leader>fg', find_grep, desc = "(f)ind (g)rep" },
|
||||
{ '<leader>fb', find_buffers, desc = "(f)ind (b)uffers" },
|
||||
{ '<leader>fht', find_helptags, desc = "(f)ind (b)elp tags" },
|
||||
{ '<leader>fd', find_directories, desc = "(f)ind (d)irectories" },
|
||||
},
|
||||
cmd = { "Telescope", "FindPluginFiles", "FindEmojis" },
|
||||
dependencies = {
|
||||
'nvim-telescope/telescope-ui-select.nvim',
|
||||
'nvim-lua/plenary.nvim',
|
||||
'kyazdani42/nvim-web-devicons',
|
||||
}
|
||||
}
|
||||
43
homemanager/neovim/lua/plugins/spec/theme.lua
Normal file
43
homemanager/neovim/lua/plugins/spec/theme.lua
Normal file
@@ -0,0 +1,43 @@
|
||||
return {
|
||||
{
|
||||
'catppuccin/nvim',
|
||||
as = 'catppuccin',
|
||||
config = function()
|
||||
require("catppuccin").setup {
|
||||
flavour = "mocha",
|
||||
transparent_background = true
|
||||
}
|
||||
-- vim.cmd [[ colorscheme catppuccin ]]
|
||||
end
|
||||
},
|
||||
{
|
||||
'EdenEast/nightfox.nvim',
|
||||
config = function()
|
||||
require('nightfox').setup {
|
||||
options = { transparent = true }
|
||||
}
|
||||
|
||||
-- vim.cmd [[ colorscheme nightfox ]]
|
||||
end,
|
||||
},
|
||||
{
|
||||
'navarasu/onedark.nvim',
|
||||
config = function()
|
||||
require('onedark').setup {
|
||||
transparent = true,
|
||||
lualine = {
|
||||
transparent = true
|
||||
}
|
||||
}
|
||||
|
||||
-- vim.cmd [[ colorscheme onedark ]]
|
||||
end
|
||||
},
|
||||
{
|
||||
'shaunsingh/nord.nvim',
|
||||
config = function()
|
||||
vim.g.nord_disable_background = true
|
||||
vim.cmd [[colorscheme nord]]
|
||||
end
|
||||
}
|
||||
}
|
||||
78
homemanager/neovim/lua/plugins/spec/treesitter.lua
Normal file
78
homemanager/neovim/lua/plugins/spec/treesitter.lua
Normal file
@@ -0,0 +1,78 @@
|
||||
return {
|
||||
{
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
build = ':TSUpdate',
|
||||
event = { "BufReadPost", "BufNewFile" },
|
||||
config = function()
|
||||
require("nvim-treesitter.configs").setup {
|
||||
ensure_installed = {
|
||||
"lua",
|
||||
"typescript",
|
||||
"javascript",
|
||||
"css",
|
||||
"html",
|
||||
"json",
|
||||
"markdown",
|
||||
"markdown_inline",
|
||||
"yaml",
|
||||
"rust",
|
||||
"python",
|
||||
"gdscript",
|
||||
"vue",
|
||||
"toml",
|
||||
},
|
||||
highlight = {
|
||||
enable = true
|
||||
},
|
||||
indent = {
|
||||
enable = true
|
||||
}
|
||||
}
|
||||
end,
|
||||
dependencies = {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||
config = function()
|
||||
require("nvim-treesitter.configs").setup {
|
||||
textobjects = {
|
||||
select = {
|
||||
enable = true,
|
||||
lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
|
||||
keymaps = {
|
||||
-- You can use the capture groups defined in textobjects.scm
|
||||
["afn"] = "@function.outer",
|
||||
["ifn"] = "@function.inner",
|
||||
["acl"] = "@class.outer",
|
||||
["icl"] = "@class.inner",
|
||||
["icm"] = "@comment.inner",
|
||||
["acm"] = "@comment.outer",
|
||||
["ib"] = "@block.inner",
|
||||
["ab"] = "@block.outer",
|
||||
["la"] = "@assignment.lhs",
|
||||
["ra"] = "@assignment.lhs"
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
},
|
||||
}
|
||||
},
|
||||
{
|
||||
'nvim-treesitter/nvim-treesitter-context',
|
||||
event = { "BufReadPost", "BufNewFile" },
|
||||
opts = {
|
||||
enable = true, -- Enable this plugin (Can be enabled/disabled later via commands)
|
||||
max_lines = 0, -- How many lines the window should span. Values <= 0 mean no limit.
|
||||
min_window_height = 0, -- Minimum editor window height to enable context. Values <= 0 mean no limit.
|
||||
line_numbers = true,
|
||||
multiline_threshold = 20, -- Maximum number of lines to collapse for a single context line
|
||||
trim_scope = 'outer', -- Which context lines to discard if `max_lines` is exceeded. Choices: 'inner', 'outer'
|
||||
mode = 'cursor', -- Line used to calculate context. Choices: 'cursor', 'topline'
|
||||
-- Separator between context and content. Should be a single character string, like '-'.
|
||||
-- When separator is set, the context will only show up when there are at least 2 lines above cursorline.
|
||||
separator = nil,
|
||||
zindex = 20, -- The Z-index of the context window
|
||||
}
|
||||
},
|
||||
}
|
||||
25
homemanager/neovim/lua/plugins/spec/trouble.lua
Normal file
25
homemanager/neovim/lua/plugins/spec/trouble.lua
Normal file
@@ -0,0 +1,25 @@
|
||||
return {
|
||||
"folke/trouble.nvim",
|
||||
dependencies = "nvim-tree/nvim-web-devicons",
|
||||
config = function()
|
||||
require("trouble").setup {}
|
||||
end,
|
||||
init = function()
|
||||
vim.api.nvim_create_autocmd("BufRead", {
|
||||
callback = function(ev)
|
||||
if vim.bo[ev.buf].buftype == "quickfix" then
|
||||
vim.schedule(function()
|
||||
vim.cmd([[cclose]])
|
||||
vim.cmd([[Trouble qflist open]])
|
||||
end)
|
||||
end
|
||||
end,
|
||||
})
|
||||
end,
|
||||
cmd = { "Trouble" },
|
||||
keys = {
|
||||
{ "<leader>dl", vim.diagnostic.setqflist, "(d)iagnostic (l)ist" },
|
||||
{ "<leader>qn", vim.cmd.cnext, "(q)uickfix (n)ext" },
|
||||
{ "<leader>qp", vim.cmd.cprev, "(q)uickfix (p)revious" },
|
||||
}
|
||||
}
|
||||
21
homemanager/neovim/lua/plugins/spec/vimtex.lua
Normal file
21
homemanager/neovim/lua/plugins/spec/vimtex.lua
Normal file
@@ -0,0 +1,21 @@
|
||||
function preview()
|
||||
if vim.bo.filetype ~= "tex" then
|
||||
return
|
||||
end
|
||||
|
||||
print("Previewing " .. vim.fn.expand("%:p"))
|
||||
|
||||
vim.cmd("VimtexCompile")
|
||||
end
|
||||
|
||||
return {
|
||||
'lervag/vimtex',
|
||||
-- event = "InsertEnter",
|
||||
config = function()
|
||||
vim.g.vimtex_view_method = "zathura"
|
||||
vim.keymap.set("n", "<leader>p", preview)
|
||||
end,
|
||||
lazy = false,
|
||||
enabled = true,
|
||||
dependencies = {}
|
||||
}
|
||||
Reference in New Issue
Block a user