mirror of
https://github.com/pnx/dotfiles
synced 2026-06-17 03:30:01 +02:00
new nvim config
This commit is contained in:
parent
f087422bbf
commit
7d14948480
66 changed files with 1771 additions and 1719 deletions
93
nvim/lua/user/plugins/editor/autocomplete.lua
Normal file
93
nvim/lua/user/plugins/editor/autocomplete.lua
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
return {
|
||||
"hrsh7th/nvim-cmp",
|
||||
version = false,
|
||||
event = "InsertEnter",
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-buffer", -- autocomplete from buffer
|
||||
"hrsh7th/cmp-path", -- autocomplete from filesystem
|
||||
"f3fora/cmp-spell",
|
||||
},
|
||||
opts = function()
|
||||
local cmp = require("cmp")
|
||||
local utils = require("user.utils.cmp")
|
||||
local format = require("user.utils.cmp_format")
|
||||
-- local lspkind = require("user.utils.lspkind")
|
||||
local icons = require("user.icons")
|
||||
|
||||
local selectPrev = utils.selectPrev({ behavior = cmp.SelectBehavior.Insert })
|
||||
local selectNext = utils.selectNext({ behavior = cmp.SelectBehavior.Insert })
|
||||
|
||||
return {
|
||||
preselect = false,
|
||||
completion = {
|
||||
completeopt = "menu,menuone,longest,popup",
|
||||
},
|
||||
view = {
|
||||
entries = { name = "custom", selection_order = "near_cursor" },
|
||||
},
|
||||
window = {
|
||||
documentation = {
|
||||
border = { "", "", "", "", "", "", "", " " },
|
||||
},
|
||||
completion = {
|
||||
scrolloff = 4,
|
||||
},
|
||||
},
|
||||
mapping = {
|
||||
["<Up>"] = selectPrev,
|
||||
["<S-Tab>"] = selectPrev,
|
||||
["<Down>"] = selectNext,
|
||||
["<Tab>"] = selectNext,
|
||||
["<C-c>"] = cmp.mapping.abort(),
|
||||
["<CR>"] = utils.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }),
|
||||
},
|
||||
-- snippet = {
|
||||
-- expand = function(args)
|
||||
-- require("luasnip").lsp_expand(args.body)
|
||||
-- end,
|
||||
-- },
|
||||
formatting = {
|
||||
fields = { "abbr", "kind", "menu" },
|
||||
format = format({
|
||||
symbol_map = icons.symbols,
|
||||
widths = {
|
||||
menu = 0,
|
||||
}
|
||||
}),
|
||||
},
|
||||
sources = {
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = 'nvim_lsp_signature_help' },
|
||||
{ name = "luasnip" },
|
||||
{ name = "buffer" },
|
||||
{ name = "path" },
|
||||
{
|
||||
name = "spell",
|
||||
keyword_length = 3,
|
||||
option = {
|
||||
keep_all_entries = false,
|
||||
enable_in_context = function()
|
||||
return true
|
||||
end,
|
||||
preselect_correct_word = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
-- experimental = {
|
||||
-- ghost_text = {
|
||||
-- hl_group = "NonText",
|
||||
-- },
|
||||
-- },
|
||||
}
|
||||
end,
|
||||
config = function(_, opts)
|
||||
local cmp = require("cmp")
|
||||
cmp.setup(opts)
|
||||
|
||||
-- insert () on function completion using autopairs
|
||||
local has_autopair, autopair = pcall(require, "nvim-autopairs.completion.cmp")
|
||||
if has_autopair then
|
||||
cmp.event:on("confirm_done", autopair.on_confirm_done())
|
||||
end
|
||||
end,
|
||||
}
|
||||
90
nvim/lua/user/plugins/editor/fuzzyfinder.lua
Normal file
90
nvim/lua/user/plugins/editor/fuzzyfinder.lua
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
local icons = require("user.icons")
|
||||
local path_delim = require("user.utils.path").delimiter()
|
||||
|
||||
local border = {
|
||||
prompt = { " " },
|
||||
results = { " " },
|
||||
preview = { " " },
|
||||
}
|
||||
|
||||
local dropdown_opts = {
|
||||
previewer = false,
|
||||
prompt_title = false,
|
||||
layout_strategy = "horizontal",
|
||||
layout_config = {
|
||||
prompt_position = "top",
|
||||
},
|
||||
borderchars = border,
|
||||
}
|
||||
|
||||
return {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
"nvim-telescope/telescope-ui-select.nvim",
|
||||
"sharkdp/fd",
|
||||
},
|
||||
opts = function()
|
||||
local utils = require("user.utils.telescope")
|
||||
local actions = require("telescope.actions")
|
||||
return {
|
||||
defaults = {
|
||||
path_display = { truncate = 1 },
|
||||
prompt_prefix = " ",
|
||||
selection_caret = icons.current .. " ",
|
||||
multi_icon = icons.selected .. " ",
|
||||
file_ignore_patterns = {
|
||||
".git" .. path_delim,
|
||||
"node_modules" .. path_delim,
|
||||
},
|
||||
mappings = {
|
||||
i = {
|
||||
["<esc>"] = actions.close,
|
||||
},
|
||||
},
|
||||
borderchars = border,
|
||||
},
|
||||
pickers = {
|
||||
find_files = {
|
||||
hidden = true,
|
||||
},
|
||||
buffers = vim.tbl_deep_extend("force", dropdown_opts, {
|
||||
theme = "dropdown",
|
||||
mappings = {
|
||||
i = {
|
||||
["<c-d>"] = actions.delete_buffer + actions.move_to_top,
|
||||
},
|
||||
},
|
||||
sort_mru = true, -- sort by most recent used.
|
||||
entry_maker = utils.buffer_view({
|
||||
indicators = {
|
||||
modified = {
|
||||
icon = icons.file_status.modified,
|
||||
},
|
||||
readonly = {
|
||||
icon = icons.file_status.readonly,
|
||||
},
|
||||
hidden = {
|
||||
icon = icons.file_status.hidden,
|
||||
}
|
||||
}
|
||||
})
|
||||
}),
|
||||
},
|
||||
extensions = {
|
||||
["ui-select"] = {
|
||||
require("telescope.themes").get_dropdown(dropdown_opts),
|
||||
},
|
||||
}
|
||||
}
|
||||
end,
|
||||
config = function(_, opts)
|
||||
local telescope = require("telescope")
|
||||
|
||||
telescope.setup(opts)
|
||||
for name, _ in pairs(opts.extensions or {}) do
|
||||
telescope.load_extension(name)
|
||||
end
|
||||
end,
|
||||
}
|
||||
37
nvim/lua/user/plugins/editor/gitsigns.lua
Normal file
37
nvim/lua/user/plugins/editor/gitsigns.lua
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
local icons = require('user.icons').diff_gutter
|
||||
|
||||
return {
|
||||
"lewis6991/gitsigns.nvim",
|
||||
dependencies = {
|
||||
{
|
||||
"folke/which-key.nvim",
|
||||
optional = true,
|
||||
opts = {
|
||||
defaults = {
|
||||
["<leader>g"] = { name = "+git" },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
lazy = false,
|
||||
opts = {
|
||||
signs = {
|
||||
add = { text = icons.add },
|
||||
delete = { text = icons.delete },
|
||||
change = { text = icons.change },
|
||||
untracked = { text = icons.untracked },
|
||||
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
|
||||
}
|
||||
},
|
||||
}
|
||||
89
nvim/lua/user/plugins/editor/treesitter.lua
Normal file
89
nvim/lua/user/plugins/editor/treesitter.lua
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
return {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
build = function()
|
||||
require("nvim-treesitter.install").update({ with_sync = true })
|
||||
end,
|
||||
dependencies = {
|
||||
-- "nvim-treesitter/nvim-treesitter-textobjects",
|
||||
{
|
||||
"windwp/nvim-ts-autotag",
|
||||
opts = {
|
||||
-- Filetypes to enable autotag for
|
||||
filetypes = {
|
||||
'html',
|
||||
'javascript',
|
||||
'typescript',
|
||||
'javascriptreact',
|
||||
'typescriptreact',
|
||||
'svelte',
|
||||
'vue',
|
||||
'tsx',
|
||||
'jsx',
|
||||
'rescript',
|
||||
'xml',
|
||||
'php',
|
||||
'blade',
|
||||
'markdown',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
opts = {
|
||||
-- A list of parser names
|
||||
ensure_installed = {
|
||||
"bash",
|
||||
"c",
|
||||
"cpp",
|
||||
"ninja",
|
||||
"cmake",
|
||||
"dockerfile",
|
||||
"make",
|
||||
"vim",
|
||||
"vimdoc",
|
||||
"query",
|
||||
"javascript",
|
||||
-- "typescript",
|
||||
"css",
|
||||
"scss",
|
||||
-- "html",
|
||||
-- "vue",
|
||||
"json",
|
||||
"jsonc",
|
||||
"yaml",
|
||||
"toml",
|
||||
"xml",
|
||||
"glsl",
|
||||
"hlsl",
|
||||
"markdown",
|
||||
"markdown_inline",
|
||||
"kdl",
|
||||
},
|
||||
|
||||
auto_install = true,
|
||||
|
||||
highlight = {
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
|
||||
indent = {
|
||||
enable = true,
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
|
||||
|
||||
parser_config.blade = {
|
||||
install_info = {
|
||||
url = "https://github.com/EmranMR/tree-sitter-blade",
|
||||
branch = "main",
|
||||
files = { "src/parser.c" },
|
||||
generate_requires_npm = true,
|
||||
requires_generate_from_grammar = true,
|
||||
},
|
||||
filetype = "blade",
|
||||
}
|
||||
|
||||
require("nvim-treesitter.configs").setup(opts)
|
||||
end,
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue