From 6caa743f37e5a89379885048c4e623214a391d31 Mon Sep 17 00:00:00 2001 From: fiplox Date: Sat, 8 Apr 2023 23:47:10 +0200 Subject: [PATCH] feat!: rework config --- ftplugin/rust.lua | 8 +- init.lua | 18 +- java-format.xml | 338 --------------------------------- lua/config/autocmd.lua | 36 +++- lua/config/lazy.lua | 14 +- lua/config/mappings.lua | 21 +- lua/config/settings.lua | 60 ++---- lua/plugins/cmp.lua | 77 ++++---- lua/plugins/feline.lua | 9 +- lua/plugins/init.lua | 12 +- lua/plugins/lsp/init.lua | 30 ++- lua/plugins/mason-nvim-dap.lua | 47 ----- lua/plugins/mason.lua | 9 +- lua/plugins/null-ls.lua | 10 - lua/plugins/nvim-dap.lua | 145 -------------- lua/plugins/theme.lua | 39 +--- lua/plugins/toggleterm.lua | 17 +- lua/plugins/tresitter.lua | 37 ++-- lua/plugins/trouble.lua | 2 +- 19 files changed, 158 insertions(+), 771 deletions(-) delete mode 100644 java-format.xml delete mode 100644 lua/plugins/mason-nvim-dap.lua delete mode 100644 lua/plugins/nvim-dap.lua diff --git a/ftplugin/rust.lua b/ftplugin/rust.lua index 31c9206..f9c8d26 100644 --- a/ftplugin/rust.lua +++ b/ftplugin/rust.lua @@ -3,6 +3,12 @@ local capabilities = vim.lsp.protocol.make_client_capabilities() capabilities.textDocument.completion.completionItem.snippetSupport = true capabilities = cmp_nvim_lsp.default_capabilities(capabilities) +local function has_formatter(ft) + local sources = require 'null-ls.sources' + local available = sources.get_available(ft, 'NULL_LS_FORMATTING') + return #available > 0 +end + local function lsp_keymaps(bufnr) local opt = { noremap = true, silent = true } local keymap = vim.api.nvim_buf_set_keymap @@ -31,7 +37,7 @@ local on_attach = function(client, bufnr) local nls = require 'plugins.null-ls' local enable = false - if nls.has_formatter(ft) then + if has_formatter(ft) then enable = client.name == 'null-ls' else enable = not (client.name == 'null-ls') diff --git a/init.lua b/init.lua index 936d706..025e607 100644 --- a/init.lua +++ b/init.lua @@ -1,3 +1,4 @@ +vim.loader.enable() local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' if not vim.loop.fs_stat(lazypath) then vim.fn.system { @@ -6,21 +7,20 @@ if not vim.loop.fs_stat(lazypath) then '--filter=blob:none', '--single-branch', 'https://github.com/folke/lazy.nvim.git', - lazypath, + lazypath, } end vim.opt.runtimepath:prepend(lazypath) - -require 'config.settings' -require 'config.lazy' - vim.api.nvim_create_autocmd('User', { - pattern = 'VeryLazy', + pattern = 'LazyVimStarted', callback = function() - require 'config.autocmd' - require 'config.mappings' + require 'config.mappings' + require 'config.autocmd' + require 'feline' + require 'nvim-treesitter' end, }) --- vim.o.background = 'dark' +require 'config.settings' +require 'config.lazy' vim.cmd 'colorscheme neogruber' diff --git a/java-format.xml b/java-format.xml deleted file mode 100644 index 3b06ff5..0000000 --- a/java-format.xml +++ /dev/null @@ -1,338 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/lua/config/autocmd.lua b/lua/config/autocmd.lua index 5d66bc8..978bfe7 100644 --- a/lua/config/autocmd.lua +++ b/lua/config/autocmd.lua @@ -1,7 +1,9 @@ -- vim.api.nvim_set_hl(0, 'NormalFloat', { bg = '#282828' }) --- vim.api.nvim_set_hl(0, 'FloatBorder', { bg = 'NONE' }) --- vim.api.nvim_set_hl(0, 'Pmenu', { bg = 'NONE' }) +-- vim.api.nvim_set_hl(0, 'FloatBorder', { bg = 'NONE' }) vim.api.nvim_set_hl(0, 'Pmenu', { bg = 'NONE' }) -- vim.api.nvim_set_hl(0, 'StatusLine', { bg = 'NONE' }) +local function augroup(name) + return vim.api.nvim_create_augroup('neo_' .. name, { clear = true }) +end -- Use 'q' to quit from common plugins vim.api.nvim_create_autocmd({ 'FileType' }, { @@ -24,8 +26,6 @@ vim.api.nvim_create_autocmd({ 'FileType' }, { end, }) -vim.cmd "autocmd BufEnter * ++nested if winnr('$') == 1 && bufname() == 'NvimTree_' . tabpagenr() | quit | endif" - -- Fixes Autocomment vim.api.nvim_create_autocmd({ 'BufWinEnter' }, { callback = function() @@ -49,4 +49,32 @@ vim.api.nvim_create_autocmd({ 'DiagnosticChanged' }, { end, }) +-- resize splits if window got resized +vim.api.nvim_create_autocmd({ 'VimResized' }, { + group = augroup 'resize_splits', + callback = function() + vim.cmd 'tabdo wincmd =' + end, +}) + +-- wrap and check for spell in text filetypes +vim.api.nvim_create_autocmd('FileType', { + group = augroup 'wrap_spell', + pattern = { 'gitcommit', 'markdown' }, + callback = function() + vim.opt_local.wrap = true + vim.opt_local.spell = true + end, +}) +function ToggleTroubleAuto() + local ok, trouble = pcall(require, 'trouble') + if ok then + vim.defer_fn(function() + vim.cmd 'cclose' + trouble.open 'quickfix' + end, 0) + end +end + +-- vim.cmd "autocmd VimLeave * call os.execute("mkdir /tmp/nvim"), writefile([getcwd()], expand('/tmp/nvim/cwd'))" vim.cmd [[autocmd BufWinEnter quickfix silent :lua ToggleTroubleAuto()]] diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua index adedd8d..5ec931f 100644 --- a/lua/config/lazy.lua +++ b/lua/config/lazy.lua @@ -1,31 +1,23 @@ require('lazy').setup('plugins', { defaults = { lazy = true }, - checker = { enabled = false }, - diff = { - cmd = 'terminal_git', - }, change_detection = { enabled = false, }, performance = { - cache = { - enabled = true, - -- disable_events = {}, - }, rtp = { reset = true, - paths = { '~/.local/share/nvim/site/' }, + -- paths = { '~/.local/share/nvim/site/' }, disabled_plugins = { + 'fzf', 'gzip', 'matchit', - -- "matchparen", + 'matchparen', 'netrwPlugin', 'netrw', 'tarPlugin', 'tohtml', 'tutor', 'zipPlugin', - 'nvim-treesitter-textobjects', }, }, }, diff --git a/lua/config/mappings.lua b/lua/config/mappings.lua index 6c1bed8..d29724f 100644 --- a/lua/config/mappings.lua +++ b/lua/config/mappings.lua @@ -1,7 +1,5 @@ --- Set leader {{{ -vim.api.nvim_set_keymap('n', '', '', { noremap = true, silent = true }) -vim.g.mapleader = ' ' --- }}} +-- TODO: Remove this +vim.api.nvim_set_keymap('n', '', 'Lazy profile', { noremap = true, silent = true }) -- resize {{{ vim.api.nvim_set_keymap('n', '', 'resize -2', { noremap = true, silent = true }) vim.api.nvim_set_keymap('n', '', 'resize +2', { noremap = true, silent = true }) @@ -16,7 +14,6 @@ vim.api.nvim_set_keymap('v', '>', '>gv', { noremap = true, silent = true }) vim.api.nvim_set_keymap('n', '', "@=(foldlevel('.')?'za':\"\")", { noremap = true, silent = true }) -- }}} -- terminal {{{ -vim.api.nvim_set_keymap('n', '', 'Lazy profile', { noremap = true, silent = true }) vim.api.nvim_set_keymap('n', '', 'ToggleTerm direction=horizontal', { noremap = true, silent = true }) vim.api.nvim_set_keymap('t', '', 'ToggleTerm direction=horizontal', { noremap = true, silent = true }) vim.api.nvim_set_keymap('v', '', 'ToggleTerm direction=horizontal', { noremap = true, silent = true }) @@ -26,20 +23,6 @@ vim.api.nvim_set_keymap('t', '', 'ToggleTerm direction=vertical', vim.api.nvim_set_keymap('v', '', 'ToggleTerm direction=vertical', { noremap = true, silent = true }) vim.api.nvim_set_keymap('i', '', 'ToggleTerm direction=vertical', { noremap = true, silent = true }) -- }}} --- misc {{{ -vim.api.nvim_set_keymap('v', '', '"_dp', { noremap = true, silent = true }) -vim.api.nvim_set_keymap('x', 'E', ":move '<-2gv-gv", { noremap = true, silent = true }) -vim.api.nvim_set_keymap('x', 'N', ":move '>+1gv-gv", { noremap = true, silent = true }) -vim.api.nvim_set_keymap('n', '', 'z=1', { noremap = true, silent = true }) --- vim.api.nvim_set_keymap( --- 'n', --- 'lf', --- 'lua vim.lsp.buf.format { async = true }', --- { noremap = true, silent = true } --- ) - --- }}} --- vim.api.nvim_set_keymap("n", "", "", { noremap = true, silent = true }) vim.api.nvim_set_keymap('n', '', ':', { noremap = true }) vim.api.nvim_set_keymap('n', ';', ':', { noremap = true }) diff --git a/lua/config/settings.lua b/lua/config/settings.lua index c5bfb37..7e3dd82 100644 --- a/lua/config/settings.lua +++ b/lua/config/settings.lua @@ -1,37 +1,20 @@ local g = vim.g local opt = vim.opt -local function add(value, str, sep) - sep = sep or ',' - str = str or '' - value = type(value) == 'table' and table.concat(value, sep) or value - return str ~= '' and table.concat({ value, str }, sep) or value -end --- Globals {{{ -g.netrw_liststyle = 1 -g.netrw_banner = 0 -g.netrw_list_hide = '^\\..*' g.mapleader = ' ' g.tex_flavor = 'latex' g.c_syntax_for_h = true --- }}} --- Opts {{{ --- opt.formatoptions = "" -opt.wildoptions = 'tagfile' ---opt.wildchar = 'c' + +--opt.wildoptions = true -- TODO: see how it works opt.termguicolors = true -opt.guifont = 'JetBrainsMono Nerd Font' opt.guicursor = 'n-v-c-sm:hor20,i-ci-ve:ver20,r-cr-o:Block' opt.mouse = 'nv' opt.path = '.,,**h' -opt.pumheight = 10 +-- opt.pumheight = 10 -- TODO: probably to change opt.fileencoding = 'utf-8' opt.splitbelow = true opt.splitright = true --- opt.ts = 4 --- opt.sw = 4 -opt.smartindent = false ---opt.expandtab " Converts tabs to spaces +opt.smartindent = false -- TODO: maybe? opt.showmode = false opt.undofile = true opt.updatetime = 300 @@ -39,44 +22,24 @@ opt.backup = false opt.clipboard:prepend { 'unnamedplus' } opt.smartcase = true opt.cursorline = true -opt.viewoptions = 'folds,cursor' opt.sessionoptions = 'folds' opt.foldmethod = 'marker' opt.foldlevel = 0 opt.number = true opt.hidden = true --- opt.shortmess = add { 'I' } -- Don't pass messages to ins-completion-menu. opt.shortmess:append('I', 'W', 's') -opt.cmdheight = 1 -opt.scrolloff = 15 +-- opt.scrolloff = 15 -- TODO: maybe ? opt.iskeyword:prepend { '-' } opt.inccommand = 'nosplit' -opt.completeopt = { 'menu', 'menuone', 'noselect' } +opt.completeopt:append 'menuone' opt.timeoutlen = 300 opt['foldenable'] = false --- opt.fillchars = 'vert:▏' -opt.fillchars.eob = ' ' --- opt.fillchars.vert="▏" -opt.sessionoptions = add { 'options', 'resize', 'winpos', 'terminal' } -opt.autochdir = false --- }}} --- Commands and autocommands {{{ -vim.api.nvim_create_user_command('Pdf', '!pandoc % -o %:r.pdf', { nargs = 0 }) -vim.api.nvim_create_user_command('Slide', '!pandoc -t beamer % -o %:r.pdf', { nargs = 0 }) -vim.api.nvim_create_user_command('Cd', 'lcd %:p:h', { nargs = 0 }) +opt.fillchars = 'eob: ' +opt.cmdheight = 1 +opt.grepprg = 'rg --vimgrep --no-heading --smart-case' +-- opt.autochdir = true --- vim.api.nvim_create_autocmd({ 'BufWinLeave', 'BufLeave', 'WinLeave' }, { pattern = { '?*' }, command = 'mkview' }) --- vim.api.nvim_create_autocmd({ 'BufWinEnter' }, { pattern = { '?*' }, command = 'silent! loadview' }) --- }}} -function ToggleTroubleAuto() - local ok, trouble = pcall(require, 'trouble') - if ok then - vim.defer_fn(function() - vim.cmd 'cclose' - trouble.open 'quickfix' - end, 0) - end -end +vim.api.nvim_create_user_command('Cd', 'lcd %:p:h', { nargs = 0 }) local ignore_buftype = { 'quickfix', 'nofile', 'help' } local ignore_filetype = { 'gitcommit', 'gitrebase', 'svn', 'hgcommit' } @@ -95,6 +58,7 @@ local function run() -- If a line has already been specified on the command line, we are done -- nvim file +num if vim.fn.line '.' > 1 then + vim.cmd [[normal! zz]] return end diff --git a/lua/plugins/cmp.lua b/lua/plugins/cmp.lua index 5b89513..d22091f 100644 --- a/lua/plugins/cmp.lua +++ b/lua/plugins/cmp.lua @@ -9,19 +9,41 @@ local M = { 'hrsh7th/cmp-buffer', 'hrsh7th/cmp-cmdline', 'hrsh7th/cmp-path', - 'hrsh7th/cmp-calc', }, event = { 'InsertEnter', 'CmdlineEnter' }, + version = false, } function M.config() + local kind_icons = { + Text = '', + Method = '', + Function = '', + Constructor = '', + Field = '', + Variable = '', + Class = 'ﴯ', + Interface = '', + Module = '', + Property = 'ﰠ', + Unit = '', + Value = '', + Enum = '', + Keyword = '', + Snippet = '', + Color = '', + File = '', + Reference = '', + Folder = '', + EnumMember = '', + Constant = '', + Struct = '', + Event = '', + Operator = '', + TypeParameter = '', + } local cmp = require 'cmp' - local ELLIPSIS_CHAR = '…' - local MAX_LABEL_WIDTH = 20 - - --[[ local winhighlight = 'NormalFloat:Pmenu,NormalFloat:Pmenu,CursorLine:PmenuSel,Search:None' ]] - local has_words_before = function() local line, col = unpack(vim.api.nvim_win_get_cursor(0)) return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match '%s' == nil @@ -38,7 +60,8 @@ function M.config() }, }, completion = { - autocomplete = false, + autocomplete = { 'TextChanged', 'CmdlineChanged', 'TextChangedP' }, + -- autocomplete = false, }, snippet = { expand = function(args) @@ -46,14 +69,6 @@ function M.config() end, }, window = { - --[[ completion = { - border = 'rounded', - winhighlight = winhighlight, - }, - documentation = { - border = 'rounded', - winhighlight = winhighlight, - }, ]] completion = cmp.config.window.bordered(), documentation = cmp.config.window.bordered(), }, @@ -62,20 +77,8 @@ function M.config() }, formatting = { fields = { 'menu', 'abbr', 'kind' }, - format = function(entry, item) - local menu_icon = { - nvim_lsp = 'λ', - snippy = '⋗', - buffer = 'Ω', - path = '🖫', - } - - item.menu = menu_icon[entry.source.name] - local label = item.abbr - local truncated_label = vim.fn.strcharpart(label, 0, MAX_LABEL_WIDTH) - if truncated_label ~= label then - item.abbr = truncated_label .. ELLIPSIS_CHAR - end + format = function(_, item) + item.kind = string.format('%s %s', kind_icons[item.kind], item.kind) -- This concatonates the icons with the name of the item kind return item end, }, @@ -92,7 +95,7 @@ function M.config() [''] = cmp.mapping.confirm { select = true }, [''] = cmp.mapping(function(fallback) if cmp.visible() then - cmp.select_next_item { behavior = cmp.SelectBehavior.Insert } + cmp.select_next_item { behavior = cmp.SelectBehavior.Select } elseif require('snippy').can_expand_or_advance() then require('snippy').expand_or_advance() elseif has_words_before() then @@ -117,7 +120,6 @@ function M.config() { name = 'snippy' }, { name = 'path' }, { name = 'buffer' }, - { name = 'calc' }, }, } cmp.setup.cmdline(':', { @@ -126,20 +128,19 @@ function M.config() sources = { { name = 'cmdline' }, { name = 'path' }, - { name = 'calc' }, - }, - view = { - entries = { name = 'wildmenu', separator = ' · ' }, }, + -- view = { + -- entries = { name = 'wildmenu', separator = ' · ' }, + -- }, }) cmp.setup.cmdline('/', { sources = { { name = 'buffer' }, }, - view = { - entries = { name = 'wildmenu', separator = ' · ' }, - }, + -- view = { + -- entries = { name = 'wildmenu', separator = ' · ' }, + -- }, }) cmp.setup.filetype({ 'dap-repl', 'dapui_watches', 'dapui_hover' }, { diff --git a/lua/plugins/feline.lua b/lua/plugins/feline.lua index ffbcf5c..fbbc0ab 100644 --- a/lua/plugins/feline.lua +++ b/lua/plugins/feline.lua @@ -1,10 +1,11 @@ local M = { 'feline-nvim/feline.nvim', -- lazy = false - event = 'UIEnter', - -- dependencies = { - -- 'nvim-tree/nvim-web-devicons', - -- }, + -- event = 'UIEnter', + -- event = 'VeryLazy', + dependencies = { + 'nvim-tree/nvim-web-devicons', + }, } function M.config() diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index b1c215a..b4cc246 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -1,16 +1,17 @@ return { - 'nvim-lua/plenary.nvim', 'folke/which-key.nvim', + 'nvim-lua/plenary.nvim', 'mfussenegger/nvim-jdtls', + 'simrat39/rust-tools.nvim', + -- 'MunifTanjim/nui.nvim', + -- 'rcarriga/cmp-dap', { - 'phaazon/hop.nvim', - -- event = 'BufRead', + 'phaazon/hop.nvim', -- event = 'BufRead', keys = { { 's', ':HopChar2' }, { 'S', ':HopWord' } }, config = function() require('hop').setup() end, }, - 'rcarriga/cmp-dap', { 'stevearc/dressing.nvim', lazy = true, @@ -32,7 +33,4 @@ return { } end, }, - { 'nvim-tree/nvim-web-devicons', lazy = true }, - 'simrat39/rust-tools.nvim', - -- { 'dstein64/vim-startuptime', lazy = false }, } diff --git a/lua/plugins/lsp/init.lua b/lua/plugins/lsp/init.lua index 9935fda..8dc7900 100644 --- a/lua/plugins/lsp/init.lua +++ b/lua/plugins/lsp/init.lua @@ -1,10 +1,17 @@ local M = { 'neovim/nvim-lspconfig', name = 'lsp', - event = 'BufRead', - dependencies = { 'hrsh7th/cmp-nvim-lsp', 'williamboman/mason.nvim', 'williamboman/mason-lspconfig.nvim' }, + event = { 'BufRead', 'BufNewFile' }, + -- lazy = false, + dependencies = { 'hrsh7th/cmp-nvim-lsp', 'williamboman/mason-lspconfig.nvim' }, } +local function has_formatter(ft) + local sources = require 'null-ls.sources' + local available = sources.get_available(ft, 'NULL_LS_FORMATTING') + return #available > 0 +end + function M.config() require('mason-lspconfig').setup { automatic_installation = false, @@ -40,18 +47,6 @@ function M.config() local on_attach = function(client, bufnr) --[[ vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') ]] lsp_keymaps(bufnr) - if client.name == 'sumneko_lua' or client.name == 'lua_ls' then - client.server_capabilities.documentFormattingProvider = false - end - if client.name == 'clangd' then - client.server_capabilities.documentFormattingProvider = false - end - if client.name == 'gopls' then - client.server_capabilities.documentFormattingProvider = false - end - if client.name == 'jdtls' then - client.server_capabilities.documentFormattingProvider = false - end if client.name == 'jdt.ls' then client.server_capabilities.documentFormattingProvider = false vim.lsp.codelens.refresh() @@ -61,18 +56,14 @@ function M.config() end end local ft = vim.api.nvim_buf_get_option(bufnr, 'filetype') - local nls = require 'plugins.null-ls' local enable = false - if nls.has_formatter(ft) then + if has_formatter(ft) then enable = client.name == 'null-ls' else enable = not (client.name == 'null-ls') end - if client.name == 'tsserver' then - enable = false - end -- util.info(client.name .. " " .. (enable and "yes" or "no"), "format") client.server_capabilities.documentFormattingProvider = enable end @@ -90,6 +81,7 @@ function M.config() end if server == 'clangd' then local clangd_flags = { + '-j=5', '--all-scopes-completion', '--suggest-missing-includes', '--background-index', diff --git a/lua/plugins/mason-nvim-dap.lua b/lua/plugins/mason-nvim-dap.lua deleted file mode 100644 index 7c80b44..0000000 --- a/lua/plugins/mason-nvim-dap.lua +++ /dev/null @@ -1,47 +0,0 @@ -local M = { - 'jay-babu/mason-nvim-dap.nvim', - dependencies = { - 'williamboman/mason.nvim', - 'mfussenegger/nvim-dap', - }, - cmd = { 'DapInstall', 'DapUninstall' }, -} - -function M.config() - local dap = require 'dap' - require('mason-nvim-dap').setup { - automatic_setup = true, - } - require('mason-nvim-dap').setup_handlers { - function(source_name) - -- all sources with no handler get passed here - - -- Keep original functionality of `automatic_setup = true` - require 'mason-nvim-dap.automatic_setup'(source_name) - end, - elixir = function(source_name) - dap.adapters.mix_task = { - type = 'executable', - command = '/home/user/.local/share/nvim/mason/packages/elixir-ls/debugger.sh', -- debugger.bat for windows - args = {}, - } - dap.configurations.elixir = { - { - type = 'mix_task', - name = 'mix test', - task = 'test', - taskArgs = { '--trace' }, - request = 'launch', - startApps = true, -- for Phoenix projects - projectDir = '${workspaceFolder}', - requireFiles = { - 'test/**/test_helper.exs', - 'test/**/*_test.exs', - }, - }, - } - end, - } -end - -return M diff --git a/lua/plugins/mason.lua b/lua/plugins/mason.lua index d4629ce..e69875e 100644 --- a/lua/plugins/mason.lua +++ b/lua/plugins/mason.lua @@ -7,15 +7,12 @@ local M = { -- 'clang-format', -- 'clangd', -- 'gopls', --- -- 'lua-language-server', +-- 'lua-language-server', -- 'rust-analyzer', -- 'prettierd', --- -- 'stylua', --- 'shellcheck', --- 'shfmt', --- 'black', +-- 'stylua', -- } - +-- -- function M.check() -- local mr = require 'mason-registry' -- for _, tool in ipairs(M.tools) do diff --git a/lua/plugins/null-ls.lua b/lua/plugins/null-ls.lua index 4ff3213..70c8295 100644 --- a/lua/plugins/null-ls.lua +++ b/lua/plugins/null-ls.lua @@ -1,9 +1,5 @@ local M = { 'jose-elias-alvarez/null-ls.nvim', - dependencies = { - 'LostNeophyte/null-ls-embedded', - }, - ft = 'markdown', } function M.config() @@ -57,15 +53,9 @@ function M.config() filetypes = { 'asm', 's' }, }, -- diagnostics.flake8 - require('null-ls-embedded').nls_source, }, } end -function M.has_formatter(ft) - local sources = require 'null-ls.sources' - local available = sources.get_available(ft, 'NULL_LS_FORMATTING') - return #available > 0 -end return M diff --git a/lua/plugins/nvim-dap.lua b/lua/plugins/nvim-dap.lua deleted file mode 100644 index e05a813..0000000 --- a/lua/plugins/nvim-dap.lua +++ /dev/null @@ -1,145 +0,0 @@ -local M = { - 'mfussenegger/nvim-dap', - dependencies = { - { - 'rcarriga/nvim-dap-ui', - }, - }, -} - -function M.init() - vim.keymap.set('n', 'db', function() - require('dap').toggle_breakpoint() - end, { desc = 'Toggle Breakpoint' }) - - vim.keymap.set('n', 'dc', function() - require('dap').continue() - end, { desc = 'Continue' }) - - vim.keymap.set('n', 'dC', function() - require('dap').close() - end, { desc = 'Close' }) - - vim.keymap.set('n', 'do', function() - require('dap').step_over() - end, { desc = 'Step Over' }) - - vim.keymap.set('n', 'di', function() - require('dap').step_into() - end, { desc = 'Step Into' }) - - vim.keymap.set('n', 'dw', function() - require('dap.ui.widgets').hover() - end, { desc = 'Widgets' }) - - vim.keymap.set('n', 'dr', function() - require('dap').repl.open() - end, { desc = 'Repl' }) - - vim.keymap.set('n', 'du', function() - require('dapui').toggle {} - end, { desc = 'Dap UI' }) - - vim.keymap.set('n', 'dfb', function() - require('dapui').float_element('breakpoints', { enter = true }) - end, { desc = 'Dap UI' }) - - vim.keymap.set('n', 'dfS', function() - require('dapui').float_element('stacks', { enter = true }) - end, { desc = 'Dap UI' }) - - vim.keymap.set('n', 'dfw', function() - require('dapui').float_element('watches', { enter = true }) - end, { desc = 'Dap UI' }) - - vim.keymap.set('n', 'dfs', function() - require('dapui').float_element('scopes', { enter = true }) - end, { desc = 'Dap UI' }) -end - -function M.config() - local dap = require 'dap' - - local dapui = require 'dapui' - dapui.setup { - mapping = { - edit = 'l', - }, - element_mappings = { - scopes = { - edit = 'l', - }, - breakpoints = { - open = 'l', - }, - stacks = { - open = 'l', - }, - watches = { - edit = 'l', - }, - }, - layouts = { - { - elements = { - -- Elements can be strings or table with id and size keys. - { id = 'scopes', size = 0.25 }, - 'breakpoints', - 'stacks', - -- "watches", - }, - size = 50, - position = 'right', - }, - { - elements = { - 'repl', - 'console', - }, - size = 0.25, -- 25% of total lines - position = 'bottom', - }, - }, - floating = { - max_height = nil, -- These can be integers or a float between 0 and 1. - max_width = nil, -- Floats will be treated as percentage of your screen. - border = 'rounded', -- Border style. Can be "single", "double" or "rounded" - mappings = { - close = { 'q', '' }, - edit = 'l', - }, - }, - windows = { indent = 1 }, - render = { - max_type_length = nil, -- Can be integer or nil. - }, - } - -- dap.listeners.after.event_initialized['dapui_config'] = function() - -- dapui.open {} - -- end - dap.listeners.before.event_terminated['dapui_config'] = function() - dapui.close {} - end - dap.listeners.before.event_exited['dapui_config'] = function() - dapui.close {} - end - require 'mason-nvim-dap' -end - --- - `DapBreakpoint` for breakpoints (default: `B`) --- - `DapBreakpointCondition` for conditional breakpoints (default: `C`) --- - `DapLogPoint` for log points (default: `L`) --- - `DapStopped` to indicate where the debugee is stopped (default: `→`) --- - `DapBreakpointRejected` to indicate breakpoints rejected by the debug --- adapter (default: `R`) --- --- You can customize the signs by setting them with the |sign_define()| function. --- For example: --- --- > --- lua << EOF --- vim.fn.sign_define('DapBreakpoint', {text='🛑', texthl='', linehl='', numhl=''}) --- EOF --- < - -return M diff --git a/lua/plugins/theme.lua b/lua/plugins/theme.lua index 09953b1..1013ecd 100644 --- a/lua/plugins/theme.lua +++ b/lua/plugins/theme.lua @@ -1,38 +1,5 @@ -local M = { +return { url = 'https://git.filnar.com/filnar/neogruber.nvim.git', - -- lazy = true, - event = 'VeryLazy' + lazy = false, + -- event = 'VeryLazy' } - -function M.config() - require('neogruber').setup { - borders = true, -- Split window borders - fade_nc = true, -- Fade non-current windows, making them more distinguishable - -- Style that is applied to various groups: see `highlight-args` for options - styles = { - comments = 'italic', - strings = 'NONE', - keywords = 'bold', - functions = 'NONE', - variables = 'NONE', - diagnostics = 'underline', - storage_class = 'bold', - structure = 'NONE', - loop_cond = 'bold', - builtin = 'bold', - }, - disable = { - background = true, -- Disable setting the background color - cursorline = false, -- Disable the cursorline - eob_lines = true, -- Hide the end-of-buffer lines - }, - -- Inverse highlight for different groups - inverse = { - match_paren = true, - }, - custom_highlights = {}, -- Overwrite default highlight groups - custom_colors = {}, -- Overwrite default colors - } -end - -return M diff --git a/lua/plugins/toggleterm.lua b/lua/plugins/toggleterm.lua index 00b6446..01f0fca 100644 --- a/lua/plugins/toggleterm.lua +++ b/lua/plugins/toggleterm.lua @@ -23,7 +23,8 @@ function M.config() start_in_insert = true, insert_mappings = true, -- whether or not the open mapping applies in insert mode persist_size = true, - direction = 'horizontal', -- 'vertical' | 'horizontal' | 'window' | 'float', + -- direction = 'horizontal', -- 'vertical' | 'horizontal' | 'window' | 'float', + direction = 'float', -- 'vertical' | 'horizontal' | 'window' | 'float', close_on_exit = true, -- close the terminal window when the process exits shell = vim.o.shell, -- change the default shell -- This field is only relevant if direction is set to 'float' @@ -33,13 +34,13 @@ function M.config() -- the 'curved' border is a custom border type -- not natively supported but implemented in this plugin. border = 'curved', -- | 'double' | 'shadow' | 'curved' --| ... other options supported by win open - width = 100, - height = 30, - winblend = 0, - highlights = { - border = 'Normal', - background = 'Normal', - }, + -- width = 100, + -- height = 30, + -- winblend = 20, + -- highlights = { + -- border = 'Normal', + -- background = 'Normal', + -- }, }, } end diff --git a/lua/plugins/tresitter.lua b/lua/plugins/tresitter.lua index d54e893..c79324c 100644 --- a/lua/plugins/tresitter.lua +++ b/lua/plugins/tresitter.lua @@ -1,32 +1,29 @@ local M = { 'nvim-treesitter/nvim-treesitter', -- lazy = false, - event = 'BufReadPost', + -- dependencies = { 'nvim-treesitter/playground' }, + -- event = { 'BufReadPost', 'BufNewFile' }, + -- event = 'VeryLazy' } function M.config() local configs = require 'nvim-treesitter.configs' configs.setup { - -- ensure_installed = { - -- 'bash', - -- 'c', - -- 'cpp', - -- 'go', - -- 'javascript', - -- 'typescript', - -- 'json', - -- 'lua', - -- 'python', - -- 'rust', - -- 'html', - -- 'css', - -- 'toml', - -- 'latex', - -- 'markdown', - -- 'vim', - -- 'dot', - -- }, + ensure_installed = { + 'bash', + 'c', + 'cpp', + 'go', + 'json', + 'lua', + 'python', + 'rust', + 'markdown', + 'markdown_inline', + 'regex', + 'vim', + }, ignore_install = { 'haskell' }, -- matchup = { -- enable = true -- mandatory, false will disable the whole extension diff --git a/lua/plugins/trouble.lua b/lua/plugins/trouble.lua index 3334506..9e6a1dc 100644 --- a/lua/plugins/trouble.lua +++ b/lua/plugins/trouble.lua @@ -13,7 +13,7 @@ function M.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 = false, -- use devicons for filenames + icons = true, -- use devicons for filenames mode = 'quickfix', -- "workspace_diagnostics", "document_diagnostics", "quickfix", "lsp_references", "loclist" fold_open = '', -- icon used for open folds fold_closed = '', -- icon used for closed folds