move most important config to ansible
This commit is contained in:
2
roles/nvim/files/lua/config/core/init.lua
Normal file
2
roles/nvim/files/lua/config/core/init.lua
Normal file
@ -0,0 +1,2 @@
|
||||
require('config.core.keymaps')
|
||||
require('config.core.options')
|
||||
26
roles/nvim/files/lua/config/core/keymaps.lua
Normal file
26
roles/nvim/files/lua/config/core/keymaps.lua
Normal file
@ -0,0 +1,26 @@
|
||||
local keymap = vim.keymap
|
||||
|
||||
|
||||
local opts = { noremap = true, silent = true }
|
||||
|
||||
-- INSERT MODE
|
||||
|
||||
-- map `ctrl + backspace` to delete previous word in insert mode
|
||||
keymap.set('i', '<C-BS>', '<C-W>', opts)
|
||||
|
||||
-- map `ctrl + delete` to delete next word in insert mode
|
||||
keymap.set('i', '<C-Del>', '<C-o>dw', opts)
|
||||
|
||||
|
||||
-- NORMAL MODE
|
||||
|
||||
-- navigate in visual linewraps
|
||||
keymap.set('n', 'k', 'gk', opts)
|
||||
keymap.set('n', 'j', 'gj', opts)
|
||||
keymap.set('n', '<UP>', 'gk', opts)
|
||||
keymap.set('n', '<DOWN>', 'gj', opts)
|
||||
|
||||
-- COMMANDS
|
||||
|
||||
-- print current working directory
|
||||
vim.api.nvim_create_user_command('Cwd', function() print(vim.fn.getcwd()) end, {})
|
||||
44
roles/nvim/files/lua/config/core/options.lua
Normal file
44
roles/nvim/files/lua/config/core/options.lua
Normal file
@ -0,0 +1,44 @@
|
||||
local opt = vim.opt
|
||||
|
||||
-- numbers
|
||||
opt.relativenumber = true
|
||||
opt.number = true
|
||||
|
||||
-- enable mouse in all modes
|
||||
opt.mouse = 'a'
|
||||
-- opt.mousemoveevent = true
|
||||
|
||||
-- tabs
|
||||
opt.autoindent = true
|
||||
opt.tabstop = 4
|
||||
opt.softtabstop = 4
|
||||
opt.shiftwidth = 4
|
||||
opt.smarttab = true
|
||||
|
||||
-- default encodings to utf-8
|
||||
opt.encoding = 'utf-8'
|
||||
opt.fileencoding = 'utf-8'
|
||||
-- opt.termencoding = 'utf-8' -- currently broken
|
||||
|
||||
-- folds
|
||||
opt.foldmethod = 'indent'
|
||||
opt.foldlevelstart = 99
|
||||
opt.foldlevel = 1
|
||||
|
||||
-- search
|
||||
opt.ignorecase = true
|
||||
opt.smartcase = true
|
||||
|
||||
-- styling
|
||||
opt.scrolloff = 5
|
||||
opt.wrap = true
|
||||
opt.showbreak = '++'
|
||||
opt.breakindent = true
|
||||
opt.linebreak = true
|
||||
opt.termguicolors = true
|
||||
|
||||
-- Remove autoformatting of
|
||||
-- 't' text using textwidth
|
||||
-- 'c' comments using textwidth
|
||||
opt.formatoptions:remove('t')
|
||||
opt.formatoptions:remove('c')
|
||||
Reference in New Issue
Block a user