1
0
Fork 0
mirror of https://github.com/pnx/dotfiles synced 2026-06-16 03:14:55 +02:00

some nvim touching

This commit is contained in:
Henrik Hautakoski 2024-04-03 21:02:20 +02:00
parent 6dd8f632ad
commit f910f44191
29 changed files with 467 additions and 233 deletions

View file

@ -2,12 +2,23 @@ return {
prompt = '',
current = ' ',
selected = '',
close = '',
close = '󰅖',
pinned = '',
tree = {
node = '',
nodelast = '',
},
files = {
text = "",
symlink = "",
},
folder = {
closed = "",
open = "",
empty = "󰜌",
empty = "",
empty_open = "",
symlink = "",
symlink_open = "",
},
diff = {
added = '',
@ -15,8 +26,8 @@ return {
removed = '',
},
diff_gutter = {
add = '',
change = '',
add = '',
change = '',
delete = '',
untracked = '+'
},
@ -24,14 +35,14 @@ return {
-- Change type
added = "",
modified = "",
deleted = "",
renamed = "󰁕",
deleted = "",
renamed = "",
-- Status type
untracked = "",
ignored = "",
untracked = "",
ignored = "",
unstaged = "",
staged = "",
conflict = "",
staged = "",
conflict = "",
},
diagnostics = {
error = '',

View file

@ -50,6 +50,11 @@ map("n", "<leader>rw", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]], {
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("n", "Q", "<nop>")
-- diagnostics

View file

@ -0,0 +1,36 @@
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 = {
enabled = true,
delay = 200,
reveal = {'close'}
},
offsets = {
{
filetype = "neo-tree",
text = "File Explorer",
text_align = "left"
}
},
}
}
end

View file

@ -3,7 +3,14 @@ return {
color_overrides = {
mocha = {
base = '#0e1019',
mantle = '#131521',
mantle = '#0D0F17',
crust = '#0C0D14',
surface0 = '#131521',
surface1 = '#343959',
surface2 = '#41476F',
overlay0 = '#3F4256',
overlay1 = '#5B5F7C',
overlay2 = '#767BA0',
text = '#eceef4',
}
},
@ -12,21 +19,29 @@ return {
highlight_overrides = {
mocha = function(colors)
return {
CursorLine = { bg = colors.mantle },
NormalFloat = { bg = colors.crust },
FloatBorder = { fg = colors.crust, bg = colors.crust },
WinSeparator = { fg = colors.surface0 },
NoiceMini = { bg = colors.crust },
-- indent lines
IblScope = { fg = colors.overlay2 },
IblScope = { fg = colors.overlay1 },
BufferCurrent = { fg = colors.text, bg = colors.base },
BufferCurrentMod = { fg = colors.yellow, bg = colors.base },
BufferCurrentADDED = { fg = colors.green, bg = colors.base },
BufferCurrentCHANGED = { fg = colors.yellow, bg = colors.base },
BufferCurrentDELETED = { fg = colors.red, bg = colors.base },
-- LSP
LspReferenceText = { bg = colors.surface0 },
LspReferenceRead = { link = "LspReferenceText" },
LspReferenceWrite = { link = "LspReferenceText" },
-- LspReferenceText = { bg = colors.surface0 },
-- LspReferenceRead = { link = "LspReferenceText" },
-- LspReferenceWrite = { link = "LspReferenceText" },
--
-- -- telescope
TelescopeNormal = { bg = colors.crust },
TelescopeBorder = { fg = colors.crust, bg = colors.crust },
TelescopePromptNormal = { bg = colors.mantle },
TelescopePromptPrefix = { fg = colors.mauve },
TelescopePromptBorder = { fg = colors.mantle, bg = colors.mantle },
TelescopePromptTitle = { fg = colors.crust, bg = colors.blue },
TelescopePreviewTitle = { fg = colors.crust, bg = colors.mauve },
-- Syntax
PreProc = { link = "Include" },

View file

@ -0,0 +1,20 @@
return {
options = {
custom_commentstring = function() return vim.bo.commentstring end
},
mappings = {
-- Toggle comment (like `gcip` - comment inner paragraph) for both
-- Normal and Visual modes
comment = '<leader>/',
-- Toggle comment on current line
comment_line = '<leader>//',
-- Toggle comment on visual selection
comment_visual = '<leader>/',
-- Define 'comment' textobject (like `dgc` - delete whole comment block)
-- Works also in Visual mode if mapping differs from `comment_visual`
textobject = 'gc',
}
}

View file

@ -0,0 +1,69 @@
local icons = require('config.icons')
return {
close_if_last_window = false,
hide_root_node = true,
default_component_configs = {
indent = {
indent_size = 2,
padding = 1,
-- indent guides
with_markers = true,
indent_marker = icons.tree.node,
last_indent_marker = icons.tree.nodelast,
},
icon = {
folder_open = icons.folder.open,
folder_close = icons.folder.close,
folder_empty = icons.folder.empty,
default = icons.files.text,
},
name = {
use_git_status_colors = false,
},
git_status = {
symbols = icons.gitsigns
},
file_size = {
enabled = false,
},
type = {
enabled = false,
},
last_modified = {
enabled = false,
},
created = {
enabled = false,
},
symlink_target = {
enabled = true,
},
},
event_handlers = {
{
event = "neo_tree_buffer_enter",
handler = function()
if vim.bo.filetype == "neo-tree" then
vim.cmd("setlocal statuscolumn=")
end
end,
}
},
filesystem = {
filtered_items = {
visible = true, -- when true, they will just be displayed differently than normal items
hide_dotfiles = true,
hide_gitignored = true,
hide_hidden = true, -- only works on Windows for hidden files/directories
hide_by_name = {
"node_modules",
"vendor",
},
},
follow_current_file = {
enabled = true,
},
use_libuv_file_watcher = true,
}
}

View file

@ -0,0 +1,57 @@
return {
-- A list of parser names
ensure_installed = {
"bash",
"c",
"cpp",
"ninja",
"cmake",
"dockerfile",
"make",
"lua",
"vim",
"vimdoc",
"query",
"php",
"phpdoc",
"blade",
"go",
"gomod",
"gosum",
"javascript",
"typescript",
"css",
"scss",
"html",
"vue",
"json",
"jsonc",
"yaml",
"toml",
"xml",
"glsl",
"hlsl",
"markdown"
},
-- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = true,
-- Automatically install missing parsers when entering buffer
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
auto_install = false,
highlight = {
enable = true,
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = false,
},
indent = {
enable = true
}
}

View file

@ -0,0 +1,9 @@
return {
defaults = {
mode = { "n", "v" },
["<leader>r"] = { name = "+rename" },
["<leader>b"] = { name = "+buffers" },
["<leader>f"] = { name = "+files" },
["<leader>d"] = { name = "+diagnostics" }
}
}

View file

@ -6,6 +6,7 @@ local set = vim.opt
set.termguicolors = true
set.updatetime = 50
set.showmode = false -- disable mode in the command line, because i use lualine
set.mousemoveevent = true
--
-- Editor settings
@ -14,6 +15,7 @@ set.pumheight = 20
set.hlsearch = false
set.incsearch = true
set.laststatus = 3
set.splitkeep = "screen"
set.scrolloff=20
--vim.opt.sidescrolloff = 8
set.cursorline = true
@ -60,3 +62,13 @@ vim.diagnostic.config({
source = 'always',
},
})
-- 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,
})

View file

@ -0,0 +1,24 @@
return {
"windwp/nvim-ts-autotag",
dependencies = {
'nvim-treesitter/nvim-treesitter'
},
opts = {
filetypes = {
'html',
'javascript',
'typescript',
'javascriptreact',
'typescriptreact',
'svelte',
'vue',
'tsx',
'jsx',
'rescript',
'xml',
'php',
'blade',
'markdown',
}
}
}

View file

@ -0,0 +1,27 @@
return {
'nvim-treesitter/nvim-treesitter',
build = function()
require('nvim-treesitter.install').update({ with_sync = true })
end,
dependencies = {
'nvim-treesitter/nvim-treesitter-textobjects',
'nvim-treesitter/playground'
},
opts = require('config.plugins.treesitter'),
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,
}

View file

@ -1,9 +1,5 @@
return {
'echasnovski/mini.comment',
version = '*',
opts = {
options = {
custom_commentstring = function() return vim.bo.commentstring end
}
}
opts = require('config.plugins.comment')
}

View file

@ -24,11 +24,11 @@ return {
results = { 1, 1, 1, 1 },
preview = { 1, 1, 1, 1 },
},
borderchars = {
prompt = { "", "", "", "", "", "", "", "" },
results = { "", "", " ", "", "", "", "", "" },
preview = { "", "", "", " ", "", "", "", "" },
},
-- borderchars = {
-- prompt = { "─", "│", "─", "│", "├", "┤", "┴", "└" },
-- results = { "─", "│", " ", "│", "┌", "┬", "│", "│" },
-- preview = { "─", "│", "─", " ", "─", "┐", "┘", "─" },
-- },
}
opts.defaults = vim.tbl_deep_extend("force", opts.defaults, override)

View file

@ -17,8 +17,8 @@ return {
local selectNext = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert })
local border = cmp.config.window.bordered({
border = {'', '', '', '', '', '', '', ''},
winhighlight = 'Normal:None,FloatBorder:FloatBorder,CursorLine:PmenuSel,Search:None'
-- border = {'┌', '─', '┐', '│', '┘', '─', '└', '│'},
winhighlight = 'Normal:NormalFloat,FloatBorder:FloatBorder,CursorLine:PmenuSel,Search:None'
})
return {

View file

@ -38,11 +38,47 @@ return {
},
keys = {
{ "<leader>Dw", function() require("dap.ui.widgets").hover() end, desc = "Widgets" },
{ "<leader>Db", function() require'dap'.toggle_breakpoint() end, desc = "Toggle breakpoint" },
},
config = function()
-- local Config = require("lazyvim.config")
vim.api.nvim_set_hl(0, "DapStoppedLine", { default = true, link = "Visual" })
local dap = require "dap"
dap.adapters.delve = {
type = 'server',
port = '${port}',
executable = {
command = 'dlv',
args = {'dap', '-l', '127.0.0.1:${port}'},
}
}
dap.configurations.go = {
{
type = "delve",
name = "Debug",
request = "launch",
program = "${file}"
},
{
type = "delve",
name = "Debug test", -- configuration for debugging test files
request = "launch",
mode = "test",
program = "${file}"
},
-- works with go.mod packages and sub packages
{
type = "delve",
name = "Debug test (go.mod)",
request = "launch",
mode = "test",
program = "./${relativeFileDirname}"
}
}
-- local Config = require("lazyvim.config")
-- for name, sign in pairs(Config.icons.dap) do
-- sign = type(sign) == "table" and sign or { sign }
-- vim.fn.sign_define(

View file

@ -1,6 +1,7 @@
return {
"nvim-neotest/neotest",
dependencies = {
"nvim-neotest/nvim-nio",
"nvim-lua/plenary.nvim",
"antoinemadec/FixCursorHold.nvim",
"nvim-treesitter/nvim-treesitter",
@ -22,7 +23,7 @@ return {
{"<leader>ta", ":lua require('neotest').output_panel.open()<cr>:lua require('neotest').run.run({suite = true})<cr>", desc = "test all"},
{"<leader>ts", ":lua require('neotest').run.stop()<cr>", desc = "stop test"},
{"<leader>tq", ":lua require('neotest').output_panel.close()<cr>", desc = "close output window"},
{"<leader>te", ":lua require('neotest').summary()<cr>"}
{"<leader>te", ":Neotest summary<cr>", desc = "Open test explorer"}
},
opts = function()
local icons = require('config.icons').test
@ -48,6 +49,9 @@ return {
skipped = icons.skipped,
unknown = icons.unknown,
watching = icons.watch
},
summery = {
open = "botleft vsplit"
}
}
end

View file

@ -1,83 +0,0 @@
return {
'nvim-treesitter/nvim-treesitter',
build = function()
require('nvim-treesitter.install').update({ with_sync = true })
end,
dependencies = {
'nvim-treesitter/nvim-treesitter-textobjects',
'nvim-treesitter/playground'
},
opts = {
-- A list of parser names
ensure_installed = {
"bash",
"c",
"cpp",
"ninja",
"cmake",
"dockerfile",
"make",
"lua",
"vim",
"vimdoc",
"query",
"php",
"phpdoc",
"blade",
"go",
"gomod",
"gosum",
"javascript",
"typescript",
"css",
"scss",
"html",
"vue",
"json",
"jsonc",
"yaml",
"toml",
"xml",
"glsl",
"hlsl",
"markdown"
},
-- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = true,
-- Automatically install missing parsers when entering buffer
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
auto_install = false,
highlight = {
enable = true,
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
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,
}

View file

@ -19,29 +19,33 @@ local opts = {
require("lazy").setup({
-- Core
-----------------------------
{ import = "plugins.core.treesitter" },
{ import = "plugins.core.autopairs" },
{ import = "plugins.core.autotag" },
{ import = "plugins.core.indent-blankline" },
-- Editor
-----------------------------
{ import = "plugins.editor.indent" },
{ import = "plugins.editor.autopairs" },
{ import = "plugins.editor.mini-comment" },
{ import = "plugins.editor.telescope" },
-- UI
-----------------------------
{ import = "plugins.ui.dressing" },
{ import = "plugins.ui.edgy" },
{ import = "plugins.ui.noice" },
{ import = "plugins.ui.dashboard" },
{ import = "plugins.ui.catppuccin" },
{ import = "plugins.ui.neo-tree" },
{ import = "plugins.ui.barbar" },
{ import = "plugins.ui.barbecue" },
{ import = "plugins.ui.bufferline" },
{ import = "plugins.ui.lualine" },
{ import = "plugins.ui.gitsigns" },
{ import = "plugins.ui.which-key" },
-- IDE
-----------------------------
{ import = "plugins.ide.treesitter" },
{ import = "plugins.ide.conform" },
{ import = "plugins.ide.cmp" },
{ import = "plugins.ide.lsp" },
@ -51,7 +55,7 @@ require("lazy").setup({
-- Language specific
-----------------------------
{ import = "plugins.lang.laravel" },
--{ import = "plugins.lang.go" },
{ import = "plugins.lang.go" },
}, opts)

View file

@ -28,7 +28,7 @@ return {
maximum_padding = 2,
minimum_padding = 1,
sidebar_filetypes = {
['neo-tree'] = {event = 'BufWipeout'},
--['neo-tree'] = {event = 'BufWipeout'},
}
},
}

View file

@ -1,12 +0,0 @@
return {
"utilyre/barbecue.nvim",
name = "barbecue",
version = "*",
dependencies = {
"SmiteshP/nvim-navic",
"nvim-tree/nvim-web-devicons",
},
opts = {
theme = "catppuccin",
}
}

View file

@ -0,0 +1,6 @@
return {
'akinsho/bufferline.nvim',
version = "*",
dependencies = 'nvim-tree/nvim-web-devicons',
opts = require('config.plugins.bufferline')
}

View file

@ -0,0 +1,33 @@
return {
"folke/edgy.nvim",
event = "VeryLazy",
keys = {
{ "<leader>ue", function() require("edgy").toggle() end, desc = "Edgy Toggle" },
-- stylua: ignore
{ "<leader>uE", function() require("edgy").select() end, desc = "Edgy Select Window" },
},
opts = {
left = {
{
title = "Neo-Tree",
ft = "neo-tree",
filter = function(buf)
return vim.b[buf].neo_tree_source == "filesystem"
end,
size = { height = 0.5 },
},
{
title = "Test",
ft = "neotest-summary"
},
"neo-tree",
},
options = {
left = { size = 40 }
},
animate = {
enabled = false,
},
exit_when_last = false
}
}

View file

@ -12,6 +12,7 @@ return {
theme = "catppuccin-mocha",
component_separators = '',
globalstatus = true,
section_separators = { left = '', right = '' },
disabled_filetypes = {
statusline = {
'dashboard',
@ -22,6 +23,17 @@ return {
sections = {
lualine_a = { "mode" },
lualine_b = { "branch" },
lualine_c = {
{
"diagnostics",
symbols = {
error = icons.diagnostics.error .. ' ',
warn = icons.diagnostics.warn .. ' ',
info = icons.diagnostics.info .. ' ',
hint = icons.diagnostics.hint .. ' ',
},
}
},
lualine_x = {
{
require("lazy.status").updates,
@ -36,15 +48,7 @@ return {
-- removed = icons.diff.removed .. ' '
-- }
-- },
{
"diagnostics",
symbols = {
error = icons.diagnostics.error .. ' ',
warn = icons.diagnostics.warn .. ' ',
info = icons.diagnostics.info .. ' ',
hint = icons.diagnostics.hint .. ' ',
},
},
'filename'
},
lualine_y = {
'encoding',

View file

@ -1,5 +1,3 @@
local icons = require('config.icons')
return {
'nvim-neo-tree/neo-tree.nvim',
cmd = 'Neotree',
@ -11,54 +9,5 @@ return {
"nvim-tree/nvim-web-devicons",
"nvim-lua/plenary.nvim",
},
opts = {
close_if_last_window = true,
hide_root_node = true,
default_component_configs = {
indent = {
indent_size = 2,
padding = 1,
-- indent guides
with_markers = true,
indent_marker = "",
last_indent_marker = "",
},
icon = {
folder_open = icons.folder.open,
folder_close = icons.folder.close,
folder_empty = icons.folder.empty,
},
name = {
use_git_status_colors = false,
},
git_status = {
symbols = icons.gitsigns
},
},
event_handlers = {
{
event = "neo_tree_buffer_enter",
handler = function()
if vim.bo.filetype == "neo-tree" then
vim.cmd("setlocal statuscolumn=")
end
end,
}
},
filesystem = {
filtered_items = {
visible = true, -- when true, they will just be displayed differently than normal items
hide_dotfiles = true,
hide_gitignored = true,
hide_hidden = true, -- only works on Windows for hidden files/directories
hide_by_name = {
"node_modules",
"vendor",
},
},
follow_current_file = {
enable = true
},
},
}
opts = require('config.plugins.neo-tree')
}

View file

@ -1,16 +1,33 @@
return {
"folke/noice.nvim",
event = "VeryLazy",
dependencies = {
"MunifTanjim/nui.nvim",
},
opts = {
cmdline = {
enabled = true,
view = "cmdline"
},
presets = {
bottom_search = true,
command_palette = true
command_palette = false
},
commands = {
history = {
view = "cmdline_output",
}
},
views = {
mini = {
position = {
row = -2,
},
border = {
style = 'solid',
padding = { 0, 1 },
}
}
}
},
dependencies = {
"MunifTanjim/nui.nvim",
}
}

View file

@ -5,19 +5,11 @@ return {
vim.o.timeout = true
vim.o.timeoutlen = 300
end,
opts = {
defaults = {
mode = { "n", "v" },
["<leader>r"] = { name = "+rename" },
["<leader>b"] = { name = "+buffers" },
["<leader>f"] = { name = "+files" },
["<leader>d"] = { name = "+diagnostics" }
}
},
opts = require('config.plugins.which-key'),
config = function(_, opts)
local wk = require("which-key")
wk.setup(opts)
wk.register(opts.defaults)
wk.register(opts.defaults or {})
end
}