Merge branch 'main' of github.com:MasterGordon/neovim-config into main

This commit is contained in:
Gordon Goldbach 2023-06-06 09:49:48 +02:00
commit 6a7dc04b6d
8 changed files with 147 additions and 90 deletions

View File

@ -1,7 +1,12 @@
vim.api.nvim_set_keymap("n", "<leader>ff", "<cmd>lua require('telescope.builtin').git_files()<cr>", {silent = true}) vim.api.nvim_set_keymap("n", "<leader>ff", "<cmd>lua require('telescope.builtin').find_files()<cr>", {silent = true})
vim.api.nvim_set_keymap("n", "<leader>fF", "<cmd>lua require('telescope.builtin').find_files()<cr>", {silent = true}) vim.api.nvim_set_keymap(
"n",
"<leader>fF",
"<cmd>lua require('telescope.builtin').find_files({no_ignore=true, no_ignore_parent = true})<cr>",
{silent = true}
)
vim.api.nvim_set_keymap("n", "<leader>fg", "<cmd>lua require('telescope.builtin').live_grep()<cr>", {silent = true}) vim.api.nvim_set_keymap("n", "<leader>fg", "<cmd>lua require('telescope.builtin').live_grep()<cr>", {silent = true})
vim.api.nvim_set_keymap("n", "<leader>fb", "<cmd>lua require('telescope.builtin').buffers()<cr>", {silent = true}) -- vim.api.nvim_set_keymap("n", "<leader>fb", "<cmd>lua require('telescope.builtin').buffers()<cr>", {silent = true})
vim.api.nvim_set_keymap("n", "<leader>fh", "<cmd>lua require('telescope.builtin').help_tags()<cr>", {silent = true}) vim.api.nvim_set_keymap("n", "<leader>fh", "<cmd>lua require('telescope.builtin').help_tags()<cr>", {silent = true})
vim.api.nvim_set_keymap("n", "<leader>fb", "<cmd>lua require('telescope.builtin').git_branches()<cr>", {silent = true}) vim.api.nvim_set_keymap("n", "<leader>fb", "<cmd>lua require('telescope.builtin').git_branches()<cr>", {silent = true})
vim.api.nvim_set_keymap("n", "<leader>ft", "<CMD>TodoTelescope<CR>", {silent = true}) vim.api.nvim_set_keymap("n", "<leader>ft", "<CMD>TodoTelescope<CR>", {silent = true})

View File

@ -76,7 +76,7 @@ return require("packer").startup(
"RishabhRD/popfix", "RishabhRD/popfix",
"onsails/lspkind-nvim", "onsails/lspkind-nvim",
"ray-x/lsp_signature.nvim", "ray-x/lsp_signature.nvim",
"jose-elias-alvarez/nvim-lsp-ts-utils", "jose-elias-alvarez/typescript.nvim",
"hood/popui.nvim" "hood/popui.nvim"
} }
} }
@ -93,24 +93,12 @@ return require("packer").startup(
end, end,
requires = {"nvim-lua/popup.nvim", "nvim-lua/plenary.nvim"} requires = {"nvim-lua/popup.nvim", "nvim-lua/plenary.nvim"}
} }
use {
"nacro90/numb.nvim",
config = function()
require("numb").setup()
end
}
use { use {
"norcalli/nvim-colorizer.lua", "norcalli/nvim-colorizer.lua",
config = function() config = function()
require "colorizer".setup() require "colorizer".setup()
end end
} }
use {
"sindrets/diffview.nvim",
config = function()
require "plugins/diffview"
end
}
use { use {
"folke/todo-comments.nvim", "folke/todo-comments.nvim",
requires = "nvim-lua/plenary.nvim", requires = "nvim-lua/plenary.nvim",
@ -178,7 +166,6 @@ return require("packer").startup(
end, end,
requires = { requires = {
"kyazdani42/nvim-web-devicons", "kyazdani42/nvim-web-devicons",
"SmiteshP/nvim-gps",
"nvim-treesitter/nvim-treesitter" "nvim-treesitter/nvim-treesitter"
}, },
after = { after = {
@ -231,5 +218,22 @@ return require("packer").startup(
"monokai.nvim" "monokai.nvim"
} }
} }
use {
"luukvbaal/statuscol.nvim",
config = function()
require("statuscol").setup(
{
-- setopt = true,
ft_ignore = {"neo-tree"}
}
)
end
}
use {
"axelvc/template-string.nvim",
config = function()
require("template-string").setup()
end
}
end end
) )

View File

