1
0
Fork 0
mirror of https://github.com/pnx/dotfiles synced 2026-06-18 03:50:03 +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

@ -2,4 +2,4 @@
Just my vim config. Just my vim config.
Run `:PlugInstall` to install all plugins. Run `:Lazy` to install all plugins.

View file

@ -4,7 +4,10 @@
"cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
"cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "3d8912ebeb56e5ae08ef0906e3a54de1c66b92f1" }, "cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "3d8912ebeb56e5ae08ef0906e3a54de1c66b92f1" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"dashboard": { "branch": "master", "commit": "413442b12d85315fc626c44a0ce4929b213ef604" },
"gitsigns.nvim": { "branch": "main", "commit": "2c2463dbd82eddd7dbab881c3a62cfbfbe3c67ae" }, "gitsigns.nvim": { "branch": "main", "commit": "2c2463dbd82eddd7dbab881c3a62cfbfbe3c67ae" },
"go.nvim": { "branch": "master", "commit": "8efd0c89f2305a6840a99d7823c40cc3acea91d6" },
"guihua.lua": { "branch": "master", "commit": "9fb6795474918b492d9ab01b1ebaf85e8bf6fe0b" },
"indent-blankline.nvim": { "branch": "master", "commit": "821a7acd88587d966f7e464b0b3031dfe7f5680c" }, "indent-blankline.nvim": { "branch": "master", "commit": "821a7acd88587d966f7e464b0b3031dfe7f5680c" },
"lazy.nvim": { "branch": "main", "commit": "aedcd79811d491b60d0a6577a9c1701063c2a609" }, "lazy.nvim": { "branch": "main", "commit": "aedcd79811d491b60d0a6577a9c1701063c2a609" },
"lspkind-nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" }, "lspkind-nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" },
@ -12,13 +15,15 @@
"lualine.nvim": { "branch": "master", "commit": "7d131a8d3ba5016229e8a1d08bf8782acea98852" }, "lualine.nvim": { "branch": "master", "commit": "7d131a8d3ba5016229e8a1d08bf8782acea98852" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "21d33d69a81f6351e5a5f49078b2e4f0075c8e73" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "21d33d69a81f6351e5a5f49078b2e4f0075c8e73" },
"mason.nvim": { "branch": "main", "commit": "3b5068f0fc565f337d67a2d315d935f574848ee7" }, "mason.nvim": { "branch": "main", "commit": "3b5068f0fc565f337d67a2d315d935f574848ee7" },
"mini.comment": { "branch": "main", "commit": "a4b7e46deb9ad2feb8902cc5dbf087eced112ee5" },
"neo-tree.nvim": { "branch": "main", "commit": "459c60317cc1d251f6eb3b6f010d015d5d24b806" }, "neo-tree.nvim": { "branch": "main", "commit": "459c60317cc1d251f6eb3b6f010d015d5d24b806" },
"nui.nvim": { "branch": "main", "commit": "c3c7fd618dcb5a89e443a2e1033e7d11fdb0596b" }, "nui.nvim": { "branch": "main", "commit": "c3c7fd618dcb5a89e443a2e1033e7d11fdb0596b" },
"nvim-autopairs": { "branch": "master", "commit": "c6139ca0d5ad7af129ea6c89cb4c56093f2c034a" }, "nvim-autopairs": { "branch": "master", "commit": "c6139ca0d5ad7af129ea6c89cb4c56093f2c034a" },
"nvim-cmp": { "branch": "main", "commit": "04e0ca376d6abdbfc8b52180f8ea236cbfddf782" }, "nvim-cmp": { "branch": "main", "commit": "04e0ca376d6abdbfc8b52180f8ea236cbfddf782" },
"nvim-lspconfig": { "branch": "master", "commit": "b1a11b042d015df5b8f7f33aa026e501b639c649" }, "nvim-lspconfig": { "branch": "master", "commit": "9553725789be682ecd945a527ec552e489ea8534" },
"nvim-treesitter": { "branch": "master", "commit": "db12bd416e2764420047e4a5d6b96fe44e4377d5" }, "nvim-test": { "branch": "main", "commit": "e06f3d029ee161f3ead6193cf27354d1eb8723c3" },
"nvim-web-devicons": { "branch": "master", "commit": "0bb67ef952ea3eb7b1bac9c011281471d99a27bc" }, "nvim-treesitter": { "branch": "master", "commit": "c2a265156d5799adbd9f9e7d5385735fa5d21776" },
"nvim-web-devicons": { "branch": "master", "commit": "69fb193abc547c77be089c3e392d5fd6fcd3625a" },
"onedark.nvim": { "branch": "master", "commit": "1230aaf2a427b2c5b73aba6e4a9a5881d3e69429" }, "onedark.nvim": { "branch": "master", "commit": "1230aaf2a427b2c5b73aba6e4a9a5881d3e69429" },
"playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" }, "playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" },
"plenary.nvim": { "branch": "master", "commit": "4f71c0c4a196ceb656c824a70792f3df3ce6bb6d" }, "plenary.nvim": { "branch": "master", "commit": "4f71c0c4a196ceb656c824a70792f3df3ce6bb6d" },

View file

