diff --git a/nvim/.config/nvim/lua/romanzy/commands.lua b/nvim/.config/nvim/lua/romanzy/commands.lua new file mode 100644 index 0000000..25c1a1b --- /dev/null +++ b/nvim/.config/nvim/lua/romanzy/commands.lua @@ -0,0 +1,42 @@ +local uc = vim.api.nvim_create_user_command +local ac = vim.api.nvim_create_autocmd +local aug = vim.api.nvim_create_augroup + +-- User commands +uc("W", "w|e", { desc = "write file then refresh buffer" }) + +-- Auto commands +ac("TextYankPost", { + desc = "Highlight when yanking text", + group = aug("highlight-yank", { clear = true }), + callback = function() + vim.highlight.on_yank() + end, +}) +ac("LspAttach", { + desc = "Notify user about attached LSP clients", + group = aug("LSPOnAttach", { clear = true }), + callback = function(event) + local client = vim.lsp.get_client_by_id(event.data.client_id) + if client then + vim.notify(client.name .. " attached", vim.log.levels.INFO, {}) + end + end, +}) +-- ac("LspAttach", { +-- group = aug("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 +-- client.server_capabilities.hoverProvider = false +-- end +-- end, +-- desc = "LSP: Disable hover capabilties for ruff", +-- }) + + +-- Only show the invisible characters inside the code editing buffers +vim.cmd([[autocmd BufWinEnter * if &buftype != '' | setlocal nolist | endif]]) diff --git a/nvim/.config/nvim/lua/romanzy/init.lua b/nvim/.config/nvim/lua/romanzy/init.lua index 2730e15..babc914 100644 --- a/nvim/.config/nvim/lua/romanzy/init.lua +++ b/nvim/.config/nvim/lua/romanzy/init.lua @@ -1,3 +1,4 @@ -require("romanzy.set") -require("romanzy.remap") +require("romanzy.options") +require("romanzy.keymaps") +require("romanzy.commands") require("romanzy.plugins") diff --git a/nvim/.config/nvim/lua/romanzy/remap.lua b/nvim/.config/nvim/lua/romanzy/keymaps.lua similarity index 100% rename from nvim/.config/nvim/lua/romanzy/remap.lua rename to nvim/.config/nvim/lua/romanzy/keymaps.lua diff --git a/nvim/.config/nvim/lua/romanzy/options.lua b/nvim/.config/nvim/lua/romanzy/options.lua new file mode 100644 index 0000000..db18577 --- /dev/null +++ b/nvim/.config/nvim/lua/romanzy/options.lua @@ -0,0 +1,41 @@ +local g = vim.g +local o = vim.opt + +-- Leaders +g.mapleader = " " -- Uses space as the global leader key. +g.maplocalleader = " " -- Uses space as the local leader key. + +-- Interface +o.number = true -- Shows absolute line numbers. +o.relativenumber = true -- Shows relative numbers for easier motion. +o.scrolloff = 8 -- Keeps context lines visible around the cursor. +o.signcolumn = "yes" -- Always reserves space for signs in the gutter. +o.colorcolumn = "+1" -- Highlights the preferred maximum line width. +o.wrap = false -- Prevents long lines from wrapping on screen. +o.list = true -- Displays whitespace characters using listchars. +o.listchars = { + tab = "» ", + trail = "·", + extends = "⟩", + precedes = "⟨", + nbsp = "␣", +} -- Defines how invisible characters are rendered. +o.termguicolors = true -- Enables full RGB color support. +o.mouse = "" -- Disables mouse support. + +-- Editing +o.tabstop = 4 -- Renders tab characters as four columns. +o.softtabstop = 4 -- Makes tab/backspace feel like four spaces. +o.shiftwidth = 4 -- Uses four columns for each indent step. +o.expandtab = false -- Keeps literal tab characters instead of spaces. +o.smartindent = true -- Adds indentation automatically on new lines. +o.swapfile = false -- Disables swapfile creation. + +-- Search and update behavior +o.incsearch = true -- Updates search matches as you type. +o.updatetime = 50 -- Reduces idle delay for swap and CursorHold events. +o.spelllang = { "en_us" } -- Uses US English for spell checking. + +-- Shell +o.shell = "bash" -- Runs shell commands through bash. + diff --git a/nvim/.config/nvim/lua/romanzy/set.lua b/nvim/.config/nvim/lua/romanzy/set.lua deleted file mode 100644 index b95a915..0000000 --- a/nvim/.config/nvim/lua/romanzy/set.lua +++ /dev/null @@ -1,36 +0,0 @@ -local g = vim.g -local o = vim.opt - -g.mapleader = " " -g.maplocalleader = " " - -o.nu = true -o.number = true -o.relativenumber = true -o.swapfile = false -o.mouse = "" -o.tabstop = 4 -o.softtabstop = 4 -o.shiftwidth = 4 -o.expandtab = false -o.smartindent = true -o.wrap = false -o.incsearch = true -o.termguicolors = true -o.scrolloff = 8 -o.signcolumn = "yes" -o.updatetime = 50 -o.colorcolumn = "80" -o.spelllang = { 'en_us' } -o.listchars = { - tab = "» ", - trail = "·", - extends = "⟩", - precedes = "⟨", - nbsp = "␣" -} -o.list = true -o.shell = "bash" - --- only show the invisible characters inside the code editing buffers -vim.cmd([[autocmd BufWinEnter * if &buftype != '' | setlocal nolist | endif]])