From 47840ea0fdbcc7670a3e1ac6f7849431110bdcd5 Mon Sep 17 00:00:00 2001 From: SinTan1729 Date: Thu, 24 Apr 2025 20:16:58 -0500 Subject: [PATCH] chg: Some moving of stuff and added ,yy for clipboard copy --- laptop/config/keymaps.lua | 3 ++ laptop/config/plugins.lua | 4 +- laptop/plugin/lsp_config.lua | 76 +++++++++++++++++++++++------------- laptop/plugin/moonfly.lua | 1 - laptop/plugin/rust.lua | 26 ++++++------ pizero/init.lua | 3 ++ server/config/keymaps.lua | 3 ++ vps/config/keymaps.lua | 3 ++ 8 files changed, 76 insertions(+), 43 deletions(-) diff --git a/laptop/config/keymaps.lua b/laptop/config/keymaps.lua index 0f67ecb..cbf728e 100644 --- a/laptop/config/keymaps.lua +++ b/laptop/config/keymaps.lua @@ -30,6 +30,9 @@ dr_map('n', 'D', '"_D', { remap = false }) dr_map('n', 'x', '"_x', { remap = false }) dr_map('n', 'r', '"_viwP', { remap = false }) +-- Use ,yy for yanking to system clipboard +map('n', 'y', '"+y', { remap = false }) + -- Insert a newline in normal mode by ,o and ,O map('n', 'o', ":call append(line('.'), repeat([''], v:count1))", { remap = false }) map('n', 'O', ":call append(line('.')-1, repeat([''], v:count1))", { remap = false }) diff --git a/laptop/config/plugins.lua b/laptop/config/plugins.lua index b5e6328..c7d06ea 100644 --- a/laptop/config/plugins.lua +++ b/laptop/config/plugins.lua @@ -64,8 +64,8 @@ require("lazy").setup({ -- Rust tools { "mrcjkb/rustaceanvim", - version = "^4", - ft = { "rust" }, + version = "^6", + lazy = false, }, -- Automatically add bracket pairs "windwp/nvim-autopairs", diff --git a/laptop/plugin/lsp_config.lua b/laptop/plugin/lsp_config.lua index 9fed154..d69e5b0 100644 --- a/laptop/plugin/lsp_config.lua +++ b/laptop/plugin/lsp_config.lua @@ -1,27 +1,6 @@ local lspconfig = require('lspconfig') local map = vim.keymap.set -lspconfig.ruff.setup({ - init_options = { - settings = { - lineLength = 100, - } - } -}) - -lspconfig.lua_ls.setup({ - settings = { - Lua = { - diagnostics = { globals = { 'vim' } }, - telemetry = { enable = false }, - }, - } -}) - -lspconfig.ocamllsp.setup {} - -lspconfig.hls.setup {} - -- ;k to hover -- ;a to show code actions -- ;d to show diagnostic message @@ -37,10 +16,53 @@ vim.api.nvim_create_autocmd("LspAttach", { end, }) --- Enable inlay hints for Rust -vim.api.nvim_create_autocmd("LspAttach", { - pattern = "*.rs", - callback = function() - vim.lsp.inlay_hint.enable(true) - end, +-- Python +lspconfig.ruff.setup({ + init_options = { + settings = { + lineLength = 100, + } + } }) +lspconfig.pyright.setup { + settings = { + pyright = { + -- Using Ruff's import organizer + disableOrganizeImports = true, + }, + python = { + analysis = { + -- Ignore all files for analysis to exclusively use Ruff for linting + ignore = { '*' }, + }, + }, + }, +} +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', +}) + +-- Misc +lspconfig.lua_ls.setup({ + settings = { + Lua = { + diagnostics = { globals = { 'vim' } }, + telemetry = { enable = false }, + }, + } +}) + +lspconfig.ocamllsp.setup {} + +lspconfig.hls.setup {} diff --git a/laptop/plugin/moonfly.lua b/laptop/plugin/moonfly.lua index 670df16..b0c331b 100644 --- a/laptop/plugin/moonfly.lua +++ b/laptop/plugin/moonfly.lua @@ -23,4 +23,3 @@ vim.g.moonflyVirtualTextColor = true -- Use the moonfly colorscheme vim.cmd [[colorscheme moonfly]] - diff --git a/laptop/plugin/rust.lua b/laptop/plugin/rust.lua index fdda26f..4532920 100644 --- a/laptop/plugin/rust.lua +++ b/laptop/plugin/rust.lua @@ -1,19 +1,19 @@ vim.g.rustaceanvim = { -- Plugin configuration tools = { + enable_clippy = true, }, - -- LSP configuration server = { - default_settings = { - -- rust-analyzer language server configuration - ["rust-analyzer"] = { - check = { - command = "clippy" - } - }, - }, - }, - -- DAP configuration - dap = { - }, + on_attach = function() + vim.lsp.inlay_hint.enable(true) + end + } } + +-- Enable inlay hints for Rust +-- vim.api.nvim_create_autocmd("LspAttach", { +-- pattern = "*.rs", +-- callback = function() +-- vim.lsp.inlay_hint.enable(true) +-- end, +-- }) diff --git a/pizero/init.lua b/pizero/init.lua index c9cf020..6efa35d 100644 --- a/pizero/init.lua +++ b/pizero/init.lua @@ -81,6 +81,9 @@ dr_map('n', 'D', '"_D', { remap = false }) dr_map('n', 'x', '"_x', { remap = false }) dr_map('n', 'r', '"_viwP', { remap = false }) +-- Use ,yy for yanking to system clipboard +map('n', 'y', '"+y', { remap = false }) + -- Insert a newline in normal mode by ,o and ,O map('n', 'o', ":call append(line('.'), repeat([''], v:count1))", { remap = false }) map('n', 'O', ":call append(line('.')-1, repeat([''], v:count1))", { remap = false }) diff --git a/server/config/keymaps.lua b/server/config/keymaps.lua index 0f41313..1c25abb 100644 --- a/server/config/keymaps.lua +++ b/server/config/keymaps.lua @@ -24,6 +24,9 @@ dr_map('n', 'D', '"_D', { remap = false }) dr_map('n', 'x', '"_x', { remap = false }) dr_map('n', 'r', '"_viwP', { remap = false }) +-- Use ,yy for yanking to system clipboard +map('n', 'y', '"+y', { remap = false }) + -- Insert a newline in normal mode by ,o and ,O map('n', 'o', ":call append(line('.'), repeat([''], v:count1))", { remap = false }) map('n', 'O', ":call append(line('.')-1, repeat([''], v:count1))", { remap = false }) diff --git a/vps/config/keymaps.lua b/vps/config/keymaps.lua index 0f41313..1c25abb 100644 --- a/vps/config/keymaps.lua +++ b/vps/config/keymaps.lua @@ -24,6 +24,9 @@ dr_map('n', 'D', '"_D', { remap = false }) dr_map('n', 'x', '"_x', { remap = false }) dr_map('n', 'r', '"_viwP', { remap = false }) +-- Use ,yy for yanking to system clipboard +map('n', 'y', '"+y', { remap = false }) + -- Insert a newline in normal mode by ,o and ,O map('n', 'o', ":call append(line('.'), repeat([''], v:count1))", { remap = false }) map('n', 'O', ":call append(line('.')-1, repeat([''], v:count1))", { remap = false })