nvim: moved remaps and vim set commands to their own files, and tweaked

settings
This commit is contained in:
kalmenn 2023-12-17 23:26:12 +01:00
parent 6a6660ea31
commit e126fcbb0f
Signed by: kalmenn
GPG key ID: DFF253360BF8471F
4 changed files with 61 additions and 19 deletions

View file

@ -21,23 +21,7 @@ require('lazy').setup({ { import = "plugins" } })
- https://github.com/fedepujol/move.nvim
]]
vim.keymap.set('n', '<A-k>', ':move -2<CR>')
vim.keymap.set('n', '<A-up>', ':move -2<CR>')
vim.keymap.set('n', '<A-j>', ':move +1<CR>')
vim.keymap.set('n', '<A-down>', ':move +1<CR>')
vim.o.number = true
vim.o.relativenumber = true
vim.opt.list = true
vim.opt.listchars = { tab = '', trail = '·' }
vim.opt.expandtab = true
vim.opt.tabstop = 4
vim.opt.softtabstop = vim.opt.tabstop:get()
vim.opt.shiftwidth = 4
vim.opt.fillchars:append({ eob = ' ' })
require("sets")
require("remaps")
vim.notify("starting nvim 🏕️")

View file

@ -2,7 +2,7 @@ return {
"mbbill/undotree",
keys = {
{
"<C-u>",
"<A-u>",
function()
vim.cmd.UndotreeToggle();
vim.cmd.UndotreeFocus();

View file

@ -0,0 +1,12 @@
-- move selected lines and auto indent
vim.keymap.set("v", "<A-j>", ":m '>+1<CR>gv=gv")
vim.keymap.set("v", "<A-k>", ":m '<-2<CR>gv=gv")
-- zz centers the cursor
vim.keymap.set("n", "<C-d>", "<C-d>zz")
vim.keymap.set("n", "<C-u>", "<C-u>zz")
vim.keymap.set("n", "n", "nzzzv")
vim.keymap.set("n", "N", "Nzzzv")

46
.config/nvim/lua/sets.lua Normal file
View file

@ -0,0 +1,46 @@
-- line numbers
vim.o.number = true
vim.o.relativenumber = true
-- show hidden characters
vim.opt.list = true
vim.opt.listchars = { tab = '', trail = '·' }
-- indentation
vim.opt.expandtab = true
vim.opt.tabstop = 4
vim.opt.softtabstop = vim.opt.tabstop:get()
vim.opt.shiftwidth = 4
vim.opt.smartindent = true
-- line wrapping
vim.opt.wrap = false
-- undo history
vim.opt.swapfile = false
vim.opt.backup = false
vim.opt.undodir = os.getenv("HOME") .. "/.local/state/nvim/undodir"
vim.opt.undofile = true
vim.opt.updatetime = 50
-- end search when exiting
vim.opt.hlsearch = false
vim.opt.incsearch = true
-- stuff
vim.opt.fillchars:append({ eob = ' ' })
vim.opt.termguicolors = true
vim.opt.scrolloff = 8
vim.opt.colorcolumn = "80"