@ -3,20 +3,20 @@
-- --
vim.opt.showmode = false -- disable mode in the command line, because i use lualine 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 -- 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 -- line numbers
vim.opt.number = true vim.opt.number = true
vim.opt.relativenumber = true vim.opt.relativenumber = true
vim.opt.numberwidth = 6 vim.opt.numberwidth = 5
vim.opt.statuscolumn = '%=%{v:relnum?v:relnum:v:lnum} %s '
-- indent -- indent
vim.opt.smartindent = true 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', red = '#cc817f',
green = '#7ccfaf', green = '#7ccfaf',
yellow = '#ffcc99', yellow = '#ffcc99',
orange = '#ffcc99',
blue = '#8ac6f2', blue = '#8ac6f2',
cyan = '#8abeb7', cyan = '#8abeb7',
purple = '#9999cc' purple = '#9999cc'
@ -28,9 +29,23 @@ return {
["@string"] = { fg = "$purple" }, ["@string"] = { fg = "$purple" },
["@function"] = { fg = "$fg" }, ["@function"] = { fg = "$fg" },
["@keyword"] = { fg = "$yellow" }, ["@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" }, ["@variable.parameter"] = { fg = "$fg" },
["@property"] = { fg = "$green" },
["@punctuation.delimiter"] = { fg = "$fg" }, ["@punctuation.delimiter"] = { fg = "$fg" },
["@punctuation.bracket"] = { fg = "$fg" } ["@punctuation.bracket"] = { fg = "$fg" },
["@module"] = { fg = "$fg" },
} }
}, },
config = function(_, opts) 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 { return {
'lewis6991/gitsigns.nvim', 'lewis6991/gitsigns.nvim',
lazy = false, 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 = { opts = {
signs = { signs = {
add = { text = '' }, add = { text = '' },
delete = { text = '' }, delete = { text = '' },
change = { text = '' }, change = { text = '' },
untracked = { 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

@ -4,7 +4,13 @@ return {
opts = { opts = {
scope = { scope = {
enabled = true, 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({ require("lazy").setup({
{ import = "plugins.dashboard" },
-- Highlight -- Highlight
{ import = "plugins.colorscheme" }, { import = "plugins.colorscheme" },
{ import = "plugins.indent" }, { import = "plugins.indent" },
{ import = "plugins.nvim-autopairs" }, { import = "plugins.nvim-autopairs" },
{ import = "plugins.mini-comment" },
-- Filetree -- Filetree
{ import = "plugins.neo-tree" }, { import = "plugins.neo-tree" },
@ -36,6 +39,11 @@ require("lazy").setup({
-- LSP -- LSP
{ import = "plugins.lsp" }, { import = "plugins.lsp" },
{ import = "plugins.nvim-cmp" },
{ import = "plugins.go" },
{ import = "plugins.nvim-test" },
-- Git changes in gutter -- Git changes in gutter
{ import = "plugins.gitsigns" }, { import = "plugins.gitsigns" },

View file

@ -3,7 +3,6 @@ return {
dependencies = { dependencies = {
'williamboman/mason.nvim', 'williamboman/mason.nvim',
'williamboman/mason-lspconfig.nvim', 'williamboman/mason-lspconfig.nvim',
require('plugins.cmp')
}, },
config = function() config = function()
-- Setup Mason to automatically install LSP servers -- Setup Mason to automatically install LSP servers
@ -12,18 +11,12 @@ return {
local lspconfig = require('lspconfig') local lspconfig = require('lspconfig')
-- local capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities()) -- local capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities())
-- PHP -- php - phpactor
lspconfig.intelephense.setup({ lspconfig.phpactor.setup({
commands = { init_options = {
IntelephenseIndex = { ["language_server_phpstan.enabled"] = true,
function() vim.lsp.buf.execute_command({ command = 'intelephense.index.workspace' }) end, ["language_server_psalm.enabled"] = false,
}, }
},
on_attach = function(client, bufnr)
client.server_capabilities.documentFormattingProvider = false
client.server_capabilities.documentRangeFormattingProvider = false
end,
-- capabilities = capabilities
}) })
-- GO -- GO
@ -42,6 +35,29 @@ return {
-- Typescript -- Typescript
lspconfig.tsserver.setup({}) 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 -- Config
-- Sign configuration -- Sign configuration
vim.fn.sign_define('DiagnosticSignError', { text = '', texthl = 'DiagnosticSignError' }) 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', 'nvim-lua/plenary.nvim',
'kyazdani42/nvim-web-devicons' 'kyazdani42/nvim-web-devicons'
}, },
keys = { keys = require('config.telescope'),
{ '<leader>f', function() require('telescope.builtin').find_files() end },
{ '<leader>F', function() require('telescope.builtin').git_files() end },
},
config = function() config = function()
require('telescope').setup({ require('telescope').setup({
defaults = { defaults = {

View file

@ -14,6 +14,7 @@ return {
"cpp", "cpp",
"ninja", "ninja",
"cmake", "cmake",
"make",
"lua", "lua",
"vim", "vim",
"vimdoc", "vimdoc",
@ -54,9 +55,9 @@ return {
additional_vim_regex_highlighting = false, additional_vim_regex_highlighting = false,
}, },
indent = { -- indent = {
enable = true -- enable = true
} --}
}, },
config = function(_, opts) config = function(_, opts)
local parser_config = require('nvim-treesitter.parsers').get_parser_configs() local parser_config = require('nvim-treesitter.parsers').get_parser_configs()