Start converting to Lua

This commit is contained in:
Thomas Gideon 2022-10-30 13:27:18 -04:00
parent d561d1964e
commit 1bcdea7a37

132
init.lua Normal file
View file

@ -0,0 +1,132 @@
local vimrc_git = os.getenv("HOME") .. "/src/vimrc"
vim.cmd("source " .. vimrc_git .. "/plug.vim")
vim.cmd("source " .. vimrc_git .. "/airline.vim")
vim.cmd("source " .. vimrc_git .. "/syntastic.vim")
vim.cmd("source " .. vimrc_git .. "/fzf.vim")
vim.cmd("source " .. vimrc_git .. "/lsp.vim")
vim.cmd("source " .. vimrc_git .. "/mapping.vim")
vim.cmd("source " .. vimrc_git .. "/jsonnet.vim")
vim.cmd("source " .. vimrc_git .. "/nerdtree.vim")
vim.cmd("source " .. vimrc_git .. "/wiki.vim")
-- set up a line number on the current line but relative above and below to
-- help with motion commands
vim.opt.number = true
vim.opt.relativenumber = true
-- even with the nice space/tab autodetect, prefer 4 for tab stops but let file
-- type specifics override (for instance a setting of 2 for markdown
vim.opt.tabstop = 4
-- default to folding on syntax
vim.opt.foldmethod = "syntax"
-- disable automatic line breaks, rely on visual wrapping instead
vim.opt.textwidth = 0
-- make white space visible, where that matters
vim.opt.list = true
local function nolist()
vim.opt.list = false
end
-- make white space invisible only in help text
vim.api.nvim_create_autocmd("FileType", {
pattern = "help",
callback = nolist,
})
-- set up folding preferences
vim.opt.fde = "1"
-- vim's spelling is smart enough for code, to only check comments
vim.opt.spell = true
-- add a hint for long lines
vim.opt.colorcolumn = "120"
-- default to expanding tabs, I'm not insane
vim.opt.expandtab = true
-- change buffer behaviors to no longer require changes when hiding a buffer
vim.opt.hidden = true
-- look for vimrc in the current director as well as $MYVIMRC
vim.opt.exrc = true
-- make looking for local changes secure
vim.opt.secure = true
-- more secure
vim.opt.modelines = 0
-- preserve some context
vim.opt.scrolloff = 3
-- make the cursor a bit easier to follows
vim.opt.cursorline = true
-- make search work a bit more like tab completion in bash
vim.opt.incsearch = true
vim.opt.wildmode = "longest:full"
vim.opt. wildmenu = true
-- line break handling
vim.opt.linebreak = true
vim.opt.showbreak = "+"
-- always on status line
vim.opt.laststatus = 2
-- let backspace work more naturally
vim.opt.backspace = "start,indent,eol"
-- favor modern encoding
vim.opt.enc = "utf-8"
-- more readable config for list mode
vim.opt.listchars = {nbsp = '¬', tab = '»·', trail = '·'}
-- smarter handling of case during search
vim.opt.ignorecase = true
vim.opt.smartcase = true
-- centralize swap to have backup without clutter
vim.opt.directory = os.getenv("HOME") .. "/.var/nvim/swp//"
-- and undo
vim.opt.undofile = true
vim.opt.undodir = os.getenv("HOME") .. "/.nvim/undodir"
-- make pastemode more accessible
vim.opt.pastetoggle = "<F2>"
-- save when moving away
--au FocusLost * :wa
-- make sure to set TERM to xterm-256color in terminal program or app
vim.cmd("colorscheme breezy")
vim.opt.background = "light"
vim.opt.termguicolors = true
-- ensure autoread works, to detect file changes outside the editor
vim.opt.autoread = true
-- au CursorHold * checktime
-- for gui, make it easier to tell different instances apart
vim.opt.title = true
-- keep nvim from resetting font back to default from terminal config
vim.opt.guicursor = nil
local guiopts = vim.opt.guioptions
guiopts = guiopts:gsub("r", "")
guiopts = guiopts:gsub("b", "")
guiopts = guiopts:gsub("T", "")
guiopts = guiopts:gsub("m", "")
vim.opt.guioptions = guiopts
vim.opt.mouse = "nv"
vim.opt.gfn = "FiraCode Nerd Font Mono:h12"
-- from https://stackoverflow.com/a/51424640
-- let s:fontsize = 14
-- function! AdjustFontSize(amount)
-- let s:fontsize = s:fontsize+a:amount
-- :execute --set gfn=FiraCode\\ Nerd\\ Font\\ Mono:h" . s:fontsize
-- endfunction
--
-- noremap <C-Up> :call AdjustFontSize(1)<CR>
-- noremap <C-Down> :call AdjustFontSize(-1)<CR>
-- inoremap <C-Up> <Esc>:call AdjustFontSize(1)<CR>a
-- inoremap <C-Down> <Esc>:call AdjustFontSize(-1)<CR>a
require('nvim-projectconfig').setup({autocmd=true})
require("trouble").setup {
-- your configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
}