From 34d996020d70035cd84cd359ab06a19f91e3fb1c Mon Sep 17 00:00:00 2001 From: Michaël Ball Date: Tue, 30 Jul 2024 07:28:00 +0100 Subject: Config updates --- neovim/.config/nvim/lua/config/colourscheme.lua | 2 +- neovim/.config/nvim/lua/config/lazy.lua | 4 +- neovim/.config/nvim/lua/plugins/django_plus.lua | 7 +- neovim/.config/nvim/lua/plugins/galaxyline.lua | 268 ++------------------- neovim/.config/nvim/lua/plugins/goyo.lua | 19 +- .../.config/nvim/lua/plugins/indent_blankline.lua | 4 + neovim/.config/nvim/lua/plugins/nvim_cmp.lua | 2 +- neovim/.config/nvim/lua/plugins/nvim_dap.lua | 7 + neovim/.config/nvim/lua/plugins/nvim_lspconfig.lua | 39 ++- neovim/.config/nvim/lua/plugins/tmux_plugins.lua | 6 +- neovim/.config/nvim/lua/plugins/vim_prettier.lua | 3 + 11 files changed, 95 insertions(+), 266 deletions(-) diff --git a/neovim/.config/nvim/lua/config/colourscheme.lua b/neovim/.config/nvim/lua/config/colourscheme.lua index 56ae5b6..edba16f 100644 --- a/neovim/.config/nvim/lua/config/colourscheme.lua +++ b/neovim/.config/nvim/lua/config/colourscheme.lua @@ -1,4 +1,4 @@ -local colorscheme = "onedark" +local colorscheme = "xcode" vim.o.background = "light" local ok, _ = pcall(vim.cmd, "colorscheme " .. colorscheme) if not ok then diff --git a/neovim/.config/nvim/lua/config/lazy.lua b/neovim/.config/nvim/lua/config/lazy.lua index ef4c1e0..a109cd0 100644 --- a/neovim/.config/nvim/lua/config/lazy.lua +++ b/neovim/.config/nvim/lua/config/lazy.lua @@ -29,7 +29,7 @@ require("lazy").setup({ }, -- Configure any other settings here. See the documentation for more details. -- colorscheme that will be used when installing plugins. - install = { colorscheme = { "habamax" } }, + install = { colorscheme = { "xcode" }, missing = true }, -- automatically check for plugin updates - checker = { enabled = true }, + checker = { enabled = false }, }) diff --git a/neovim/.config/nvim/lua/plugins/django_plus.lua b/neovim/.config/nvim/lua/plugins/django_plus.lua index 2ca10a4..48ecf30 100644 --- a/neovim/.config/nvim/lua/plugins/django_plus.lua +++ b/neovim/.config/nvim/lua/plugins/django_plus.lua @@ -1,5 +1,6 @@ return { - { - 'tweekmonster/django-plus.vim', - } + { + 'tweekmonster/django-plus.vim', + ft = { 'htmldjango', 'python' } + } } diff --git a/neovim/.config/nvim/lua/plugins/galaxyline.lua b/neovim/.config/nvim/lua/plugins/galaxyline.lua index 30d383b..1143b60 100644 --- a/neovim/.config/nvim/lua/plugins/galaxyline.lua +++ b/neovim/.config/nvim/lua/plugins/galaxyline.lua @@ -6,21 +6,6 @@ return { { 'nvim-tree/nvim-web-devicons', }, - --{ - --'lunacookies/vim-colors-xcode', - --lazy = false, - --priority = 1000, - --config = function () - --local colorscheme_rules_augroup = vim.api.nvim_create_augroup('Colors', {}) - --vim.api.nvim_create_autocmd( { 'ColorScheme' }, { - --pattern = { '*' }, - --group = colorscheme_rules_augroup, - --callback = function() - --vim.api.nvim_set_hl(0, 'WinSeparator', { link='VertSplit', force=1, default=1 }) - --end, - --}) - --end, - --}, { 'navarasu/onedark.nvim', lazy = false, @@ -28,21 +13,30 @@ return { opts = { style = 'light', }, + }, + { + 'lunacookies/vim-colors-xcode', + lazy = false, + priority = 1000, + --config = function() + --local colorscheme_rules_augroup = vim.api.nvim_create_augroup('Colors', {}) + --vim.api.nvim_create_autocmd({ 'ColorScheme' }, { + --pattern = { '*' }, + --group = colorscheme_rules_augroup, + --callback = function() + --vim.api.nvim_set_hl(0, 'WinSeparator', { link = 'VertSplit', force = 1, default = 1 }) + --end, + --}) + --end, dependencies = { { 'f-person/auto-dark-mode.nvim', opts = { update_interval = 1000, - set_dark_mode = function () - require('onedark').setup { - style = 'dark', - } + set_dark_mode = function() vim.api.nvim_set_option('background', 'dark') end, - set_light_mode = function () - require('onedark').setup { - style = 'light', - } + set_light_mode = function() vim.api.nvim_set_option('background', 'light') end } @@ -50,233 +44,9 @@ return { }, }, }, - event = 'VimEnter', + event = { 'BufEnter', 'VimEnter' }, config = function() - local gl = require('galaxyline') - local colors = { - yellow = vim.g.terminal_color_11, - cyan = vim.g.terminal_color_14, - darkblue = vim.g.terminal_color_4, - green = vim.g.terminal_color_10, - orange = vim.g.terminal_color_3, - violet = vim.g.terminal_color_5, - magenta = vim.g.terminal_color_13, - blue = vim.g.terminal_color_12, - red = vim.g.terminal_color_9, - } - local condition = require('galaxyline.condition') - local gls = gl.section - local lsp = require('galaxyline.provider_lsp') - gl.short_line_list = { 'nerdtree', 'NeogitStatus', 'vim-plug', 'lspsagaoutline', 'neo-tree', 'sagaoutline'} - - gls.left[1] = { - RainbowBlue = { - provider = function() - return '▊ ' - end, - highlight = { colors.blue, 'StatusLine' } - }, - } - gls.left[2] = { - ViMode = { - provider = function() - -- auto change color according the vim mode - local mode_color = { - n = colors.red, - i = colors.green, - v = colors.blue, - ['^V'] = colors.blue, - V = colors.blue, - c = colors.magenta, - no = colors.red, - s = colors.orange, - S = colors.orange, - ['^S'] = colors.orange, - ic = colors.yellow, - R = colors.violet, - Rv = colors.violet, - cv = colors.red, - ce = colors.red, - r = colors.cyan, - rm = colors.cyan, - ['r?'] = colors.cyan, - ['!'] = colors.red, - t = colors.red - } - vim.api.nvim_command('hi GalaxyViMode guifg=' .. mode_color[vim.fn.mode()]) - return ' ' - end, - highlight = { colors.red, 'StatusLine', 'bold' }, - }, - } - - gls.left[3] = { - FileSize = { - provider = 'FileSize', - condition = condition.buffer_not_empty, - highlight = { 'StatusLine', 'StatusLine' }, - } - } - gls.left[4] = { - FileIcon = { - provider = 'FileIcon', - condition = function() - if vim.g.GtkGuiLoaded ~= nil and condition.buffer_not_empty() then - return true - end - return false - end, - highlight = { require('galaxyline.provider_fileinfo').get_file_icon_color, 'StatusLine' }, - }, - } - - gls.left[5] = { - FileName = { - provider = 'FileName', - condition = condition.buffer_not_empty, - highlight = { colors.magenta, 'StatusLine', 'bold' } - } - } - - gls.left[6] = { - LineInfo = { - provider = 'LineColumn', - separator = ' ', - separator_highlight = { 'NONE', 'StatusLine' }, - highlight = { 'NONE', 'StatusLine' }, - }, - } - - gls.left[7] = { - PerCent = { - provider = 'LinePercent', - separator = ' ', - separator_highlight = { 'NONE', 'StatusLine' }, - highlight = { 'NONE', 'StatusLine', 'bold' }, - } - } - - gls.left[8] = { - DiagnosticError = { - provider = 'DiagnosticError', - icon = '  ', - highlight = { colors.red, 'StatusLine' } - } - } - gls.left[9] = { - DiagnosticWarn = { - provider = 'DiagnosticWarn', - icon = '  ', - highlight = { colors.yellow, 'StatusLine' }, - } - } - - gls.left[10] = { - DiagnosticHint = { - provider = 'DiagnosticHint', - icon = '  ', - highlight = { colors.cyan, 'StatusLine' }, - } - } - - gls.left[11] = { - DiagnosticInfo = { - provider = 'DiagnosticInfo', - icon = '  ', - highlight = { colors.blue, 'StatusLine' }, - } - } - - gls.mid[1] = { - ShowLspClient = { - provider = 'GetLspClient', - condition = function() - local tbl = { ['dashboard'] = true, [''] = true } - if tbl[vim.bo.filetype] then - return false - elseif lsp.get_lsp_client() == 'No Active Lsp' then - return false - end - return true - end, - icon = '⚙ LSP:', - highlight = { colors.cyan, 'StatusLine', 'bold' } - } - } - - gls.right[1] = { - GitIcon = { - provider = function() return '  ' end, - condition = condition.check_git_workspace, - separator = ' ', - separator_highlight = { 'NONE', 'StatusLine' }, - highlight = { colors.violet, 'StatusLine', 'bold' }, - } - } - - gls.right[2] = { - GitBranch = { - provider = 'GitBranch', - condition = condition.check_git_workspace, - highlight = { colors.violet, 'StatusLine', 'bold' }, - } - } - - gls.right[3] = { - DiffAdd = { - provider = 'DiffAdd', - condition = condition.hide_in_width, - icon = ' +', - highlight = { colors.green, 'StatusLine' }, - } - } - gls.right[4] = { - DiffModified = { - provider = 'DiffModified', - condition = condition.hide_in_width, - icon = ' ±', - highlight = { colors.orange, 'StatusLine' }, - } - } - gls.right[5] = { - DiffRemove = { - provider = 'DiffRemove', - condition = condition.hide_in_width, - icon = ' -', - highlight = { colors.red, 'StatusLine' }, - } - } - - gls.right[6] = { - RainbowBlue = { - provider = function() return ' ▊' end, - highlight = { colors.blue, 'StatusLine' } - }, - } - - gls.short_line_left[1] = { - BufferType = { - provider = 'FileTypeName', - separator = ' ', - separator_highlight = { 'NONE', 'StatusLine' }, - highlight = { colors.blue, 'StatusLine', 'bold' } - } - } - - gls.short_line_left[2] = { - SFileName = { - provider = 'SFileName', - condition = condition.buffer_not_empty, - highlight = { 'StatusLine', 'StatusLine', 'bold' } - } - } - - gls.short_line_right[1] = { - BufferIcon = { - provider = 'BufferIcon', - highlight = { 'StatusLine', 'StatusLine' }, - } - } + require('config.galaxyline') end, }, } diff --git a/neovim/.config/nvim/lua/plugins/goyo.lua b/neovim/.config/nvim/lua/plugins/goyo.lua index 7de7150..dba0f39 100644 --- a/neovim/.config/nvim/lua/plugins/goyo.lua +++ b/neovim/.config/nvim/lua/plugins/goyo.lua @@ -1,7 +1,7 @@ return { { 'junegunn/goyo.vim', - cond = function() return vim.fn.exists('g:gui_vimr') == 1 end, + cond = function() return vim.fn.has('gui_running') == 1 end, dependencies = { { 'junegunn/limelight.vim', @@ -15,14 +15,31 @@ return { vim.opt.showmode = false vim.opt.showcmd = false vim.opt.scrolloff = 999 + + vim.opt.laststatus = 0 + local gl = require('galaxyline') + local gls = gl.section + gls.left = {} + gls.mid = {} + gls.right = {} + vim.cmd('Limelight') + vim.cmd('VimRToggleFullscreen') end local goyo_leave = function() + local function script_path() + local str = debug.getinfo(2, 'S').source:sub(2) + return str:match('(.*/)') or './' + end + vim.opt.showmode = true vim.opt.showcmd = true vim.opt.scrolloff = 5 + dofile(script_path() .. '../config/galaxyline.lua') + vim.opt.laststatus = 2 vim.cmd('Limelight!') + vim.cmd('VimRToggleFullscreen') end local goyo_augroup = vim.api.nvim_create_augroup('Goyo', { clear = true }) diff --git a/neovim/.config/nvim/lua/plugins/indent_blankline.lua b/neovim/.config/nvim/lua/plugins/indent_blankline.lua index 0991c0c..5feea4d 100644 --- a/neovim/.config/nvim/lua/plugins/indent_blankline.lua +++ b/neovim/.config/nvim/lua/plugins/indent_blankline.lua @@ -4,6 +4,10 @@ return { main = 'ibl', opts = { indent = { char = '▏' }, + scope = { + enabled = true, + char = '▎' + }, }, }, } diff --git a/neovim/.config/nvim/lua/plugins/nvim_cmp.lua b/neovim/.config/nvim/lua/plugins/nvim_cmp.lua index 0958eac..ad626ef 100644 --- a/neovim/.config/nvim/lua/plugins/nvim_cmp.lua +++ b/neovim/.config/nvim/lua/plugins/nvim_cmp.lua @@ -6,7 +6,7 @@ return { dependencies = { { 'andersevenrud/cmp-tmux', - cond = function() return vim.fn.exists('g:gui_vimr') == 0 end + cond = function() return vim.fn.has('gui_running') == 0 end }, { 'hrsh7th/cmp-nvim-lsp' diff --git a/neovim/.config/nvim/lua/plugins/nvim_dap.lua b/neovim/.config/nvim/lua/plugins/nvim_dap.lua index 448609f..0de8468 100644 --- a/neovim/.config/nvim/lua/plugins/nvim_dap.lua +++ b/neovim/.config/nvim/lua/plugins/nvim_dap.lua @@ -12,6 +12,13 @@ return { } }, }, + keys = { + { "br", require('dap').toggle_breakpoint, "Toggle breakpoint" }, + { "cn", require('dap').continue, "Debug start/continue" }, + { "si", require('dap').step_into, "Debug step into" }, + { "so", require('dap').step_over, "Debug step over" }, + }, + ft = { "python" }, config = function() local dap = require 'dap' vim.fn.sign_define('DapBreakpoint', { diff --git a/neovim/.config/nvim/lua/plugins/nvim_lspconfig.lua b/neovim/.config/nvim/lua/plugins/nvim_lspconfig.lua index 65420db..75ce1ac 100644 --- a/neovim/.config/nvim/lua/plugins/nvim_lspconfig.lua +++ b/neovim/.config/nvim/lua/plugins/nvim_lspconfig.lua @@ -9,7 +9,7 @@ return { -- Use a loop to conveniently call 'setup' on multiple servers and -- map buffer local keybindings when the language server attaches local servers = { "bashls", "clangd", "cssls", "dockerls", "gopls", "html", "htmx", "jsonls", "marksman", - "rust_analyzer", "yamlls" } + "ruff", "rust_analyzer", "yamlls" } for _, lsp in ipairs(servers) do nvim_lsp[lsp].setup { capabilities = capabilities, @@ -73,15 +73,27 @@ return { settings = { pylsp = { plugins = { + autopep8 = { + enabled = false, + }, black = { enabled = false, }, + mccabe = { + enabled = false, + }, + pycodestyle = { + enabled = false, + }, + pyflakes = { + enabled = false, + }, ruff = { - enabled = true, - formatEnabled = true, - extendSelect = { 'I' }, - format = { 'I' }, - } + enabled = false, + }, + yapf = { + enabled = false, + }, } } }, @@ -107,6 +119,21 @@ return { end, opts) end, }) + + vim.api.nvim_create_autocmd("LspAttach", { + group = vim.api.nvim_create_augroup('lsp_attach_disable_ruff_hover', { clear = true }), + callback = function(args) + local client = vim.lsp.get_client_by_id(args.data.client_id) + if client == nil then + return + end + if client.name == 'ruff' then + -- Disable hover in favor of Pyright + client.server_capabilities.hoverProvider = false + end + end, + desc = 'LSP: Disable hover capability from Ruff', + }) end, }, } diff --git a/neovim/.config/nvim/lua/plugins/tmux_plugins.lua b/neovim/.config/nvim/lua/plugins/tmux_plugins.lua index 1ff0312..a80a4b6 100644 --- a/neovim/.config/nvim/lua/plugins/tmux_plugins.lua +++ b/neovim/.config/nvim/lua/plugins/tmux_plugins.lua @@ -1,15 +1,15 @@ return { { 'tmux-plugins/vim-tmux', - cond = function() return vim.fn.exists('g:gui_vimr') == 0 end, + cond = function() return vim.fn.has('gui_running') == 0 end, }, { 'tmux-plugins/vim-tmux-focus-events', - cond = function() return vim.fn.exists('g:gui_vimr') == 0 end, + cond = function() return vim.fn.has('gui_running') == 0 end, }, { 'benmills/vimux', - cond = function() return vim.fn.exists('g:gui_vimr') == 0 end, + cond = function() return vim.fn.has('gui_running') == 0 end, config = function() vim.g.VimuxUseNearest = 0 vim.gVimuxResetSequence = "" diff --git a/neovim/.config/nvim/lua/plugins/vim_prettier.lua b/neovim/.config/nvim/lua/plugins/vim_prettier.lua index 5ec2aa2..f5be9c5 100644 --- a/neovim/.config/nvim/lua/plugins/vim_prettier.lua +++ b/neovim/.config/nvim/lua/plugins/vim_prettier.lua @@ -1,5 +1,8 @@ return { { 'prettier/vim-prettier', + keys = { + { "p", "PrettierAsync", desc="Run prettier" } + } }, } -- cgit v1.2.3