1
0
Fork 0
mirror of https://github.com/pnx/dotfiles synced 2026-06-16 19:30:01 +02:00
This commit is contained in:
Henrik Hautakoski 2024-06-23 16:12:05 +02:00
parent 35c3cc49d5
commit 08bf9aad64
14 changed files with 264 additions and 110 deletions

View file

@ -33,7 +33,7 @@ return function()
["<Down>"] = selectNext,
["<Tab>"] = selectNext,
["<C-c>"] = cmp.mapping.abort(),
["<CR>"] = utils.confirm({ select = true }),
["<CR>"] = utils.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }),
},
snippet = {
expand = function(args)
@ -52,7 +52,7 @@ return function()
},
sources = {
{ name = "nvim_lsp" },
-- { name = "luasnip" },
{ name = "luasnip" },
{ name = "buffer" },
{ name = "path" },
{
@ -66,10 +66,10 @@ return function()
},
},
},
experimental = {
ghost_text = {
hl_group = "NonText",
},
},
-- experimental = {
-- ghost_text = {
-- hl_group = "NonText",
-- },
-- },
}
end

View file

@ -9,4 +9,14 @@ return {
topdelete = { text = icons.delete },
changedelete = { text = icons.change },
},
signs_staged = {
add = { text = icons.add },
delete = { text = icons.delete },
change = { text = icons.change },
topdelete = { text = icons.delete },
changedelete = { text = icons.change },
},
diff_opts = {
internal = true
}
}

View file

