config refactor in progress

This commit is contained in:
Maciej Lebiest 2023-02-12 10:18:25 +01:00
parent 9f472d1536
commit 94fd2627b9
10 changed files with 112 additions and 179 deletions

View file

@ -1,26 +0,0 @@
require("mason").setup()
require("mason-lspconfig").setup({
ensure_installed = {
"bashls",
"pyright",
"pylsp",
"ruff_lsp",
--"python-jedi-server",
--"pyre",
"perlnavigator",
"dockerls",
--"kotlin_language_server",
"intelephense",
"eslint",
"tsserver",
"cssls",
"cssmodules_ls",
"diagnosticls",
"jsonls",
"sumneko_lua",
"sqlls",
"yamlls",
"lemminx",
"marksman"
}
})

View file

@ -1,47 +0,0 @@
require("trouble").setup({
position = "bottom", -- position of the list can be: bottom, top, left, right
height = 10, -- height of the trouble list when position is top or bottom
width = 50, -- width of the list when position is left or right
icons = true, -- use devicons for filenames
mode = "workspace_diagnostics", -- "workspace_diagnostics", "document_diagnostics", "quickfix", "lsp_references", "loclist"
fold_open = "", -- icon used for open folds
fold_closed = "", -- icon used for closed folds
group = true, -- group results by file
padding = true, -- add an extra new line on top of the list
action_keys = { -- key mappings for actions in the trouble list
-- map to {} to remove a mapping, for example:
-- close = {},
close = "q", -- close the list
cancel = "<esc>", -- cancel the preview and get back to your last window / buffer / cursor
refresh = "r", -- manually refresh
jump = {"<cr>", "<tab>"}, -- jump to the diagnostic or open / close folds
open_split = { "<c-x>" }, -- open buffer in new split
open_vsplit = { "<c-v>" }, -- open buffer in new vsplit
open_tab = { "<c-t>" }, -- open buffer in new tab
jump_close = {"o"}, -- jump to the diagnostic and close the list
toggle_mode = "m", -- toggle between "workspace" and "document" diagnostics mode
toggle_preview = "P", -- toggle auto_preview
hover = "K", -- opens a small popup with the full multiline message
preview = "p", -- preview the diagnostic location
close_folds = {"zM", "zm"}, -- close all folds
open_folds = {"zR", "zr"}, -- open all folds
toggle_fold = {"zA", "za"}, -- toggle fold of current file
previous = "k", -- previous item
next = "j" -- next item
},
indent_lines = true, -- add an indent guide below the fold icons
auto_open = false, -- automatically open the list when you have diagnostics
auto_close = false, -- automatically close the list when you have no diagnostics
auto_preview = true, -- automatically preview the location of the diagnostic. <esc> to close preview and go back to last window
auto_fold = false, -- automatically fold a file trouble list at creation
auto_jump = {"lsp_definitions"}, -- for the given modes, automatically jump if there is only a single result
signs = {
-- icons / text used for a diagnostic
error = "",
warning = "",
hint = "",
information = "",
other = ""
},
use_diagnostic_signs = false -- enabling this will use the signs defined in your lsp client
})

View file

@ -1,18 +1,3 @@
require("scrollbar").setup()
-- setup minimap
local codewindow = require('codewindow')
codewindow.setup({
minimap_width = 20, -- The width of the text part of the minimap
width_multiplier = 4, -- How many characters one dot represents
use_lsp = true, -- Use the builtin LSP to show errors and warnings
use_treesitter = true, -- Use nvim-treesitter to highlight the code
show_cursor = true,
exclude_filetypes = {}, -- Choose certain filetypes to not show minimap on
z_index = 1, -- The z-index the floating window will be on
})
codewindow.apply_default_keybinds()
local function open_nvim_tree()
-- open the tree

View file

