mirror of
https://github.com/pnx/dotfiles
synced 2026-06-16 19:30:01 +02:00
Update nvim config
This commit is contained in:
parent
d7a1770460
commit
461e0cc49a
27 changed files with 426 additions and 2999 deletions
22
nvim/lua/config/base.lua
Normal file
22
nvim/lua/config/base.lua
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
--
|
||||
-- General Settings
|
||||
--
|
||||
|
||||
vim.opt.showmode = false -- disable mode in the command line, because i use lualine
|
||||
--vim.opt.guicursor = "a:ver100,c-ci-cr:hor80-blinkon100-blinkwait300"
|
||||
--vim.opt.scrolloff = 30
|
||||
--vim.opt.sidescrolloff = 8
|
||||
|
||||
--
|
||||
-- Editor settings
|
||||
--
|
||||
|
||||
vim.opt.cursorline = true -- highlight line where cursor is.
|
||||
|
||||
-- line numbers
|
||||
vim.opt.number = true
|
||||
vim.opt.relativenumber = true
|
||||
vim.opt.numberwidth = 6
|
||||
|
||||
-- indent
|
||||
vim.opt.smartindent = true
|
||||
31
nvim/lua/config/indent.lua
Normal file
31
nvim/lua/config/indent.lua
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
local autocmd = vim.api.nvim_create_autocmd
|
||||
local augroup = vim.api.nvim_create_augroup
|
||||
local set = vim.opt
|
||||
|
||||
set.tabstop = 4
|
||||
set.softtabstop = 4
|
||||
set.shiftwidth = 4
|
||||
set.autoindent = true
|
||||
|
||||
augroup('indent', { clear = true })
|
||||
|
||||
-- Hardtabs for make
|
||||
autocmd('Filetype', {
|
||||
group = 'indent',
|
||||
pattern = { 'make' },
|
||||
command = 'setlocal ts=4 sts=0 sw=4 noexpandtab'
|
||||
})
|
||||
|
||||
-- Softtab (2) for yaml
|
||||
autocmd('Filetype', {
|
||||
group = 'indent',
|
||||
pattern = { 'yaml' },
|
||||
command = 'setlocal ts=2 sts=2 sw=2 expandtab'
|
||||
})
|
||||
|
||||
-- Hardtabs for c/cpp
|
||||
autocmd('Filetype', {
|
||||
group = 'indent',
|
||||
pattern = { 'c', 'cpp' },
|
||||
command = 'setlocal ts=8 sts=0 sw=8 noexpandtab'
|
||||
})
|
||||
3
nvim/lua/config/init.lua
Normal file
3
nvim/lua/config/init.lua
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
require("config.base")
|
||||
require("config.keybinds")
|
||||
require("config.indent")
|
||||
39
nvim/lua/config/keybinds.lua
Normal file
39
nvim/lua/config/keybinds.lua
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
-- Basic ones
|
||||
vim.g.mapleader = " "
|
||||
vim.keymap.set("n", "<leader>pv", vim.cmd.Ex)
|
||||
|
||||
vim.keymap.set("i", "<C-z>", vim.cmd.undo)
|
||||
vim.keymap.set("i", "<C-y>", vim.cmd.redo)
|
||||
|
||||
-- Ctrl+s saves the current buffer in normal/insert mode.
|
||||
vim.keymap.set("n", "<C-s>", vim.cmd.w)
|
||||
vim.keymap.set("i", "<C-s>", vim.cmd.w)
|
||||
|
||||
-- Disable arrow keys (force me to use hjkl)
|
||||
|
||||
vim.keymap.set("n", "<Up>", "", { noremap=true })
|
||||
vim.keymap.set("n", "<Down>", "", { noremap=true })
|
||||
vim.keymap.set("n", "<Left>", "", { noremap=true })
|
||||
vim.keymap.set("n", "<Right>", "", { noremap=true })
|
||||
|
||||
vim.keymap.set("i", "<Up>", "", { noremap=true })
|
||||
vim.keymap.set("i", "<Down>", "", { noremap=true })
|
||||
vim.keymap.set("i", "<Left>", "", { noremap=true })
|
||||
vim.keymap.set("i", "<Right>", "", { noremap=true })
|
||||
|
||||
vim.keymap.set("v", "<Up>", "", { noremap=true })
|
||||
vim.keymap.set("v", "<Down>", "", { noremap=true })
|
||||
vim.keymap.set("v", "<Left>", "", { noremap=true })
|
||||
vim.keymap.set("v", "<Right>", "", { noremap=true })
|
||||
-- Move Text
|
||||
--vim.keymap.set("n", "<S-a>", ":m+1<CR>")
|
||||
--vim.keymap.set("v", "<S-d>", ":m-2<CR>")
|
||||
|
||||
--vim.keymap.set("v", "<S-a>", ":m+1<CR>")
|
||||
--vim.keymap.set("n", "<S-d>", ":m-2<CR>")
|
||||
|
||||
-- Indent
|
||||
|
||||
-- Make Shift-Tab undo indent.
|
||||
vim.keymap.set("i", "<S-Tab>", "<C-d>")
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue