diff options
| author | filip <“filip.rabiega@gmail.com”> | 2026-01-26 14:37:12 +0100 |
|---|---|---|
| committer | filip <“filip.rabiega@gmail.com”> | 2026-01-26 14:37:12 +0100 |
| commit | ab4d0326997fbecc0e8c4683b0a0606921dfc4b9 (patch) | |
| tree | 7641ae19a0bc1636139a05b0cd04a7312e1be939 /.config/nvim | |
| parent | 310f61f358b3f3ddf03b914878ffff00a996c477 (diff) | |
| download | dotfiles-ab4d0326997fbecc0e8c4683b0a0606921dfc4b9.tar.gz dotfiles-ab4d0326997fbecc0e8c4683b0a0606921dfc4b9.tar.bz2 dotfiles-ab4d0326997fbecc0e8c4683b0a0606921dfc4b9.zip | |
new envvars
Diffstat (limited to '.config/nvim')
| -rw-r--r-- | .config/nvim/init.lua | 144 |
1 files changed, 102 insertions, 42 deletions
diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 289e1cd..f241c57 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -1,56 +1,91 @@ ------------------------------------------------------------ --- General settings +-- Filip's neovim config ------------------------------------------------------------ -vim.opt.number = true + +------------------------------------------------------------ +-- General / UI settings +------------------------------------------------------------ +vim.opt.number = true vim.opt.relativenumber = true -vim.opt.title = true -vim.opt.background = "dark" -vim.opt.laststatus = 2 -vim.opt.showmode = true -vim.opt.showcmd = false -vim.opt.ruler = true +vim.opt.title = true +vim.opt.background = "dark" +vim.opt.laststatus = 2 +vim.opt.showmode = true +vim.opt.showcmd = false +vim.opt.ruler = true +vim.opt.cursorline = true + +-- Modern / visual quality +vim.opt.termguicolors = true +vim.opt.signcolumn = "yes" +vim.opt.pumblend = 10 +vim.opt.winblend = 10 + +------------------------------------------------------------ +-- Window / split behavior +------------------------------------------------------------ +vim.opt.splitbelow = true +vim.opt.splitright = true + +------------------------------------------------------------ +-- Timing & performance related +------------------------------------------------------------ +vim.opt.updatetime = 50 +vim.opt.timeoutlen = 400 +vim.opt.ttimeoutlen = 10 + +------------------------------------------------------------ +-- Backup, swap, undo +------------------------------------------------------------ +vim.opt.undofile = true +vim.opt.swapfile = false +vim.opt.backup = false +vim.opt.writebackup = false ------------------------------------------------------------ -- Search and highlighting ------------------------------------------------------------ -vim.opt.hlsearch = false -vim.opt.ignorecase = true -vim.opt.smartcase = true -vim.opt.incsearch = true -vim.opt.wildignore = { "*.o", "*.obj", "*.bak", "*.exe" } +vim.opt.hlsearch = false +vim.opt.ignorecase = true +vim.opt.smartcase = true +vim.opt.incsearch = true +vim.opt.wildignore = { "*.o", "*.obj", "*.bak", "*.exe" } ------------------------------------------------------------ -- Indentation and formatting ------------------------------------------------------------ -vim.opt.autoindent = true -vim.opt.cindent = true -vim.opt.smartindent = true -vim.opt.wrap = false -vim.opt.scrolloff = 5 -vim.opt.completeopt = { "menuone", "noinsert" } +vim.opt.autoindent = true +vim.opt.cindent = true +vim.opt.smartindent = true +vim.opt.wrap = false +vim.opt.scrolloff = 5 +vim.opt.completeopt = { "menuone", "noinsert" } ------------------------------------------------------------ -- Clipboard and mouse ------------------------------------------------------------ vim.opt.clipboard:append("unnamedplus") -vim.opt.mouse = "a" +vim.opt.mouse = "a" ------------------------------------------------------------ --- Session and history +-- Session and history (shada = viminfo replacement) ------------------------------------------------------------ -vim.opt.shada = "'100,<50,s10,h" -vim.opt.shadafile = vim.fn.expand("~/.local/state/nvim/shada/main.shada") +vim.opt.shada = "'100,<50,s10,h" +vim.opt.shadafile = vim.fn.expand("~/.local/state/nvim/shada/main.shada") ------------------------------------------------------------ -- Miscellaneous ------------------------------------------------------------ vim.opt.spelllang = { "en", "pl" } -vim.cmd("colorscheme pablo") vim.cmd("syntax on") +vim.opt.termguicolors = true +vim.cmd.colorscheme("pablo") --- Transparent background -vim.api.nvim_set_hl(0, "Normal", { bg = "none" }) -vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" }) +-- Transparency +vim.api.nvim_set_hl(0, "Normal", { bg = "none", ctermbg = "none" }) +vim.api.nvim_set_hl(0, "NormalFloat",{ bg = "none", ctermbg = "none" }) +vim.api.nvim_set_hl(0, "SignColumn", { bg = "none" }) +vim.api.nvim_set_hl(0, "FoldColumn", { bg = "none" }) ------------------------------------------------------------ -- Autocommands @@ -92,22 +127,48 @@ vim.api.nvim_create_autocmd("BufWritePost", { ------------------------------------------------------------ -- Key mappings ------------------------------------------------------------ -local map = vim.keymap.set -local opts = { noremap = true, silent = true } +vim.g.mapleader = " " + +-- Helper function for cleaner keymap definitions +-- Defaults: noremap = true, silent = true +local function map(mode, lhs, rhs, opts) + opts = opts or {} + opts.noremap = opts.noremap ~= false -- default true + opts.silent = opts.silent ~= false -- default true + opts.desc = opts.desc or nil -- optional description + + vim.keymap.set(mode, lhs, rhs, opts) +end + +-- Delete char before cursor + char under cursor +map('n', '<BS>', 'dBx', { desc = "Delete char before + under cursor" }) + +-- Insert blank line below current line and center view +map('n', 's', 'o<Esc>kzz', { desc = "Insert blank line below + center" }) + +-- Start substitute on current line (pre-filled :%s//g) +map('n', 'S', ':%s//g<Left><Left>', { silent = false, desc = "Substitute on current line" }) +-- Note: silent = false because it enters command-line mode -vim.g.mapleader = "\\" +-- Yank to end of line (consistent with D and C behavior) +map('n', 'Y', 'y$', { desc = "Yank to end of line" }) -map("n", "<BS>", "dBx", { noremap = true }) -map("n", "s", "o<Esc>kzz", { noremap = true }) -map("n", "S", ":%s//g<Left><Left>", { noremap = true }) -map("n", "Y", "y$", { noremap = true }) -map("n", "-", "ddp", { noremap = true }) -map("n", "_", "ddkP", { noremap = true }) -map("n", "<C-J>", '"+yy', { noremap = true }) -map("n", "<C-C>", '"+yW', { noremap = true }) -map("n", "<C-K>", '"+p', { noremap = true }) -map("n", "<space>", "i <esc>", { noremap = true }) -map("v", "<C-J>", '"+y', { noremap = true }) +-- Swap current line with the one below +map('n', '-', 'ddp', { desc = "Swap line with next" }) + +-- Swap current line with the one above +map('n', '_', 'ddkP', { desc = "Swap line with previous" }) + +-- System clipboard yank & paste (line / WORD) +map('n', '<C-j>', '"+yy', { desc = "Yank line to system clipboard" }) +map('n', '<C-c>', '"+yW', { desc = "Yank WORD to system clipboard" }) +map('n', '<C-k>', '"+p', { desc = "Paste from system clipboard after cursor" }) + +-- Yank selection to system clipboard +map('v', '<C-j>', '"+y', { desc = "Yank selection to system clipboard" }) + +-- Toggle buffers +map('n', '<Tab><Tab>', '<C-^>', { desc = "Toggle last / alternate buffer" }) ------------------------------------------------------------ -- Tabs & indentation @@ -130,7 +191,6 @@ vim.api.nvim_create_autocmd("FileType", { ------------------------------------------------------------ require("config.lazy") - ------------------------------------------------------------ -- luasnip ------------------------------------------------------------ |
