1
0
Fork 0
mirror of https://github.com/pnx/dotfiles synced 2026-06-16 19:30:01 +02:00

touching the nvim again

This commit is contained in:
Henrik Hautakoski 2024-05-14 11:37:21 +02:00
parent c05ca4cb35
commit bcb84e54eb
11 changed files with 120 additions and 47 deletions

View file

@ -1,5 +1,15 @@
local autocmd = vim.api.nvim_create_autocmd
-- Highlight on yank
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 = 400 }
end,
})
-- Remove all trailing whitespaces on save
autocmd('BufWritePre', {
command = [[:exe 'norm m`' | %s/\s\+$//eg | norm ``]]

View file

@ -0,0 +1,19 @@
return {
-- Filetypes to enable autotag for
filetypes = {
'html',
'javascript',
'typescript',
'javascriptreact',
'typescriptreact',
'svelte',
'vue',
'tsx',
'jsx',
'rescript',
'xml',
'php',
'blade',
'markdown',
}
}

View file

@ -7,7 +7,7 @@ return function()
local selectNext = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert })
local windowstyle = {
border = "none",
border = vim.g.float_border or 'none',
winhighlight = 'Normal:Pmenu,FloatBorder:FloatBorder,CursorLine:PmenuSel,Search:None',
}

View file

@ -25,7 +25,7 @@ return {
-- Floating windows
NormalFloat = { fg = colors.text, bg = colors.mantle },
FloatTitle = { fg = colors.base, bg = colors.blue },
FloatBorder = { fg = colors.blue, bg = colors.mantle },
FloatBorder = { fg = colors.surface1, bg = colors.mantle },
-- Window separator
WinSeparator = { fg = colors.surface0 },
@ -40,6 +40,8 @@ return {
-- indent lines
IblScope = { fg = colors.overlay1 },
IncSearch = { bg = colors.yellow },
-- LSP
-- LspReferenceText = { bg = colors.surface0 },
-- LspReferenceRead = { link = "LspReferenceText" },

View file

@ -12,10 +12,20 @@ vim.filetype.add({
},
})
-- Fix autocomment plugins to use line comments for php.
-- PHP
autocmd('Filetype', {
pattern = 'php',
command = 'setlocal commentstring=//\\%s'
callback = function()
-- Fix autocomment plugins to use line comments
vim.cmd('setlocal commentstring=//\\%s')
-- Goto file for blade files in laravel projects
vim.cmd([[
set path=.,resources/views
set suffixesadd=.blade.php
set includeexpr=substitute(v:fname,'\\.','/','g')
]])
end
})

View file

@ -8,6 +8,8 @@ return {
--
global = {
{ "n", "<leader>W", "<cmd>lua vim.opt.list = not vim.opt.list._value<cr>", { silent = true, desc = "Toggle show whitespace" } },
--
-- Navigation
--
@ -19,10 +21,10 @@ return {
{ "n", "<S-PageDown>", "<C-d>zz", { silent = true, desc = "jump half a page down" } },
-- Split windows
{ "n", "<C-h>", "<C-w>h", { silent = true, desc = "Goto left split" } },
{ "n", "<C-j>", "<C-w>j", { silent = true, desc = "Goto down split" } },
{ "n", "<C-k>", "<C-w>k", { silent = true, desc = "Goto up split" } },
{ "n", "<C-l>", "<C-w>l", { silent = true, desc = "Goto right split" } },
{ "n", "<C-h>", "<C-w>h", { silent = true, desc = "Focus left split" } },
{ "n", "<C-j>", "<C-w>j", { silent = true, desc = "Focus down split" } },
{ "n", "<C-k>", "<C-w>k", { silent = true, desc = "Focus up split" } },
{ "n", "<C-l>", "<C-w>l", { silent = true, desc = "Focus right split" } },
-- Make jump to next search item stay in the center of screen.
{ "n", "n", "nzzzv", { silent = true, desc = "jump to next search match" } },
@ -44,7 +46,7 @@ return {
{ { "n", "v" }, "<leader>p", [["+p]], { desc = "Paste from system clipboard register" } },
-- File operations
{ "n", "<leader>Fe", "<cmd>Ex<CR>", { silent = true, desc = "Open Netrw" } },
-- { "n", "<leader>Fe", "<cmd>Ex<CR>", { silent = true, desc = "Open Netrw" } },
{ "n", "<leader>Fc", ":CreateFile ", { silent = true, desc = "Create new file" } },
{ "n", "<leader>Fx", "<cmd>!chmod +x %<CR>", { silent = true, desc = "Set execute flag on current file" } },

View file

@ -1,3 +1,5 @@
vim.g.lsp_zero_ui_float_border = vim.g.float_border or 'none'
return {
servers = {
-- PHP

View file

@ -1,4 +1,23 @@
return {
default_file_explorer = true,
prompt_save_on_select_new_entry = false,
keymaps = {
["g?"] = "actions.show_help",
["<CR>"] = "actions.select",
["<C-v>"] = "actions.select_vsplit",
["<C-p>"] = "actions.preview",
["<C-c>"] = "actions.close",
["<C-l>"] = "actions.refresh",
["-"] = "actions.parent",
["_"] = "actions.open_cwd",
["`"] = "actions.cd",
["~"] = "actions.tcd",
["gs"] = "actions.change_sort",
["gx"] = "actions.open_external",
["g."] = "actions.toggle_hidden",
["g\\"] = "actions.toggle_trash",
},
use_default_keymaps = false,
float = {
-- Padding around the floating window
padding = 2,
@ -9,4 +28,10 @@ return {
winblend = 0,
},
},
ssh = {
border = "single",
},
keymaps_help = {
border = "single",
}
}

View file

@ -1,13 +1,30 @@
local set = vim.opt
local icons = require('config.icons')
--
-- Variables
--
-- Custom
vim.g.float_border = 'single'
--
-- General Settings
--
set.termguicolors = true
-- Decrease update time
set.updatetime = 50
set.showmode = false -- disable mode in the command line, because i use lualine
-- Decrease mapped sequence wait time
-- Displays which-key popup sooner
set.timeoutlen = 50
-- disable mode in the command line, because i use lualine
set.showmode = false
--
@ -20,6 +37,16 @@ set.laststatus = 3
set.splitkeep = "screen"
set.scrolloff = 20
-- Configure how new splits should be opened
set.splitright = true
set.splitbelow = true
-- Sets how neovim will display certain whitespace characters in the editor.
-- See `:help 'list'`
-- and `:help 'listchars'`
set.list = false
set.listchars = { tab = '» ', trail = '·', nbsp = '' }
set.fillchars = {
foldopen = icons.fold.open,
foldclose = icons.fold.close,
@ -36,6 +63,7 @@ set.mousemoveevent = true
-- search
set.hlsearch = false
set.incsearch = true
-- Case-insensitive searching UNLESS \C or one or more capital letters in the search term
set.ignorecase = true
set.smartcase = true
@ -69,28 +97,20 @@ set.foldcolumn = "auto"
-- Diagnostics
--
vim.fn.sign_define('DiagnosticSignError', { text = icons.diagnostics.error, texthl = 'DiagnosticSignError' })
vim.fn.sign_define('DiagnosticSignWarn', { text = icons.diagnostics.warn, texthl = 'DiagnosticSignWarn' })
vim.fn.sign_define('DiagnosticSignInfo', { text = icons.diagnostics.info, texthl = 'DiagnosticSignInfo' })
vim.fn.sign_define('DiagnosticSignHint', { text = icons.diagnostics.hint, texthl = 'DiagnosticSignHint' })
vim.diagnostic.config({
virtual_text = false,
severity_sort = true,
underline = false,
float = {
-- border = 'single',
signs = {
text = {
[vim.diagnostic.severity.ERROR] = icons.diagnostics.error,
[vim.diagnostic.severity.WARN] = icons.diagnostics.warn,
[vim.diagnostic.severity.INFO] = icons.diagnostics.info,
[vim.diagnostic.severity.HINT] = icons.diagnostics.hint
},
},
float = {
border = vim.g.float_border,
}
})
-- 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 = 400 }
end,
})

View file

@ -64,24 +64,7 @@ return {
dependencies = {
'nvim-treesitter/nvim-treesitter'
},
opts = {
filetypes = {
'html',
'javascript',
'typescript',
'javascriptreact',
'typescriptreact',
'svelte',
'vue',
'tsx',
'jsx',
'rescript',
'xml',
'php',
'blade',
'markdown',
}
}
opts = require('config.autotag')
},
{
"lukas-reineke/indent-blankline.nvim",

View file

@ -57,7 +57,7 @@ return {
end
server_opt = vim.tbl_deep_extend("force", {on_attach = on_attach}, server_opt or {})
lsp_config[name].setup(server_opt)
end
end,