@ -11,15 +11,12 @@ if not vim.loop.fs_stat(lazypath) then
end
vim.opt.rtp:prepend(lazypath)
-- load all modules
vim.g.mapleader = "\\"
require("lazy-setup")
require("general")
require("my-lint")
require("conf-trouble")
require("conf-hlslens")
require("conf-gitsigns")
require("conf-lualine")
require("conf-mason")
require("conf-nvim-cmp")
require("conf-nvim-tree")
require("conf-bufferline")

View file

@ -4,7 +4,7 @@ require("lazy").setup({
{ 'nvim-tree/nvim-tree.lua',
keys = {
{ "<leader>n", "<cmd>NvimTreeFocus<cr>" },
{ "<C-t>", "<cmd>NvimTreeToggle<cr>" }
{ "<C-t>", "<cmd>NvimTreeToggle<cr>" }
} },
-- neovim lsp plugins and depencencies
@ -14,29 +14,31 @@ require("lazy").setup({
{ 'hrsh7th/cmp-cmdline' },
{ 'hrsh7th/cmp-path' },
{ 'hrsh7th/nvim-cmp' },
{ 'williamboman/mason.nvim' },
{ 'williamboman/mason-lspconfig.nvim' },
{ 'williamboman/mason.nvim',
config = {} },
{ 'williamboman/mason-lspconfig.nvim',
config = require('plugins.mason-lspconfig').config,
dependencies = { 'williamboman/mason.nvim' } },
{ 'mfussenegger/nvim-lint' },
{ 'onsails/lspkind.nvim' },
{ 'folke/trouble.nvim',
keys = {
{ "<leader>xx", "<cmd>TroubleToggle<cr>" },
{ "<leader>xw", "<cmd>TroubleToggle workspace_diagnostics<cr>" },
{ "<leader>xd", "<cmd>TroubleToggle document_diagnostics<cr>" },
{ "<leader>xl", "<cmd>TroubleToggle loclist<cr>" },
{ "<leader>xq", "<cmd>TroubleToggle quickfix<cr>" },
{ "gR", "<cmd>TroubleToggle lsp_references<cr>" }
} },
config = require('plugins.trouble').config,
keys = require("plugins.trouble").keys
},
-- various plugins
{ 'lewis6991/gitsigns.nvim' },
{ 'petertriho/nvim-scrollbar' },
{ 'petertriho/nvim-scrollbar',
config = {} },
{ 'kevinhwang91/nvim-hlslens' },
{ 'L3MON4D3/LuaSnip', version = '*' },
{ 'saadparwaiz1/cmp_luasnip' },
{ 'lambdalisue/suda.vim' },
{ 'akinsho/bufferline.nvim', version = '*' },
{ 'gorbit99/codewindow.nvim' },
{ 'gorbit99/codewindow.nvim',
config = require('plugins.codewindow').config,
init = require('plugins.codewindow').build
},
{ 'preservim/nerdcommenter',
keys = {
{ "<c-/>", "<plug>NERDCommenterToggle", mode = "v" },
@ -50,8 +52,8 @@ require("lazy").setup({
{ 'lukas-reineke/indent-blankline.nvim' },
{ 'MunifTanjim/nui.nvim' },
{ 'folke/noice.nvim',
config = require("plugins.noice").config,
dependencies = {
config = require("config-noice").config,
"MunifTanjim/nui.nvim",
-- OPTIONAL:
-- `nvim-notify` is only needed, if you want to use the notification view.
@ -61,7 +63,6 @@ require("lazy").setup({
{ 'nvim-lualine/lualine.nvim' },
{ 'RRethy/vim-illuminate' },
{ 'sheerun/vim-polyglot' },
--{ 'ray-x/lsp_signature.nvim' },
-- themes
{ 'olimorris/onedarkpro.nvim' },

View file

@ -36,67 +36,6 @@ end
local capabilities = require('cmp_nvim_lsp').default_capabilities()
-- config for ray-x/lsp_signature.nvim
--local cfg = {
--debug = false, -- set to true to enable debug logging
--log_path = vim.fn.stdpath("cache") .. "/lsp_signature.log", -- log dir when debug is on
---- default is ~/.cache/nvim/lsp_signature.log
--verbose = false, -- show debug line number
--bind = true, -- This is mandatory, otherwise border config won't get registered.
---- If you want to hook lspsaga or other signature handler, pls set to false
--doc_lines = 10, -- will show two lines of comment/doc(if there are more than two lines in doc, will be truncated);
---- set to 0 if you DO NOT want any API comments be shown
---- This setting only take effect in insert mode, it does not affect signature help in normal
---- mode, 10 by default
--max_height = 12, -- max height of signature floating_window
--max_width = 80, -- max_width of signature floating_window
--noice = false, -- set to true if you using noice to render markdown
--wrap = true, -- allow doc/signature text wrap inside floating_window, useful if your lsp return doc/sig is too long
--floating_window = true, -- show hint in a floating window, set to false for virtual text only mode
--floating_window_above_cur_line = true, -- try to place the floating above the current line when possible Note:
---- will set to true when fully tested, set to false will use whichever side has more space
---- this setting will be helpful if you do not want the PUM and floating win overlap
--floating_window_off_x = 1, -- adjust float windows x position.
--floating_window_off_y = 0, -- adjust float windows y position. e.g -2 move window up 2 lines; 2 move down 2 lines
---- can be either number or function, see examples
--close_timeout = 4000, -- close floating window after ms when laster parameter is entered
--fix_pos = false, -- set to true, the floating window will not auto-close until finish all parameters
--hint_enable = true, -- virtual hint enable
--hint_prefix = "🐼 ", -- Panda for parameter, NOTE: for the terminal not support emoji, might crash
--hint_scheme = "String",
--hi_parameter = "LspSignatureActiveParameter", -- how your parameter will be highlight
--handler_opts = {
--border = "rounded" -- double, rounded, single, shadow, none, or a table of borders
--},
--always_trigger = false, -- sometime show signature on new line or in middle of parameter can be confusing, set it to false for #58
--auto_close_after = nil, -- autoclose signature float win after x sec, disabled if nil.
--extra_trigger_chars = {}, -- Array of extra characters that will trigger signature completion, e.g., {"(", ","}
--zindex = 200, -- by default it will be on top of all floating windows, set to <= 50 send it to bottom
--padding = '', -- character to pad on left and right of signature can be ' ', or '|' etc
--transparency = nil, -- disabled by default, allow floating win transparent value 1~100
--shadow_blend = 36, -- if you using shadow as border use this set the opacity
--shadow_guibg = 'Black', -- if you using shadow as border use this set the color e.g. 'Green' or '#121315'
--timer_interval = 200, -- default timer check interval set to lower value if you want to reduce latency
--toggle_key = nil, -- toggle signature on and off in insert mode, e.g. toggle_key = '<M-x>'
--select_signature_key = nil, -- cycle to next signature, e.g. '<M-n>' function overloading
--move_cursor_key = nil, -- imap, use nvim_set_current_win to move cursor between current win and floating
--}
---- recommended:
--require 'lsp_signature'.setup(cfg) -- no need to specify bufnr if you don't use toggle_key
-----------------
-- attaching all lsp servers, order matters (for example in autocompletion)
-----------------
@ -162,14 +101,6 @@ require 'lspconfig'.pyright.setup {
on_attach = on_attach,
capabilities = capabilities,
}
--require'lspconfig'.jedi_language_server.setup{
--on_attach = on_attach,
--capabilities = capabilities,
--}
--require 'lspconfig'.pyre.setup {
--on_attach = on_attach,
--capabilities = capabilities,
--}
require 'lspconfig'.sourcekit.setup {
on_attach = on_attach,
capabilities = capabilities,
@ -182,10 +113,6 @@ require 'lspconfig'.dockerls.setup {
on_attach = on_attach,
capabilities = capabilities,
}
--require 'lspconfig'.kotlin_language_server.setup {
--on_attach = on_attach,
--capabilities = capabilities,
--}
require 'lspconfig'.intelephense.setup {
on_attach = on_attach,
capabilities = capabilities,

View file

@ -0,0 +1,14 @@
return {
config = {
minimap_width = 20, -- The width of the text part of the minimap
width_multiplier = 4, -- How many characters one dot represents
use_lsp = true, -- Use the builtin LSP to show errors and warnings
use_treesitter = true, -- Use nvim-treesitter to highlight the code
show_cursor = true,
exclude_filetypes = {}, -- Choose certain filetypes to not show minimap on
z_index = 1, -- The z-index the floating window will be on
},
build = function ()
require("codewindow").apply_default_keybinds()
end
}

View file

@ -0,0 +1,25 @@
return {
config = {
ensure_installed = {
"bashls",
"pyright",
"pylsp",
"ruff_lsp",
--"pyre",
"perlnavigator",
"dockerls",
"intelephense",
"eslint",
"tsserver",
"cssls",
"cssmodules_ls",
"diagnosticls",
"jsonls",
"sumneko_lua",
"sqlls",
"yamlls",
"lemminx",
"marksman"
}
}
}

57
lua/plugins/trouble.lua Normal file
View file

@ -0,0 +1,57 @@
return {
keys = {
{ "<leader>xx", "<cmd>TroubleToggle<cr>" },
{ "<leader>xw", "<cmd>TroubleToggle workspace_diagnostics<cr>" },
{ "<leader>xd", "<cmd>TroubleToggle document_diagnostics<cr>" },
{ "<leader>xl", "<cmd>TroubleToggle loclist<cr>" },
{ "<leader>xq", "<cmd>TroubleToggle quickfix<cr>" },
{ "gR", "<cmd>TroubleToggle lsp_references<cr>" }
},
config = {
position = "bottom", -- position of the list can be: bottom, top, left, right
height = 10, -- height of the trouble list when position is top or bottom
width = 50, -- width of the list when position is left or right
icons = true, -- use devicons for filenames
mode = "workspace_diagnostics", -- "workspace_diagnostics", "document_diagnostics", "quickfix", "lsp_references", "loclist"
fold_open = "", -- icon used for open folds
fold_closed = "", -- icon used for closed folds
group = true, -- group results by file
padding = true, -- add an extra new line on top of the list
action_keys = { -- key mappings for actions in the trouble list
-- map to {} to remove a mapping, for example:
-- close = {},
close = "q", -- close the list
cancel = "<esc>", -- cancel the preview and get back to your last window / buffer / cursor
refresh = "r", -- manually refresh
jump = { "<cr>", "<tab>" }, -- jump to the diagnostic or open / close folds
open_split = { "<c-x>" }, -- open buffer in new split
open_vsplit = { "<c-v>" }, -- open buffer in new vsplit
open_tab = { "<c-t>" }, -- open buffer in new tab
jump_close = { "o" }, -- jump to the diagnostic and close the list
toggle_mode = "m", -- toggle between "workspace" and "document" diagnostics mode
toggle_preview = "P", -- toggle auto_preview
hover = "K", -- opens a small popup with the full multiline message
preview = "p", -- preview the diagnostic location
close_folds = { "zM", "zm" }, -- close all folds
open_folds = { "zR", "zr" }, -- open all folds
toggle_fold = { "zA", "za" }, -- toggle fold of current file
previous = "k", -- previous item
next = "j" -- next item
},
indent_lines = true, -- add an indent guide below the fold icons
auto_open = false, -- automatically open the list when you have diagnostics
auto_close = false, -- automatically close the list when you have no diagnostics
auto_preview = true, -- automatically preview the location of the diagnostic. <esc> to close preview and go back to last window
auto_fold = false, -- automatically fold a file trouble list at creation
auto_jump = { "lsp_definitions" }, -- for the given modes, automatically jump if there is only a single result
signs = {
-- icons / text used for a diagnostic
error = "",
warning = "",
hint = "",
information = "",
other = ""
},
use_diagnostic_signs = false -- enabling this will use the signs defined in your lsp client
}
}