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

update nvim config

This commit is contained in:
Henrik Hautakoski 2024-03-02 20:21:23 +01:00
parent 6c7551640d
commit 07a49ce2d2
16 changed files with 157 additions and 46 deletions

View file

@ -3,20 +3,20 @@
--
vim.opt.showmode = false -- disable mode in the command line, because i use lualine
--vim.opt.guicursor = "a:ver100,c-ci-cr:hor80-blinkon100-blinkwait300"
--vim.opt.scrolloff = 30
--vim.opt.sidescrolloff = 8
--
-- Editor settings
--
vim.opt.cursorline = true -- highlight line where cursor is.
vim.opt.scrolloff=20
--vim.opt.sidescrolloff = 8
vim.opt.cursorline = true
-- line numbers
vim.opt.number = true
vim.opt.relativenumber = true
vim.opt.numberwidth = 6
vim.opt.numberwidth = 5
vim.opt.statuscolumn = '%=%{v:relnum?v:relnum:v:lnum} %s '
-- indent
vim.opt.smartindent = true

View file

@ -0,0 +1,8 @@
return {
{ '<leader>sf', '<cmd>Telescope find_files<cr>', desc = 'Search files' },
{ '<leader>sg', '<cmd>Telescope git_files<cr>', desc = 'Search Git files' },
{ '<leader>sw', '<cmd>Telescope grep_string<cr>', desc = 'Search Word' },
-- LSP
--{ 'gd', '<cmd>Telescope lsp_definitions<cr>', desc = 'Goto definition' },
}

View file

@ -20,6 +20,7 @@ return {
red = '#cc817f',
green = '#7ccfaf',
yellow = '#ffcc99',
orange = '#ffcc99',
blue = '#8ac6f2',
cyan = '#8abeb7',
purple = '#9999cc'
@ -28,9 +29,23 @@ return {
["@string"] = { fg = "$purple" },
["@function"] = { fg = "$fg" },
["@keyword"] = { fg = "$yellow" },
["@keyword.import"] = { fg = "$yellow" },
["@keyword.function"] = { fg = "$yellow" },
["@keyword.conditional"] = { fg = "$yellow" },
["@keyword.operator"] = { fg = "$yellow" },
["@type"] = { fg = "$blue" },
["@type.qualifier"] = { fg = "$yellow" },
["@type.definition"] = { fg = "$blue" },
["@type.builtin"] = { fg = "$blue" },
["@function.method"] = { fg = "$fg" },
["@number"] = { fg = "$red" },
["@variable"] = { fg = "$green" },
["@variable.builtin"] = { fg = "$green" },
["@variable.parameter"] = { fg = "$fg" },
["@property"] = { fg = "$green" },
["@punctuation.delimiter"] = { fg = "$fg" },
["@punctuation.bracket"] = { fg = "$fg" }
["@punctuation.bracket"] = { fg = "$fg" },
["@module"] = { fg = "$fg" },
}
},
config = function(_, opts)

View file

@ -0,0 +1,27 @@
return {
'nvimdev/dashboard-nvim',
name = 'dashboard',
dependencies = {
'nvim-tree/nvim-web-devicons'
},
event = 'VimEnter',
opts = {
config = {
header = {
'::::::::: :::: ::: ::: :::',
':+: :+: :+:+: :+: :+: :+:',
'+:+ +:+ :+:+:+ +:+ +:+ +:+ ',
'+#++:++#+ +#+ +:+ +#+ +#++:+ ',
'+#+ +#+ +#+#+# +#+ +#+ ',
'#+# #+# #+#+# #+# #+#',
'### ### #### ### ###',
'',
},
shortcut = {
{ desc = '󰊳 Update', group = '@property', action = 'Lazy update', key = 'u' }
},
footer = {}
}
}
}

View file

@ -1,11 +1,15 @@
return {
'lewis6991/gitsigns.nvim',
lazy = false,
keys = {
{ '<leader>gp', '<cmd>Gitsigns preview_hunk<cr>', desc = 'Git preview diff' },
{ '<leader>gb', '<cmd>Gitsigns blame_line<cr>', desc = 'Git blame' }
},
opts = {
signs = {
add = { text = '' },
add = { text = '' },
delete = { text = '' },
change = { text = '' },
change = { text = '' },
untracked = { text = '+'}
},
},

14
nvim/lua/plugins/go.lua Normal file
View file

@ -0,0 +1,14 @@
return {
"ray-x/go.nvim",
dependencies = {
"ray-x/guihua.lua",
"neovim/nvim-lspconfig",
"nvim-treesitter/nvim-treesitter",
},
config = function()
require("go").setup()
end,
event = {"CmdlineEnter"},
ft = {"go", 'gomod'},
build = ':lua require("go.install").update_all_sync()'
}

View file

@ -1,10 +1,16 @@
return {
"lukas-reineke/indent-blankline.nvim",
main = "ibl",
"lukas-reineke/indent-blankline.nvim",
main = "ibl",
opts = {
scope = {
enabled = true,
show_exact_scope = true
show_exact_scope = true,
},
exclude = {
filetypes = {
'help',
'dashboard'
}
}
},
}
}