@ -14,6 +14,8 @@ return {
servers = {
-- Bash
bashls = {},
-- C/C++
ccls = {},
-- PHP
-- intelephense = {},
phpactor = {

View file

@ -1,15 +1,15 @@
local icons = require('config.icons')
local separator = { "'" .. icons.separator .. "'", color = 'StatusLineSeparator' }
local icons = require("config.icons")
local separator = { "'" .. icons.separator .. "'", color = "StatusLineSeparator" }
return {
options = {
globalstatus = true,
component_separators = '',
section_separators = '',
component_separators = "",
section_separators = "",
disabled_filetypes = {
statusline = {
'dashboard',
}
"dashboard",
},
},
theme = {
normal = {
@ -32,11 +32,11 @@ return {
a = "StatusLineVisual",
z = "StatusLine",
},
replace = {
replace = {
a = "StatusLineReplace",
z = "StatusLine",
}
}
},
},
},
sections = {
lualine_a = {
@ -45,49 +45,70 @@ return {
lualine_b = {
separator,
"branch",
separator,
'" " .. tostring(#vim.tbl_keys(vim.lsp.buf_get_clients()))',
{
require("lazy.status").updates,
cond = require("lazy.status").has_updates,
color = { fg = "#ff9e64" },
},
separator,
'" " .. tostring(#vim.tbl_keys(vim.lsp.buf_get_clients()))',
{
require("lazy.status").updates,
cond = require("lazy.status").has_updates,
color = { fg = "#ff9e64" },
},
{
"diagnostics",
symbols = {
error = icons.diagnostics.error .. ' ',
warn = icons.diagnostics.warn .. ' ',
info = icons.diagnostics.info .. ' ',
hint = icons.diagnostics.hint .. ' ',
error = icons.diagnostics.error .. " ",
warn = icons.diagnostics.warn .. " ",
info = icons.diagnostics.info .. " ",
hint = icons.diagnostics.hint .. " ",
},
},
{
"diff",
symbols = {
added = icons.diff.added .. ' ',
modified = icons.diff.modified .. ' ',
removed = icons.diff.removed .. ' '
}
added = icons.diff.added .. " ",
modified = icons.diff.modified .. " ",
removed = icons.diff.removed .. " ",
},
},
separator,
separator,
},
lualine_c = {
'filename'
{
"filename",
path = 1,
symbols = {
modified = "+",
readonly = "[R]",
unnamed = "-",
newfile = "[New]",
},
},
},
lualine_x = {
'filetype',
'fileformat',
"filetype",
"fileformat",
'(vim.bo.expandtab and "SPC" or "TAB") .. " " .. vim.bo.shiftwidth',
},
lualine_y = {
separator,
'location',
'progress'
"location",
"progress",
},
lualine_z = {},
},
winbar = {
lualine_c = {
{ "filetype", icon_only = true },
"filename",
},
},
inactive_winbar = {
lualine_c = {
{ "filetype", icon_only = true },
"filename",
},
lualine_z = {}
},
extensions = {
'lazy',
'neo-tree'
}
"lazy",
"neo-tree",
},
}

View file

@ -1,14 +1,17 @@
local icons = require("config.icons")
return function()
local icons = require("config.icons")
local actions = require("telescope.actions")
local dropdown_opts = {
previewer = false,
prompt_title = false,
layout_strategy = "horizontal",
layout_config = {
prompt_position = "top",
},
}
return {
defaults = {
border = {
prompt = { 1, 1, 1, 1 },
results = { 1, 1, 1, 1 },
preview = { 1, 1, 1, 1 },
},
path_display = { truncate = 1 },
prompt_prefix = " ",
selection_caret = icons.current .. " ",
@ -27,19 +30,18 @@ return function()
find_files = {
hidden = true,
},
buffers = {
theme = "dropdown",
previewer = false,
buffers = vim.tbl_deep_extend("force", dropdown_opts, {
theme = "dropdown",
mappings = {
i = {
["<c-d>"] = actions.delete_buffer + actions.move_to_top,
},
},
},
}),
},
extensions = {
["ui-select"] = {
require("telescope.themes").get_dropdown(),
require("telescope.themes").get_dropdown(dropdown_opts),
},
},
}

View file

@ -16,6 +16,7 @@ return {
"phpdoc",
"blade",
"go",
"gotmpl",
"gomod",
"gosum",
"javascript",

View file

@ -161,7 +161,7 @@ return {
local end_line = vim.api.nvim_buf_get_lines(0, args.line2 - 1, args.line2, true)[1]
range = {
start = { args.line1, 0 },
---@diagnostic disable-next-line: undefined-field
---@diagnostic disable-next-line: undefined-field
["end"] = { args.line2, end_line:len() },
}
end
@ -177,20 +177,28 @@ return {
opts = require("config.oil"),
dependencies = { "nvim-tree/nvim-web-devicons" },
config = function(_, opts)
require('oil').setup(opts)
require("oil").setup(opts)
-- Don't touch my CWD!
require('utils.oil').RegisterCWDHackHook()
-- Don't touch my CWD!
require("utils.oil").RegisterCWDHackHook()
end,
},
{
"folke/trouble.nvim",
dependencies = { "nvim-tree/nvim-web-devicons" },
keys = keys.trouble or {},
opts = {},
opts = {},
},
{
"L3MON4D3/LuaSnip",
dependencies = {
{
"rafamadriz/friendly-snippets",
config = function()
require("luasnip.loaders.from_vscode").lazy_load()
end,
},
},
opts = {},
config = function(_, opts)
require("luasnip.loaders.from_lua").load({ paths = "~/.config/nvim/snippets" })

View file

@ -20,8 +20,8 @@ return {
"hrsh7th/cmp-buffer", -- autocomplete from buffer
"hrsh7th/cmp-path", -- autocomplete from filesystem
"hrsh7th/cmp-nvim-lsp", -- autocomplete from lsp
-- "saadparwaiz1/cmp_luasnip", -- autocomplete from snippet engine
-- "L3MON4D3/LuaSnip", -- snippet engine
"saadparwaiz1/cmp_luasnip", -- autocomplete from snippet engine
"L3MON4D3/LuaSnip", -- snippet engine
"onsails/lspkind-nvim", -- icons for kind
},
opts = require("config.cmp"),
@ -39,6 +39,7 @@ return {
local lsp_zero = require("lsp-zero")
local lsp_config = require("lspconfig")
local augroup = vim.api.nvim_create_augroup("Lsp", {})
local utils = require("utils.lsp")
local map = require("utils.keys")
lsp_zero.on_attach(function(_, bufnr)
@ -60,8 +61,12 @@ return {
})
end
if (opts.document_hightlight or server_opt.document_highlight or false) and client.supports_method('textDocument/documentHighlight')then
require("utils.lsp").document_highlight(bufnr)
if client.supports_method('textDocument/hover') then
--utils.signature_help_on_hover(bufnr)
end
if (opts.document_hightlight or server_opt.document_highlight or false) and client.supports_method('textDocument/documentHighlight') then
utils.document_highlight(bufnr)
end
end

View file

@ -17,4 +17,14 @@ function M.CloseAll()
end
end
function M.GetLoaded()
local loaded = {}
for i, hnd in ipairs(vim.api.nvim_list_bufs()) do
if vim.api.nvim_buf_is_loaded(hnd) then
loaded[i] = hnd
end
end
return loaded
end
return M

View file

@ -1,45 +1,44 @@
local luasnip = require('luasnip')
local cmp = require('cmp')
local luasnip = require("luasnip")
local cmp = require("cmp")
local M = {}
function M.selectNext(opts)
return cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item(opts or {})
elseif luasnip.locally_jumpable(1) then
luasnip.jump(1)
else
fallback()
end
end, {"i", "s"})
return cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item(opts or {})
elseif luasnip.locally_jumpable(1) then
luasnip.jump(1)
else
fallback()
end
end, { "i", "s" })
end
function M.selectPrev(opts)
return cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item(opts or {})
elseif luasnip.locally_jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, {"i", "s"})
return cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item(opts or {})
elseif luasnip.locally_jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" })
end
function M.confirm(opts)
return cmp.mapping(function(fallback)
if cmp.visible() then
if luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
else
cmp.confirm(opts or {})
end
else
fallback()
end
end)
return cmp.mapping(function(fallback)
if cmp.visible() then
-- if luasnip.expand_or_jumpable() then
-- luasnip.expand_or_jump()
-- else
cmp.confirm(opts or {})
-- end
else
fallback()
end
end)
end
return M

View file

@ -19,4 +19,14 @@ function M.document_highlight(bufnr)
})
end
function M.signature_help_on_hover(bufnr)
local group = vim.api.nvim_create_augroup('lsp_hover', { clear = false })
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
group = group,
buffer = bufnr,
callback = vim.lsp.buf.hover,
})
end
return M