@ -95,11 +95,6 @@ options = {
return vim_item return vim_item
end ]] end ]]
}, },
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
end
},
mapping = { mapping = {
["<C-f>"] = cmp.mapping.complete(), ["<C-f>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.close(), ["<C-e>"] = cmp.mapping.close(),

View File

@ -1,20 +1,6 @@
local conditions = require("heirline.conditions") local conditions = require("heirline.conditions")
local utils = require("heirline.utils") local utils = require("heirline.utils")
require("nvim-gps").setup(
{
icons = {
["class-name"] = "",
["function-name"] = "",
["method-name"] = "",
["container-name"] = "",
["tag-name"] = ""
}
}
)
vim.o.laststatus = 3
local colors = { local colors = {
bg = "#333842", bg = "#333842",
brown = "#504945", brown = "#504945",
@ -41,6 +27,8 @@ local colors = {
} }
} }
vim.o.laststatus = 3
local ViMode = { local ViMode = {
-- get vim current mode, this information will be required by the provider -- get vim current mode, this information will be required by the provider
-- and the highlight functions, so we compute it only once per component -- and the highlight functions, so we compute it only once per component
@ -369,18 +357,6 @@ FileNameShortBlock =
{provider = "%<"} -- this means that the statusline is cut here when there's not enough space {provider = "%<"} -- this means that the statusline is cut here when there's not enough space
) )
local Gps = {
condition = require("nvim-gps").is_available,
provider = function()
local loc = require("nvim-gps").get_location()
if loc == "" then
return ""
end
return "> " .. loc
end,
hl = {fg = colors.gray, bg = colors.bg}
}
local DefaultStatusline = { local DefaultStatusline = {
ViMode, ViMode,
Space, Space,
@ -428,18 +404,6 @@ local GSpace = {provider = " ", hl = {bg = colors.bg}}
local WinBars = { local WinBars = {
fallthrough = false, fallthrough = false,
{
-- Hide the winbar for special buffers
condition = function()
return conditions.buffer_matches(
{
buftype = {"nofile", "prompt", "help", "quickfix", "nofile", "promt"},
filetype = {"^git.*", "fugitive"}
}
)
end,
provider = ""
},
{ {
-- An inactive winbar for regular files -- An inactive winbar for regular files
condition = function() condition = function()
@ -470,7 +434,12 @@ local WinBars = {
utils.surround({"", ""}, colors.bright_bg, {hl = {fg = "gray", force = true}, GSpace, FileNameShortBlock, Align}) utils.surround({"", ""}, colors.bright_bg, {hl = {fg = "gray", force = true}, GSpace, FileNameShortBlock, Align})
}, },
-- A winbar for regular files -- A winbar for regular files
{GSpace, FileNameShortBlock, GSpace, Gps, Align} {
GSpace,
FileNameShortBlock,
-- GSpace,
Align
}
} }
vim.api.nvim_create_autocmd( vim.api.nvim_create_autocmd(
@ -611,7 +580,7 @@ local TablineCloseButton = {
end, end,
{provider = " "}, {provider = " "},
{ {
provider = "", provider = "",
hl = {fg = "gray"}, hl = {fg = "gray"},
on_click = { on_click = {
callback = function(_, minwid) callback = function(_, minwid)
@ -711,7 +680,15 @@ require "heirline".setup(
{ {
statusline = StatusLines, statusline = StatusLines,
winbar = WinBars, winbar = WinBars,
tabline = TabLine tabline = TabLine,
opts = {
disable_winbar_cb = function(args)
local buf = args.buf
local buftype = vim.tbl_contains({"prompt", "nofile", "help", "quickfix"}, vim.bo[buf].buftype)
local filetype = vim.tbl_contains({"gitcommit", "fugitive", "Trouble", "packer"}, vim.bo[buf].filetype)
return buftype or filetype
end
}
} }
) )
vim.o.showtabline = 2 vim.o.showtabline = 2

View File

@ -1,36 +1,36 @@
require("nvim-web-devicons").set_icon { require("nvim-web-devicons").set_icon {
["test.ts"] = { ["test.ts"] = {
icon = "", icon = "",
color = "#519aba", color = "#519aba",
name = "TsTest" name = "TsTest"
}, },
["test.tsx"] = { ["test.tsx"] = {
icon = "", icon = "",
color = "#519aba", color = "#519aba",
name = "TsTest" name = "TsTest"
}, },
["test.js"] = { ["test.js"] = {
icon = "", icon = "",
color = "#cbcb41", color = "#cbcb41",
name = "JsTest" name = "JsTest"
}, },
["test.jsx"] = { ["test.jsx"] = {
icon = "", icon = "",
color = "#cbcb41", color = "#cbcb41",
name = "JsTest" name = "JsTest"
}, },
["readme.md"] = { ["readme.md"] = {
icon = "", icon = "",
color = "#42A5F5", color = "#42A5F5",
name = "Readme" name = "Readme"
}, },
["package.json"] = { ["package.json"] = {
icon = "", icon = "󰎙",
color = "#8BC34A", color = "#8BC34A",
name = "PackageJson" name = "PackageJson"
}, },
["package-lock.json"] = { ["package-lock.json"] = {
icon = "", icon = "󰎙",
color = "#8BC34A", color = "#8BC34A",
name = "PackageJson" name = "PackageJson"
}, },

View File

@ -3,7 +3,7 @@ local util = require "lspconfig.util"
vim.fn.sign_define("DiagnosticSignError", {text = "", texthl = "DiagnosticSignError"}) vim.fn.sign_define("DiagnosticSignError", {text = "", texthl = "DiagnosticSignError"})
vim.fn.sign_define("DiagnosticSignWarn", {text = "", texthl = "DiagnosticSignWarn"}) vim.fn.sign_define("DiagnosticSignWarn", {text = "", texthl = "DiagnosticSignWarn"})
vim.fn.sign_define("DiagnosticSignInfo", {text = "", texthl = "DiagnosticSignInfo"}) vim.fn.sign_define("DiagnosticSignInfo", {text = "", texthl = "DiagnosticSignInfo"})
vim.fn.sign_define("DiagnosticSignHint", {text = "", texthl = "DiagnosticSignHint"}) vim.fn.sign_define("DiagnosticSignHint", {text = "", texthl = "DiagnosticSignHint"})
vim.fn.sign_define("DapBreakpoint", {text = "", texthl = "DiagnosticSignError"}) vim.fn.sign_define("DapBreakpoint", {text = "", texthl = "DiagnosticSignError"})
vim.fn.sign_define("DapStopped", {text = "", texthl = "DiagnosticSignInfo"}) vim.fn.sign_define("DapStopped", {text = "", texthl = "DiagnosticSignInfo"})
@ -24,7 +24,8 @@ require("null-ls").setup(
diagnostic.severity = vim.diagnostic.severity["WARN"] diagnostic.severity = vim.diagnostic.severity["WARN"]
end end
} }
) ),
require("typescript.extensions.null-ls.code-actions")
} }
} }
) )
@ -32,7 +33,19 @@ require("null-ls").setup(
--- Languages --- Languages
require "lspconfig".html.setup {} require "lspconfig".html.setup {}
require "lspconfig".vimls.setup {} require "lspconfig".vimls.setup {}
require "lspconfig".yamlls.setup {} require "lspconfig".yamlls.setup {
settings = {
yaml = {
keyOrdering = false,
schemas = {
["https://raw.githubusercontent.com/instrumenta/kubernetes-json-schema/master/master/all.json"] = "/*.k8s.yaml",
["https://raw.githubusercontent.com/instrumenta/kubernetes-json-schema/master/master/all.json"] = "/*.k8s.yml",
["https://raw.githubusercontent.com/instrumenta/kubernetes-json-schema/master/master/all.json"] = "k8s/*.yaml",
["https://raw.githubusercontent.com/instrumenta/kubernetes-json-schema/master/master/all.json"] = "k8s/*.yml"
}
}
}
}
local nvim_lsp = require("lspconfig") local nvim_lsp = require("lspconfig")
@ -81,22 +94,37 @@ require "lspconfig".jsonls.setup {
capabilities = capabilities capabilities = capabilities
} }
require "lspconfig".tsserver.setup { -- require "lspconfig".tsserver.setup {
on_attach = function(client, bufnr) -- on_attach = function(client, bufnr)
local ts_utils = require("nvim-lsp-ts-utils") -- local ts_utils = require("nvim-lsp-ts-utils")
--
-- ts_utils.setup {
-- -- eslint_bin = "eslint_d",
-- eslint_enable_diagnostics = false
-- }
-- ts_utils.setup_client(client)
-- on_attach(client, bufnr)
-- end,
-- flags = {
-- debounce_text_changes = 300
-- },
-- capabilities = capabilities
-- }
ts_utils.setup { require("typescript").setup(
-- eslint_bin = "eslint_d", {
eslint_enable_diagnostics = false disable_commands = false, -- prevent the plugin from creating Vim commands
debug = false, -- enable debug logging for commands
go_to_source_definition = {
fallback = true -- fall back to standard LSP definition on failure
},
server = {
-- pass options to lspconfig's setup method
on_attach = on_attach,
capabilities = capabilities
} }
ts_utils.setup_client(client) }
on_attach(client, bufnr) )
end,
flags = {
debounce_text_changes = 150
},
capabilities = capabilities
}
require "lspconfig".eslint.setup { require "lspconfig".eslint.setup {
on_attach = on_attach, on_attach = on_attach,
@ -124,7 +152,7 @@ require "lspconfig".eslint.setup {
on_attach = on_attach, on_attach = on_attach,
cmd = {"java-language-server"} cmd = {"java-language-server"}
} ]] } ]]
local servers = {"pyright", "bashls", "clangd", "cssls", "texlab", "prismals"} local servers = {"pyright", "bashls", "clangd", "cssls", "texlab", "prismals", "solidity"}
for _, lsp in ipairs(servers) do for _, lsp in ipairs(servers) do
nvim_lsp[lsp].setup { nvim_lsp[lsp].setup {
on_attach = on_attach, on_attach = on_attach,

View File

@ -20,6 +20,38 @@ require "window-picker".setup(
require("neo-tree").setup( require("neo-tree").setup(
{ {
default_component_configs = {
icon = {
folder_empty = "󰜌",
folder_empty_open = "󰜌"
},
git_status = {
symbols = {
renamed = "󰁕",
unstaged = "󰄱"
}
}
},
document_symbols = {
kinds = {
File = {icon = "󰈙", hl = "Tag"},
Namespace = {icon = "󰌗", hl = "Include"},
Package = {icon = "󰏖", hl = "Label"},
Class = {icon = "󰌗", hl = "Include"},
Property = {icon = "󰆧", hl = "@property"},
Enum = {icon = "󰒻", hl = "@number"},
Function = {icon = "󰊕", hl = "Function"},
String = {icon = "󰀬", hl = "String"},
Number = {icon = "󰎠", hl = "Number"},
Array = {icon = "󰅪", hl = "Type"},
Object = {icon = "󰅩", hl = "Type"},
Key = {icon = "󰌋", hl = ""},
Struct = {icon = "󰌗", hl = "Type"},
Operator = {icon = "󰆕", hl = "Operator"},
TypeParameter = {icon = "󰊄", hl = "Type"},
StaticMethod = {icon = "󰠄 ", hl = "Function"}
}
},
close_if_last_window = true, -- Close Neo-tree if it is the last window left in the tab close_if_last_window = true, -- Close Neo-tree if it is the last window left in the tab
popup_border_style = "rounded", popup_border_style = "rounded",
enable_git_status = true, enable_git_status = true,
@ -74,7 +106,7 @@ require("neo-tree").setup(
modified = "", -- or "", but this is redundant info if you use git_status_colors on the name modified = "", -- or "", but this is redundant info if you use git_status_colors on the name
deleted = "", deleted = "",
-- this can only be used in the git_status source -- this can only be used in the git_status source
renamed = "", renamed = "󰁕",
-- this can only be used in the git_status source -- this can only be used in the git_status source
-- Status type -- Status type
untracked = "", untracked = "",
@ -196,7 +228,22 @@ require("neo-tree").setup(
}, },
source_selector = { source_selector = {
winbar = true, winbar = true,
statusline = false statusline = false,
sources = {
-- table
{
source = "filesystem", -- string
display_name = " 󰉓 Files" -- string | nil
},
{
source = "buffers", -- string
display_name = " 󰈙 Buffers" -- string | nil
},
{
source = "git_status", -- string
display_name = " 󰊢 Git" -- string | nil
}
}
} }
} }
) )

View File

@ -26,4 +26,5 @@ local keymap = vim.api.nvim_set_keymap
keymap("n", "<leader>tf", ':lua require("neotest").run.run(vim.fn.expand("%"))<CR>', {silent = true, noremap = true}) keymap("n", "<leader>tf", ':lua require("neotest").run.run(vim.fn.expand("%"))<CR>', {silent = true, noremap = true})
keymap("n", "<leader>tn", ':lua require("neotest").run.run()<CR>', {silent = true}) keymap("n", "<leader>tn", ':lua require("neotest").run.run()<CR>', {silent = true})
keymap("n", "<leader>tr", ':lua require("neotest").run.run()<CR>', {silent = true})
keymap("n", "<leader>td", ':lua require("neotest").output.open({enter=true,short=true})<CR>', {silent = true}) keymap("n", "<leader>td", ':lua require("neotest").output.open({enter=true,short=true})<CR>', {silent = true})