modify init.lua

This commit is contained in:
randomuser 2023-01-31 11:28:10 -06:00
parent 64284e3a4a
commit f3db327f0c
1 changed files with 49 additions and 29 deletions

View File

@ -6,36 +6,41 @@
-- |_|_| |_|_|\__(_)_|\__,_|\__,_| -- |_|_| |_|_|\__(_)_|\__,_|\__,_|
-- helper functions {{{ -- helper functions {{{
local keymapper = vim.keymap
local globals = vim.g
local opt = vim.o
local cmd = vim.cmd
function nnoremap(l, r) function nnoremap(l, r)
vim.keymap.set('n', l, r) -- noremap is implied keymapper.set('n', l, r) -- noremap is implied
end end
function inoremap(l, r) function inoremap(l, r)
vim.keymap.set('i', l, r) keymapper.set('i', l, r)
end end
function tnoremap(l, r) function tnoremap(l, r)
vim.keymap.set('t', l, r) keymapper.set('t', l, r)
end end
-- }}} -- }}}
-- custom mappings {{{ -- custom mappings {{{
vim.g.mapleader = ' ' globals.mapleader = ' '
nnoremap(';', ':') nnoremap(';', ':')
nnoremap(':', ';') nnoremap(':', ';')
nnoremap('<leader><leader>', ':') nnoremap('<leader><leader>', ':')
-- source init.vim -- source init.vim
nnoremap('<leader>rr', function() nnoremap('<leader>rr', function()
vim.cmd.source('~/.config/nvim/init.lua') cmd.source('~/.config/nvim/init.lua')
end) end)
-- edit init.vim -- edit init.vim
nnoremap('<leader>re', function() nnoremap('<leader>re', function()
vim.cmd.edit('~/.config/nvim/init.lua') cmd.edit('~/.config/nvim/init.lua')
end) end)
-- openup netrw -- openup netrw
nnoremap('<leader>fs', function() nnoremap('<leader>fs', function()
vim.cmd.Lexplore() cmd.Lexplore()
end) end)
inoremap('qp', '<c-g>u<Esc>[s1z=`]a<c-g>u') inoremap('qp', '<c-g>u<Esc>[s1z=`]a<c-g>u')
@ -87,28 +92,39 @@ vim.api.nvim_create_autocmd({"Filetype"}, {
-- }}} -- }}}
-- vim options {{{ -- vim options {{{
vim.o.compatible = false opt.compatible = false
vim.o.number = true opt.number = true
vim.o.foldmethod = 'marker' opt.foldmethod = 'marker'
vim.o.encoding = 'utf8' opt.encoding = 'utf8'
vim.o.list = true opt.list = true
vim.o.lcs = 'tab:->,trail:_,eol:^' opt.lcs = 'tab:->,trail:_,eol:^'
vim.o.clipboard = 'unnamedplus' opt.clipboard = 'unnamedplus'
vim.o.spell = true opt.spell = true
vim.o.spelllang = "en_us" opt.spelllang = "en_us"
vim.o.title = true opt.title = true
vim.o.ts = 2 opt.ts = 2
vim.o.sw = 2 opt.sw = 2
vim.o.hlsearch = true opt.hlsearch = true
vim.o.incsearch = true opt.incsearch = true
vim.o.ignorecase = true opt.ignorecase = true
vim.o.smartcase = true opt.smartcase = true
vim.o.inccommand = 'nosplit' opt.inccommand = 'nosplit'
vim.o.hidden = true opt.hidden = true
vim.opt.path:append {'**'} opt.path = '.,/usr/include,**'
vim.cmd.colorscheme('earth') vim.cmd.colorscheme('earth')
vim.o.statusline="%f %r%m%q%h%=%y 0x%02B %04l:%03c:%03p" opt.statusline="%f %r%m%q%h%=%y 0x%02B %04l:%03c:%03p"
vim.api.nvim_exec("let &titlestring='%{expand(\"%:p\")}'", true) vim.api.nvim_exec("let &titlestring='%{expand(\"%:p\")}'", true)
globals.vimtex_view_method = 'zathura'
-- }}}
-- netrw options {{{
globals.netrw_winsize = -28
globals.netrw_banner = 0
-- for tree view
globals.netrw_liststyle = 3
-- use previous window to open files
globals.netrw_browser_split = 4
-- }}} -- }}}
-- packer.nvim {{{ -- packer.nvim {{{
@ -128,10 +144,14 @@ local packer_bootstrap = ensure_packer()
return require('packer').startup(function(use) return require('packer').startup(function(use)
use 'wbthomason/packer.nvim' use 'wbthomason/packer.nvim'
use 'vimwiki/vimwiki' use 'tpope/vim-surround'
use 'tpope/vim-commentary'
use 'tpope/vim-fugitive'
use 'https://github.com/vimwiki/vimwiki.git'
use 'lervag/vimtex'
if packer_bootstrap then if packer_bootstrap then
require('packer').sync() require('packer').sync()
end end
end) end);
-- }}} -- }}}