mirror of
https://github.com/pnx/dotfiles
synced 2026-06-17 19:40:02 +02:00
touching the nvim.
This commit is contained in:
parent
15e6408670
commit
71717129e1
40 changed files with 1045 additions and 921 deletions
|
|
@ -1,13 +1,11 @@
|
|||
|
||||
-- Nice command that creates all directores in the path
|
||||
-- then creates the file and opens it.
|
||||
vim.api.nvim_create_user_command('CreateFile',
|
||||
function(opts)
|
||||
local dir = vim.fs.dirname(opts.fargs[1])
|
||||
vim.cmd(string.format("!mkdir -p %s\n !touch %s", dir, opts.fargs[1]))
|
||||
vim.cmd.e(opts.fargs)
|
||||
end,
|
||||
{ nargs = 1, complete = "file" }
|
||||
)
|
||||
local createfile = function(opts)
|
||||
local dir = vim.fs.dirname(opts.fargs[1])
|
||||
vim.cmd(string.format("!mkdir -p %s\n !touch %s", dir, opts.fargs[1]))
|
||||
vim.cmd.e(opts.fargs)
|
||||
end
|
||||
|
||||
|
||||
vim.api.nvim_create_user_command('CreateFile', createfile, { nargs = 1, complete = "file" })
|
||||
vim.cmd("ca cf CreateFile")
|
||||
|
|
|
|||
|
|
@ -4,32 +4,45 @@
|
|||
local autocmd = vim.api.nvim_create_autocmd
|
||||
local augroup = vim.api.nvim_create_augroup
|
||||
|
||||
augroup('indent', { clear = true })
|
||||
|
||||
-- Hardtabs for make
|
||||
autocmd('Filetype', {
|
||||
group = 'indent',
|
||||
pattern = { 'make' },
|
||||
command = 'setlocal ts=4 sts=0 sw=4 noexpandtab'
|
||||
})
|
||||
|
||||
-- Softtab (2) for yaml
|
||||
autocmd('Filetype', {
|
||||
group = 'indent',
|
||||
pattern = { 'yaml' },
|
||||
command = 'setlocal ts=2 sts=2 sw=2 expandtab'
|
||||
})
|
||||
|
||||
-- Hardtabs for c/cpp
|
||||
autocmd('Filetype', {
|
||||
group = 'indent',
|
||||
pattern = { 'c', 'cpp' },
|
||||
command = 'setlocal ts=8 sts=0 sw=8 noexpandtab'
|
||||
-- Add blade filetype for .blade.php files
|
||||
vim.filetype.add({
|
||||
pattern = {
|
||||
['.*%.blade%.php'] = 'blade',
|
||||
},
|
||||
})
|
||||
|
||||
-- Fix autocomment plugins to use line comments for php.
|
||||
autocmd('Filetype', {
|
||||
pattern = 'php',
|
||||
command = 'setlocal commentstring=//\\%s'
|
||||
pattern = 'php',
|
||||
command = 'setlocal commentstring=//\\%s'
|
||||
})
|
||||
|
||||
|
||||
--
|
||||
-- Indent
|
||||
--
|
||||
|
||||
|
||||
augroup('indent', { clear = true })
|
||||
|
||||
-- Hardtabs for make
|
||||
autocmd('Filetype', {
|
||||
group = 'indent',
|
||||
pattern = { 'make' },
|
||||
command = 'setlocal ts=4 sts=0 sw=4 noexpandtab'
|
||||
})
|
||||
|
||||
-- Softtab (2) for yaml
|
||||
autocmd('Filetype', {
|
||||
group = 'indent',
|
||||
pattern = { 'yaml' },
|
||||
command = 'setlocal ts=2 sts=2 sw=2 expandtab'
|
||||
})
|
||||
|
||||
-- Hardtabs for c/cpp
|
||||
autocmd('Filetype', {
|
||||
group = 'indent',
|
||||
pattern = { 'c', 'cpp' },
|
||||
command = 'setlocal ts=8 sts=0 sw=8 noexpandtab'
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,89 +1,90 @@
|
|||
return {
|
||||
prompt = '',
|
||||
current = ' ',
|
||||
selected = '',
|
||||
close = '',
|
||||
pinned = '',
|
||||
tree = {
|
||||
node = '│',
|
||||
nodelast = '└',
|
||||
},
|
||||
files = {
|
||||
text = "",
|
||||
symlink = "",
|
||||
},
|
||||
folder = {
|
||||
closed = "",
|
||||
open = "",
|
||||
empty = "",
|
||||
empty_open = "",
|
||||
symlink = "",
|
||||
symlink_open = "",
|
||||
},
|
||||
diff = {
|
||||
added = '',
|
||||
modified = '',
|
||||
removed = '',
|
||||
},
|
||||
diff_gutter = {
|
||||
add = '▏',
|
||||
change = '▏',
|
||||
delete = '',
|
||||
untracked = '+'
|
||||
},
|
||||
gitsigns = {
|
||||
-- Change type
|
||||
added = "",
|
||||
modified = "",
|
||||
deleted = "",
|
||||
renamed = "➜",
|
||||
-- Status type
|
||||
untracked = "★",
|
||||
ignored = "◌",
|
||||
unstaged = "",
|
||||
staged = "✓",
|
||||
conflict = "",
|
||||
},
|
||||
diagnostics = {
|
||||
error = '',
|
||||
warn = '',
|
||||
info = '',
|
||||
hint = ''
|
||||
},
|
||||
test = {
|
||||
ok = '',
|
||||
failed = '',
|
||||
running = '',
|
||||
skipped = '',
|
||||
watch = '',
|
||||
unknown = '',
|
||||
},
|
||||
symbols = {
|
||||
Text = "",
|
||||
Method = "",
|
||||
Function = "",
|
||||
Constructor = "",
|
||||
Field = "",
|
||||
Variable = "",
|
||||
Class = "",
|
||||
Interface = "",
|
||||
Module = "",
|
||||
Property = "",
|
||||
Unit = "",
|
||||
Value = "",
|
||||
Enum = "",
|
||||
Keyword = "",
|
||||
Snippet = "",
|
||||
Color = "",
|
||||
File = "",
|
||||
Reference = "",
|
||||
Folder = "",
|
||||
EnumMember = "",
|
||||
Constant = "",
|
||||
Struct = "",
|
||||
Event = "",
|
||||
Operator = "",
|
||||
prompt = '',
|
||||
current = ' ',
|
||||
selected = '',
|
||||
close = '',
|
||||
modified = '',
|
||||
pinned = '',
|
||||
separator = '│',
|
||||
tree = {
|
||||
node = '│',
|
||||
nodelast = '└',
|
||||
},
|
||||
files = {
|
||||
text = "",
|
||||
symlink = "",
|
||||
},
|
||||
folder = {
|
||||
closed = "",
|
||||
open = "",
|
||||
empty = "",
|
||||
empty_open = "",
|
||||
symlink = "",
|
||||
symlink_open = "",
|
||||
},
|
||||
diff = {
|
||||
added = '',
|
||||
modified = '',
|
||||
removed = '',
|
||||
},
|
||||
diff_gutter = {
|
||||
add = '▍',
|
||||
change = '▍',
|
||||
delete = '',
|
||||
untracked = '+'
|
||||
},
|
||||
gitsigns = {
|
||||
-- Change type
|
||||
added = "",
|
||||
modified = "",
|
||||
deleted = "",
|
||||
renamed = "➜",
|
||||
-- Status type
|
||||
untracked = "★",
|
||||
ignored = "◌",
|
||||
unstaged = "",
|
||||
staged = "✓",
|
||||
conflict = "",
|
||||
},
|
||||
diagnostics = {
|
||||
error = '',
|
||||
warn = '',
|
||||
info = '',
|
||||
hint = ''
|
||||
},
|
||||
test = {
|
||||
ok = '',
|
||||
failed = '',
|
||||
running = '',
|
||||
skipped = '',
|
||||
watch = '',
|
||||
unknown = '',
|
||||
},
|
||||
symbols = {
|
||||
Text = "",
|
||||
Method = "",
|
||||
Function = "",
|
||||
Constructor = "",
|
||||
Field = "",
|
||||
Variable = "",
|
||||
Class = "",
|
||||
Interface = "",
|
||||
Module = "",
|
||||
Property = "",
|
||||
Unit = "",
|
||||
Value = "",
|
||||
Enum = "",
|
||||
Keyword = "",
|
||||
Snippet = "",
|
||||
Color = "",
|
||||
File = "",
|
||||
Reference = "",
|
||||
Folder = "",
|
||||
EnumMember = "",
|
||||
Constant = "",
|
||||
Struct = "",
|
||||
Event = "",
|
||||
Operator = "",
|
||||
TypeParameter = "",
|
||||
},
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
-- config
|
||||
require("config.commands")
|
||||
require("config.settings")
|
||||
require("config.mappings")
|
||||
require("config.filetype")
|
||||
require("config.commands")
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ map("n", "n", "nzzzv", { silent = true, desc = "jump to next search match" })
|
|||
map("n", "N", "Nzzzv", { silent = true, desc = "jump to previous search match" })
|
||||
|
||||
-- Ctrl+s saves the current buffer in normal/insert mode.
|
||||
map({"n", "i"}, "<C-s>", cmd.w, { desc = "save current buffer" })
|
||||
map({ "n", "i" }, "<C-s>", cmd.w, { desc = "save current buffer" })
|
||||
|
||||
-- Move text
|
||||
map("n", "<S-a>", ":m -2<CR>v=", { silent = true, desc = "move current line one line up" })
|
||||
|
|
@ -25,17 +25,21 @@ map("v", "<S-a>", ":m '<-2<CR>gv=gv", { silent = true, desc = "move current sele
|
|||
map("v", "<S-d>", ":m '>+1<CR>gv=gv", { silent = true, desc = "move current selection one line down" })
|
||||
|
||||
-- copy/paste
|
||||
map("x", "<leader>p", [["_dP]], { silent = true, desc = "Paste over selected text without losing content in \"-register" })
|
||||
map({"n", "v"}, "<leader>y", [["+y]], { desc = "Yank to system clipboard register" })
|
||||
map("n", "<leader>p", [["+p]], { desc = "Paste from system clipboard register" })
|
||||
map("x", "<leader>p", [["_dP]],
|
||||
{ silent = true, desc = "Paste over selected text without losing content in \"-register" })
|
||||
map({ "n", "v" }, "<leader>y", [["+y]], { desc = "Yank to system clipboard register" })
|
||||
map({ "n", "v" }, "<leader>p", [["+p]], { desc = "Paste from system clipboard register" })
|
||||
|
||||
-- File operations
|
||||
map("n", "<leader>fx", "<cmd>!chmod +x %<CR>", { silent = true, desc = "Set execute flag on current file" })
|
||||
map("n", "<leader>Fc", ":CreateFile ", { silent = true, desc = "Create new file" })
|
||||
map("n", "<leader>Fx", "<cmd>!chmod +x %<CR>", { silent = true, desc = "Set execute flag on current file" })
|
||||
|
||||
-- buffers
|
||||
map("n", "<leader>bn", cmd.bn, { silent = true, desc = "Move to next buffer"})
|
||||
map("n", "<leader>bb", cmd.bp, { silent = true, desc = "Move to previous buffer"})
|
||||
map("n", "<leader>bd", cmd.bd, { silent = true, desc = "Close current buffer"})
|
||||
map("n", "<leader>bn", cmd.bn, { silent = true, desc = "Move to next buffer" })
|
||||
map("n", "<leader>bb", cmd.bp, { silent = true, desc = "Move to previous buffer" })
|
||||
map("n", "<leader>bd", cmd.bd, { silent = true, desc = "Close current buffer" })
|
||||
map("n", "<leader>bc", "<cmd>BufferLineCloseOthers<cr>", { silent = true, desc = "Close all other buffers" })
|
||||
map("n", "<leader>bD", "<cmd>%bd<cr>", { silent = true, desc = "Close all buffers" })
|
||||
|
||||
-- Indent
|
||||
map('n', "<Tab>", "^=$")
|
||||
|
|
@ -43,21 +47,25 @@ map('x', "<Tab>", "=", { desc = "auto indent selection" })
|
|||
map("i", "<S-Tab>", "<C-d>", { desc = "delete indent" })
|
||||
|
||||
-- fix paste
|
||||
map('n', "p", "p=$")
|
||||
-- map('n', "p", "p=$")
|
||||
|
||||
-- Crazy search+replace
|
||||
map("n", "<leader>rw", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]], {
|
||||
desc = "search+replace word under cursor"
|
||||
desc = "search+replace word under cursor"
|
||||
})
|
||||
|
||||
map({"x"}, "<leader>hx", [[:s/\(\x\{2\}\)/0x\1,/g<cr>]], { desc = "Format hex"})
|
||||
map({"x"}, "<leader>ha", [[:s/0x\(\x\{1\}\X\)/0x0\1/g<cr>]], { desc = "Format hex more"})
|
||||
map({"x"}, "<leader>hn", [[:s/\(\(0x\x\{1,2\}, \)\{8\}\)/\1\r/g<cr>]], { desc = "Format hex with 8 bytes per row"})
|
||||
map({ "x" }, "<leader>fhx", [[:s/\(\x\{2\}\)/0x\1, /g]], { desc = "Format hex" })
|
||||
map({ "x" }, "<leader>fha", [[:s/0x\(\x\{1\}\X\)/0x0\1/g]], { desc = "Format each hex number to be 2 characters long" })
|
||||
map({ "x" }, "<leader>fhn", [[:s/\(\(0x\x\{1,2\}, \)\{8\}\)/\1\r/g]], { desc = "Format hex with 8 bytes per row" })
|
||||
-- map({"x"}, "<leader>hb", [[:'<,'>s/\(\x\{2\}\)/0x\1, /g<cr>]], { desc = "Format a hex string to byte array"})
|
||||
|
||||
-- diagnostics
|
||||
map("n", "<leader>do", vim.diagnostic.open_float, { desc = "Open diagnostics" })
|
||||
map("n", "<leader>dn", vim.diagnostic.get_next, { desc = "Goto next" })
|
||||
map("n", "<leader>dp", vim.diagnostic.get_prev, { desc = "Goto previous" })
|
||||
|
||||
-- TMux
|
||||
map("n", "<leader>m", ":terminal tmuxs<cr>i", { desc = "Open tmux manager" })
|
||||
|
||||
|
||||
map("n", "Q", "<nop>")
|
||||
|
||||
-- diagnostics
|
||||
map("n", "<leader>do", vim.diagnostic.open_float, { desc = "Open diagnostics"})
|
||||
map("n", "<leader>dn", vim.diagnostic.get_next, { desc = "Goto next"})
|
||||
map("n", "<leader>dp", vim.diagnostic.get_prev, { desc = "Goto previous"})
|
||||
|
|
|
|||
|
|
@ -1,36 +1,46 @@
|
|||
local icons = require('config.icons')
|
||||
|
||||
return function ()
|
||||
local highlightfunc = require("catppuccin.groups.integrations.bufferline")
|
||||
return {
|
||||
highlights = highlightfunc.get(),
|
||||
options = {
|
||||
mode = "buffers",
|
||||
themable = true,
|
||||
buffer_close_icon = icons.close,
|
||||
close_icon = icons.close,
|
||||
modified_icon = icons.modified_icon,
|
||||
diagnostics = false,
|
||||
enforce_regular_tabs = true,
|
||||
indicator = {
|
||||
style = 'underline',
|
||||
},
|
||||
close_command = function (bufnum)
|
||||
vim.cmd("bprev")
|
||||
vim.api.nvim_buf_delete(bufnum, {})
|
||||
end,
|
||||
hover = {
|
||||
return function()
|
||||
local highlightfunc = require("catppuccin.groups.integrations.bufferline")
|
||||
return {
|
||||
highlights = highlightfunc.get(),
|
||||
options = {
|
||||
mode = "buffers",
|
||||
themable = true,
|
||||
buffer_close_icon = icons.close,
|
||||
close_icon = icons.close,
|
||||
modified_icon = icons.modified,
|
||||
diagnostics = false,
|
||||
enforce_regular_tabs = true,
|
||||
indicator = {
|
||||
icon = "",
|
||||
},
|
||||
close_command = function(bufnum)
|
||||
vim.cmd("bprev")
|
||||
vim.api.nvim_buf_delete(bufnum, {})
|
||||
end,
|
||||
hover = {
|
||||
enabled = true,
|
||||
delay = 200,
|
||||
reveal = {'close'}
|
||||
reveal = { 'close' }
|
||||
},
|
||||
offsets = {
|
||||
{
|
||||
filetype = "neo-tree",
|
||||
text = "File Explorer",
|
||||
text_align = "left"
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
offsets = {
|
||||
{
|
||||
filetype = "neo-tree",
|
||||
text = "File Explorer",
|
||||
text_align = "left"
|
||||
}
|
||||
},
|
||||
custom_areas = {
|
||||
left = function()
|
||||
return {
|
||||
{
|
||||
text = " ",
|
||||
fg = "#8fff6d",
|
||||
}
|
||||
}
|
||||
end
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ return {
|
|||
flavour = "mocha",
|
||||
color_overrides = {
|
||||
mocha = {
|
||||
base = '#0e1019',
|
||||
base = '#0E1019',
|
||||
mantle = '#0D0F17',
|
||||
crust = '#0C0D14',
|
||||
surface0 = '#131521',
|
||||
|
|
@ -19,13 +19,17 @@ return {
|
|||
highlight_overrides = {
|
||||
mocha = function(colors)
|
||||
return {
|
||||
-- Normal = { fg = colors.text },
|
||||
-- NormalNC = { fg = colors.text },
|
||||
|
||||
-- Floating windows
|
||||
NormalFloat = { fg = colors.text, bg = colors.base },
|
||||
NormalFloat = { fg = colors.text, bg = colors.mantle },
|
||||
FloatTitle = { fg = colors.base, bg = colors.blue },
|
||||
FloatBorder = { fg = colors.blue, bg = colors.base },
|
||||
FloatBorder = { fg = colors.blue, bg = colors.mantle },
|
||||
|
||||
-- Window separator
|
||||
WinSeparator = { fg = colors.surface0 },
|
||||
NeoTreeWinSeparator = { link = "WinSeparator" },
|
||||
|
||||
-- Menus
|
||||
Pmenu = { fg = colors.text, bg = colors.mantle },
|
||||
|
|
@ -49,6 +53,16 @@ return {
|
|||
TelescopePromptBorder = { fg = colors.mantle, bg = colors.mantle },
|
||||
TelescopePromptTitle = { fg = colors.crust, bg = colors.blue },
|
||||
TelescopePreviewTitle = { fg = colors.crust, bg = colors.mauve },
|
||||
TelescopeSelection = { fg = colors.text, bg = colors.surface0 },
|
||||
|
||||
-- Statusline
|
||||
StatusLine = { fg = colors.text, bg = colors.mantle },
|
||||
StatusLineNormal = { fg = colors.text, bg = colors.mantle },
|
||||
StatusLineSeparator = { fg = colors.surface0, bg = colors.mantle },
|
||||
StatusLineInsert = { fg = colors.base, bg = colors.blue },
|
||||
StatusLineVisual = { fg = colors.base, bg = colors.mauve },
|
||||
StatusLineCommand = { fg = colors.base, bg = colors.yellow },
|
||||
StatusLineReplace = { fg = colors.base, bg = colors.maroon },
|
||||
|
||||
-- Syntax
|
||||
PreProc = { link = "Include" },
|
||||
|
|
|
|||
|
|
@ -1,81 +1,59 @@
|
|||
local icons = require('config.icons')
|
||||
return function()
|
||||
local cmp = require('cmp')
|
||||
local lspkind = require('utils.lspkind')
|
||||
local icons = require('config.icons')
|
||||
|
||||
return function ()
|
||||
local lspkind_config = {
|
||||
mode = 'symbol',
|
||||
preset = 'codicons',
|
||||
symbol_map = icons.symbols,
|
||||
maxwidth = 40,
|
||||
ellipsis_char = "...",
|
||||
}
|
||||
local cmp = require('cmp')
|
||||
local selectPrev = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert })
|
||||
local selectNext = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert })
|
||||
|
||||
local selectPrev = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert })
|
||||
local selectNext = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert })
|
||||
local borderstyle = {
|
||||
border = "none",
|
||||
winhighlight = 'Normal:Pmenu,FloatBorder:FloatBorder,CursorLine:PmenuSel,Search:None',
|
||||
}
|
||||
|
||||
local borderstyle = {
|
||||
border = "none",
|
||||
winhighlight = 'Normal:Pmenu,FloatBorder:FloatBorder,CursorLine:PmenuSel,Search:None',
|
||||
}
|
||||
|
||||
return {
|
||||
completion = {
|
||||
completeopt = "menu,menuone,noinsert",
|
||||
},
|
||||
-- enabled = function()
|
||||
-- if require"cmp.config.context".in_treesitter_capture("comment")==true or require"cmp.config.context".in_syntax_group("Comment") then
|
||||
-- return false
|
||||
-- else
|
||||
-- return true
|
||||
-- end
|
||||
-- end,
|
||||
-- preselect = false,
|
||||
view = {
|
||||
entries = { name = 'custom', selection_order = 'near_cursor' },
|
||||
},
|
||||
window = {
|
||||
documentation = borderstyle,
|
||||
completion = borderstyle
|
||||
},
|
||||
mapping = {
|
||||
["<Up>"] = selectPrev,
|
||||
["<S-Tab>"] = selectPrev,
|
||||
["<Down>"] = selectNext,
|
||||
["<Tab>"] = selectNext,
|
||||
["<esc>"] = cmp.mapping.abort(),
|
||||
['<CR>'] = cmp.mapping.confirm({ select = true }),
|
||||
},
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require('luasnip').lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
formatting = {
|
||||
fields = { "abbr", "kind", "menu" },
|
||||
format = function(entry, vim_item)
|
||||
if vim.tbl_contains({ 'path' }, entry.source.name) then
|
||||
local icon, hl_group = require('nvim-web-devicons').get_icon(entry:get_completion_item().label)
|
||||
if icon then
|
||||
vim_item.kind = icon
|
||||
vim_item.kind_hl_group = hl_group
|
||||
return vim_item
|
||||
end
|
||||
end
|
||||
|
||||
return require('lspkind').cmp_format(lspkind_config)(entry, vim_item)
|
||||
end
|
||||
},
|
||||
sources = {
|
||||
{ name = "copilot" },
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'buffer' },
|
||||
{ name = 'path' },
|
||||
{ name = 'luasnip' }
|
||||
},
|
||||
experimental = {
|
||||
ghost_text = {
|
||||
hl_group = "NonText",
|
||||
},
|
||||
},
|
||||
}
|
||||
return {
|
||||
preselect = false,
|
||||
view = {
|
||||
entries = { name = 'custom', selection_order = 'near_cursor' },
|
||||
},
|
||||
window = {
|
||||
documentation = borderstyle,
|
||||
completion = borderstyle
|
||||
},
|
||||
mapping = {
|
||||
["<Up>"] = selectPrev,
|
||||
["<S-Tab>"] = selectPrev,
|
||||
["<Down>"] = selectNext,
|
||||
["<Tab>"] = selectNext,
|
||||
["<S-c>"] = cmp.mapping.abort(),
|
||||
['<CR>'] = cmp.mapping.confirm({ select = true }),
|
||||
},
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require('luasnip').lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
formatting = {
|
||||
fields = { "abbr", "kind", "menu" },
|
||||
format = lspkind.format({
|
||||
mode = 'symbol',
|
||||
preset = 'codicons',
|
||||
symbol_map = icons.symbols,
|
||||
maxwidth = 40,
|
||||
ellipsis_char = "...",
|
||||
}),
|
||||
},
|
||||
sources = {
|
||||
{ name = "copilot" },
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'buffer' },
|
||||
{ name = 'path' },
|
||||
{ name = 'luasnip' }
|
||||
},
|
||||
experimental = {
|
||||
ghost_text = {
|
||||
hl_group = "NonText",
|
||||
},
|
||||
},
|
||||
}
|
||||
end
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ return {
|
|||
-- Toggle comment on visual selection
|
||||
comment_visual = '<leader>/',
|
||||
|
||||
-- Define 'comment' textobject (like `dgc` - delete whole comment block)
|
||||
-- Define 'comment' textobject (like `dg/` - delete whole comment block)
|
||||
-- Works also in Visual mode if mapping differs from `comment_visual`
|
||||
textobject = 'gc',
|
||||
textobject = 'g/',
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
return {
|
||||
keys = {
|
||||
["<leader>la"] = { ":Laravel artisan<cr>", "Run artisan" },
|
||||
["<leader>lr"] = { ":Laravel routes<cr>", "Search routes" },
|
||||
["<leader>lm"] = { ":Laravel related<cr>", "Related" },
|
||||
["<leader>la"] = { "<cmd>Laravel artisan<cr>", "Run artisan" },
|
||||
["<leader>lm"] = { "<cmd>Laravel make<cr>", "Make" },
|
||||
["<leader>lr"] = { "<cmd>Laravel routes<cr>", "Search routes" },
|
||||
["<leader>lR"] = { "<cmd>Laravel related<cr>", "Related" },
|
||||
["<leader>lv"] = { "<cmd>Laravel view-finder<cr>", "View finder" },
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,65 +1,74 @@
|
|||
return {
|
||||
mappings = {
|
||||
["<leader>rs"] = { vim.lsp.buf.rename, { desc = "Rename symbol" }},
|
||||
["<leader>ca"] = { vim.lsp.buf.code_action, { desc = "Code action" }},
|
||||
["<leader>ff"] = { vim.lsp.buf.format, { desc = "Format file" }},
|
||||
gd = { vim.lsp.buf.definition, { desc = "Goto definition" }},
|
||||
gi = { vim.lsp.buf.implementation, { desc = "Goto implementation"}},
|
||||
gr = { vim.lsp.buf.references, { desc = "Goto references"}},
|
||||
},
|
||||
servers = {
|
||||
-- PHP
|
||||
phpactor = {
|
||||
settings = {
|
||||
init_options = {
|
||||
["language_server_phpstan.enabled"] = true,
|
||||
["language_server_psalm.enabled"] = false,
|
||||
}
|
||||
}
|
||||
},
|
||||
-- GO
|
||||
gopls = {
|
||||
-- format_on_save = true,
|
||||
on_save = function ()
|
||||
local params = vim.lsp.util.make_range_params()
|
||||
params.context = {only = {"source.organizeImports"}}
|
||||
local result = vim.lsp.buf_request_sync(0, "textDocument/codeAction", params, 1000)
|
||||
for cid, res in pairs(result or {}) do
|
||||
for _, r in pairs(res.result or {}) do
|
||||
if r.edit then
|
||||
local enc = (vim.lsp.get_client_by_id(cid) or {}).offset_encoding or "utf-16"
|
||||
vim.lsp.util.apply_workspace_edit(r.edit, enc)
|
||||
end
|
||||
end
|
||||
end
|
||||
vim.lsp.buf.format({async = false})
|
||||
end,
|
||||
settings = {
|
||||
gopls = {
|
||||
analyses = {
|
||||
unusedvariable = true,
|
||||
unusedwrite = true,
|
||||
useany = true
|
||||
},
|
||||
gofumpt = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
-- Lua
|
||||
lua_ls = {
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = {
|
||||
version = 'LuaJIT'
|
||||
},
|
||||
workspace = {
|
||||
checkThirdParty = false,
|
||||
library = {
|
||||
vim.env.VIMRUNTIME
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
mappings = {
|
||||
["<leader>rs"] = { vim.lsp.buf.rename, { desc = "Rename symbol" } },
|
||||
["<leader>ca"] = { vim.lsp.buf.code_action, { desc = "Code action" } },
|
||||
["<leader>ff"] = { vim.lsp.buf.format, { desc = "Format file" } },
|
||||
K = { vim.lsp.buf.hover, { desc = "Hover" } },
|
||||
gd = { vim.lsp.buf.definition, { desc = "Goto definition" } },
|
||||
gi = { vim.lsp.buf.implementation, { desc = "Goto implementation" } },
|
||||
gr = { vim.lsp.buf.references, { desc = "Goto references" } },
|
||||
},
|
||||
servers = {
|
||||
-- PHP
|
||||
-- phpactor = {
|
||||
-- settings = {
|
||||
-- init_options = {
|
||||
-- ["language_server_phpstan.enabled"] = true,
|
||||
-- ["language_server_psalm.enabled"] = false,
|
||||
-- }
|
||||
-- }
|
||||
-- },
|
||||
--
|
||||
--
|
||||
-- JS,TS,VUE
|
||||
volar = {
|
||||
filetypes = { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue', 'json' }
|
||||
},
|
||||
-- TailwindCSS
|
||||
tailwindcss = {},
|
||||
-- GO
|
||||
gopls = {
|
||||
-- format_on_save = true,
|
||||
on_save = function()
|
||||
local params = vim.lsp.util.make_range_params()
|
||||
params.context = { only = { "source.organizeImports" } }
|
||||
local result = vim.lsp.buf_request_sync(0, "textDocument/codeAction", params, 1000)
|
||||
for cid, res in pairs(result or {}) do
|
||||
for _, r in pairs(res.result or {}) do
|
||||
if r.edit then
|
||||
local enc = (vim.lsp.get_client_by_id(cid) or {}).offset_encoding or "utf-16"
|
||||
vim.lsp.util.apply_workspace_edit(r.edit, enc)
|
||||
end
|
||||
end
|
||||
end
|
||||
vim.lsp.buf.format({ async = false })
|
||||
end,
|
||||
settings = {
|
||||
gopls = {
|
||||
analyses = {
|
||||
unusedvariable = true,
|
||||
unusedwrite = true,
|
||||
useany = true
|
||||
},
|
||||
gofumpt = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
-- Lua
|
||||
lua_ls = {
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = {
|
||||
version = 'LuaJIT'
|
||||
},
|
||||
workspace = {
|
||||
checkThirdParty = false,
|
||||
library = {
|
||||
vim.env.VIMRUNTIME
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
|||
93
nvim/lua/config/plugins/lualine.lua
Normal file
93
nvim/lua/config/plugins/lualine.lua
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
local icons = require('config.icons')
|
||||
local separator = { "'" .. icons.separator .. "'", color = 'StatusLineSeparator' }
|
||||
|
||||
return {
|
||||
options = {
|
||||
globalstatus = true,
|
||||
component_separators = '',
|
||||
section_separators = '',
|
||||
disabled_filetypes = {
|
||||
statusline = {
|
||||
'dashboard',
|
||||
}
|
||||
},
|
||||
theme = {
|
||||
normal = {
|
||||
a = "StatusLineNormal",
|
||||
b = "StatusLine",
|
||||
c = "StatusLine",
|
||||
x = "StatusLine",
|
||||
y = "StatusLine",
|
||||
z = "StatusLine",
|
||||
},
|
||||
command = {
|
||||
a = "StatusLineCommand",
|
||||
z = "StatusLine",
|
||||
},
|
||||
insert = {
|
||||
a = "StatusLineInsert",
|
||||
z = "StatusLine",
|
||||
},
|
||||
visual = {
|
||||
a = "StatusLineVisual",
|
||||
z = "StatusLine",
|
||||
},
|
||||
replace = {
|
||||
a = "StatusLineReplace",
|
||||
z = "StatusLine",
|
||||
}
|
||||
}
|
||||
},
|
||||
sections = {
|
||||
lualine_a = {
|
||||
"mode",
|
||||
},
|
||||
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" },
|
||||
},
|
||||
{
|
||||
"diagnostics",
|
||||
symbols = {
|
||||
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 .. ' '
|
||||
}
|
||||
},
|
||||
separator,
|
||||
},
|
||||
lualine_c = {
|
||||
'filename'
|
||||
},
|
||||
lualine_x = {
|
||||
'filetype',
|
||||
'fileformat',
|
||||
'(vim.bo.expandtab and "SPC" or "TAB") .. " " .. vim.bo.shiftwidth',
|
||||
},
|
||||
lualine_y = {
|
||||
separator,
|
||||
'location',
|
||||
'progress'
|
||||
},
|
||||
lualine_z = {}
|
||||
},
|
||||
extensions = {
|
||||
'lazy',
|
||||
'neo-tree'
|
||||
}
|
||||
}
|
||||
|
|
@ -10,10 +10,15 @@ return {
|
|||
{ '<leader>sg', '<cmd>Telescope git_files<cr>', desc = 'Search Git files' },
|
||||
{ '<leader>so', '<cmd>Telescope oldfiles<cr>', desc = 'Search Old files' },
|
||||
{ '<leader>sw', '<cmd>Telescope grep_string<cr>', desc = 'Search for word under cursor' },
|
||||
{ '<leader>sd', '<cmd>Telescope diagnostics<cr>', desc = 'Search Diagnostics' },
|
||||
{ '<leader>sq', '<cmd>Telescope quickfix<cr>', desc = 'Search Quickfix' },
|
||||
{ '<leader>sh', '<cmd>Telescope help<cr>', desc = 'Search Neovim help' },
|
||||
-- LSP
|
||||
{ '<leader>sr', '<cmd>Telescope lsp_references<cr>', desc = 'Search Reference' },
|
||||
{ '<leader>ss', '<cmd>Telescope lsp_document_symbols<cr>', desc = 'Search document symbols' },
|
||||
{ '<leader>sr', '<cmd>Telescope lsp_references<cr>', desc = 'Search Reference' },
|
||||
{ '<leader>si', '<cmd>Telescope lsp_implementations<cr>', desc = 'Search Inplementations' },
|
||||
{ '<leader>sp', '<cmd>Telescope lsp_workspace_symbols<cr>', desc = 'Search Workspace symbols' },
|
||||
{ 'gd', '<cmd>Telescope lsp_definitions<cr>', desc = 'Goto definition' },
|
||||
},
|
||||
opts = function()
|
||||
|
|
|
|||
10
nvim/lua/config/plugins/trouble.lua
Normal file
10
nvim/lua/config/plugins/trouble.lua
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
return {
|
||||
keys = {
|
||||
{ "<leader>xx", function() require("trouble").toggle() end },
|
||||
{ "<leader>xw", function() require("trouble").toggle("workspace_diagnostics") end },
|
||||
{ "<leader>xd", function() require("trouble").toggle("document_diagnostics") end },
|
||||
{ "<leader>xq", function() require("trouble").toggle("quickfix") end },
|
||||
{ "<leader>xl", function() require("trouble").toggle("loclist") end },
|
||||
{ "gR", function() require("trouble").toggle("lsp_references") end },
|
||||
},
|
||||
}
|
||||
|
|
@ -3,7 +3,8 @@ return {
|
|||
mode = { "n", "v" },
|
||||
["<leader>r"] = { name = "+rename" },
|
||||
["<leader>b"] = { name = "+buffers" },
|
||||
["<leader>f"] = { name = "+files" },
|
||||
["<leader>f"] = { name = "+format" },
|
||||
["<leader>F"] = { name = "+files" },
|
||||
["<leader>d"] = { name = "+diagnostics" }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,24 +1,34 @@
|
|||
local set = vim.opt
|
||||
|
||||
|
||||
--
|
||||
-- General Settings
|
||||
--
|
||||
|
||||
set.termguicolors = true
|
||||
set.updatetime = 50
|
||||
set.showmode = false -- disable mode in the command line, because i use lualine
|
||||
set.mousemoveevent = true
|
||||
|
||||
|
||||
--
|
||||
-- Editor settings
|
||||
--
|
||||
|
||||
|
||||
set.pumheight = 20
|
||||
set.hlsearch = false
|
||||
set.incsearch = true
|
||||
set.laststatus = 3
|
||||
set.splitkeep = "screen"
|
||||
set.scrolloff=20
|
||||
--vim.opt.sidescrolloff = 8
|
||||
set.scrolloff = 20
|
||||
|
||||
-- mouse and cursor
|
||||
set.cursorline = true
|
||||
set.mousemoveevent = true
|
||||
|
||||
-- search
|
||||
set.hlsearch = false
|
||||
set.incsearch = true
|
||||
set.ignorecase = true
|
||||
set.smartcase = true
|
||||
|
||||
-- line numbers
|
||||
set.number = true
|
||||
|
|
@ -26,28 +36,40 @@ set.relativenumber = true
|
|||
set.numberwidth = 5
|
||||
|
||||
-- sign column to the right.
|
||||
--set.statuscolumn = '%=%{v:relnum?v:relnum:v:lnum} %s '
|
||||
--set.statuscolumn = '%=%{v:relnum?v:relnum:v:lnum} %s '
|
||||
|
||||
-- sign column to the left
|
||||
set.statuscolumn = '%s %=%{v:relnum?v:relnum:v:lnum} '
|
||||
|
||||
-- indent
|
||||
set.expandtab = true
|
||||
set.tabstop = 4
|
||||
set.softtabstop = 4
|
||||
set.shiftwidth = 4
|
||||
set.autoindent = true
|
||||
set.smartindent = true
|
||||
|
||||
-- Filetypes
|
||||
vim.filetype.add({
|
||||
pattern = {
|
||||
['.*%.blade%.php'] = 'blade',
|
||||
},
|
||||
})
|
||||
-- Folding
|
||||
--set.foldenable = true
|
||||
--set.foldmethod = "expr"
|
||||
--set.foldexpr = "nvim_treesitter#foldexpr()"
|
||||
|
||||
--vim.api.nvim_create_autocmd('BufReadPost,FileReadPost', {
|
||||
-- pattern = '*',
|
||||
-- cmd = 'normal zR',
|
||||
--})
|
||||
--
|
||||
|
||||
-- Completion
|
||||
set.completeopt = "menuone,longest,preview"
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Diagnostics
|
||||
--
|
||||
|
||||
|
||||
local icons = require('config.icons').diagnostics
|
||||
vim.fn.sign_define('DiagnosticSignError', { text = icons.error, texthl = 'DiagnosticSignError' })
|
||||
vim.fn.sign_define('DiagnosticSignWarn', { text = icons.warn, texthl = 'DiagnosticSignWarn' })
|
||||
|
|
@ -55,20 +77,20 @@ vim.fn.sign_define('DiagnosticSignInfo', { text = icons.info, texthl = 'Diagnost
|
|||
vim.fn.sign_define('DiagnosticSignHint', { text = icons.hint, texthl = 'DiagnosticSignHint' })
|
||||
|
||||
vim.diagnostic.config({
|
||||
virtual_text = true,
|
||||
severity_sort = true,
|
||||
float = {
|
||||
border = 'single',
|
||||
source = 'always',
|
||||
},
|
||||
virtual_text = false,
|
||||
severity_sort = true,
|
||||
underline = false,
|
||||
float = {
|
||||
-- border = 'single',
|
||||
},
|
||||
})
|
||||
|
||||
-- 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 = 200 }
|
||||
end,
|
||||
group = vim.api.nvim_create_augroup('highlight_yank', {}),
|
||||
desc = 'Hightlight selection on yank',
|
||||
pattern = '*',
|
||||
callback = function()
|
||||
vim.highlight.on_yank { higroup = 'IncSearch', timeout = 200 }
|
||||
end,
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue