Adds more modular setup

This commit is contained in:
zwergius 2024-01-23 13:13:03 +01:00
parent 7633efd06c
commit d5a8a364dd
5 changed files with 71 additions and 0 deletions

View File

@ -0,0 +1,20 @@
return {
-- Set lualine as statusline
'nvim-lualine/lualine.nvim',
-- See `:help lualine.txt`
opts = {
options = {
icons_enabled = false,
theme = 'onenord',
component_separators = '|',
section_separators = '',
},
sections = {
lualine_c = {
{
'filename', path = 4
}
}
}
},
}

View File

@ -0,0 +1,7 @@
return {
'rmehri01/onenord.nvim',
priority = 1000,
config = function()
vim.cmd.colorscheme 'onenord'
end,
}

View File

@ -0,0 +1,9 @@
-- Easy save with CTRL + s
vim.keymap.set('n', '<C-s>', ':update<cr>', { noremap = true })
vim.keymap.set({ 'i', 'v' }, '<C-s>', '<Esc>:update<cr>', { noremap = true })
-- Split Movement
vim.keymap.set('n', '<C-h>', '<C-w>h', { noremap = true, silent = true })
vim.keymap.set('n', '<C-j>', '<C-w>j', { noremap = true, silent = true })
vim.keymap.set('n', '<C-k>', '<C-w>k', { noremap = true, silent = true })
vim.keymap.set('n', '<C-l>', '<C-w>l', { noremap = true, silent = true })

View File

@ -0,0 +1,24 @@
-- Line & relative line numbers
vim.opt.number = true
vim.opt.relativenumber = true
-- Indents
vim.opt.tabstop = 2
vim.opt.softtabstop = 2
vim.opt.shiftwidth = 2
vim.opt.expandtab = true
vim.opt.smartindent = true
-- Set highlight on search
vim.o.hlsearch = false
vim.opt.incsearch = true
-- Filetype overrides
vim.filetype.add({
extension = {
postcss = 'css',
}
})
-- Autocommand create folder(s) for new file
vim.cmd 'source ~/.config/nvim/vim/auto-mkdir.vim'

11
vim/auto-mkdir.vim Normal file
View File

@ -0,0 +1,11 @@
augroup vimrc-auto-mkdir
autocmd!
autocmd BufWritePre * call s:auto_mkdir(expand('<afile>:p:h'), v:cmdbang)
function! s:auto_mkdir(dir, force)
if !isdirectory(a:dir)
\ && (a:force
\ || input("'" . a:dir . "' does not exist. Create? [y/N]") =~? '^y\%[es]$')
call mkdir(iconv(a:dir, &encoding, &termencoding), 'p')
endif
endfunction
augroup END