View file

@ -13,11 +13,14 @@ vim.opt.rtp:prepend(lazypath)
require("lazy").setup({
{ import = "plugins.dashboard" },
-- Highlight
{ import = "plugins.colorscheme" },
{ import = "plugins.indent" },
{ import = "plugins.nvim-autopairs" },
{ import = "plugins.mini-comment" },
-- Filetree
{ import = "plugins.neo-tree" },
@ -30,12 +33,17 @@ require("lazy").setup({
-- Keybind helper
{ import = "plugins.which-key" },
-- Treesitter
{ import = "plugins.treesitter" },
-- LSP
{ import = "plugins.lsp" },
{ import = "plugins.nvim-cmp" },
{ import = "plugins.go" },
{ import = "plugins.nvim-test" },
-- Git changes in gutter
{ import = "plugins.gitsigns" },

View file

@ -3,7 +3,6 @@ return {
dependencies = {
'williamboman/mason.nvim',
'williamboman/mason-lspconfig.nvim',
require('plugins.cmp')
},
config = function()
-- Setup Mason to automatically install LSP servers
@ -12,25 +11,19 @@ return {
local lspconfig = require('lspconfig')
-- local capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities())
-- PHP
lspconfig.intelephense.setup({
commands = {
IntelephenseIndex = {
function() vim.lsp.buf.execute_command({ command = 'intelephense.index.workspace' }) end,
},
},
on_attach = function(client, bufnr)
client.server_capabilities.documentFormattingProvider = false
client.server_capabilities.documentRangeFormattingProvider = false
end,
-- capabilities = capabilities
-- php - phpactor
lspconfig.phpactor.setup({
init_options = {
["language_server_phpstan.enabled"] = true,
["language_server_psalm.enabled"] = false,
}
})
-- GO
lspconfig.gopls.setup({})
-- Tailwind CSS
--require('lspconfig').tailwindcss.setup({ capabilities = capabilities })
-- Format on save.
vim.api.nvim_create_autocmd("BufWritePre", {
pattern = '*.go',
@ -41,7 +34,30 @@ return {
-- Typescript
lspconfig.tsserver.setup({})
-- lua
lspconfig.lua_ls.setup({
on_init = function(client)
local path = client.workspace_folders[1].name
if not vim.loop.fs_stat(path..'/.luarc.json') and not vim.loop.fs_stat(path..'/.luarc.jsonc') then
client.config.settings = vim.tbl_deep_extend('force', client.config.settings, {
Lua = {
runtime = {
version = 'LuaJIT'
},
workspace = {
checkThirdParty = false,
library = {
vim.env.VIMRUNTIME
}
}
}
})
end
return true
end
})
-- Config
-- Sign configuration
vim.fn.sign_define('DiagnosticSignError', { text = '', texthl = 'DiagnosticSignError' })

View file

@ -0,0 +1,7 @@
return {
'echasnovski/mini.comment',
version = '*',
config = function()
require('mini.comment').setup({})
end
}

View file

@ -0,0 +1,3 @@
return {
"klen/nvim-test",
}

View file

@ -5,10 +5,7 @@ return {
'nvim-lua/plenary.nvim',
'kyazdani42/nvim-web-devicons'
},
keys = {
{ '<leader>f', function() require('telescope.builtin').find_files() end },
{ '<leader>F', function() require('telescope.builtin').git_files() end },
},
keys = require('config.telescope'),
config = function()
require('telescope').setup({
defaults = {

View file

@ -10,18 +10,19 @@ return {
-- A list of parser names
ensure_installed = {
"bash",
"c",
"c",
"cpp",
"ninja",
"cmake",
"lua",
"vim",
"make",
"lua",
"vim",
"vimdoc",
"query",
"query",
"php",
"blade",
"go",
"javascript",
"go",
"javascript",
"typescript",
"css",
"scss",
@ -33,7 +34,7 @@ return {
"toml",
"xml",
"glsl",
"hlsl",
"hlsl",
"markdown"
},
@ -54,9 +55,9 @@ return {
additional_vim_regex_highlighting = false,
},
indent = {
enable = true
}
-- indent = {
-- enable = true
--}
},
config = function(_, opts)
local parser_config = require('nvim-treesitter.parsers').get_parser_configs()