128 lines
3.9 KiB
Lua
128 lines
3.9 KiB
Lua
local vimrc_git = os.getenv("HOME") .. "/src/vimrc"
|
|
|
|
-- it is a big fat key, after all
|
|
-- N.B. should come before plugins and plugin specific settings
|
|
vim.g.mapleader = ' '
|
|
|
|
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
|
|
vim.api.nvim_create_autocmd("FocusLost", {pattern = "*", command = "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
|
|
vim.api.nvim_create_autocmd("CursorHold", {pattern = "*", command = "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.g.guioptions
|
|
if guiopts == nil then
|
|
guiopts = ""
|
|
end
|
|
guiopts = guiopts:gsub("r", "")
|
|
guiopts = guiopts:gsub("b", "")
|
|
guiopts = guiopts:gsub("T", "")
|
|
guiopts = guiopts:gsub("m", "")
|
|
|
|
vim.g.guioptions = guiopts
|
|
|
|
vim.opt.mouse = "nv"
|
|
|
|
vim.opt.gfn = "FiraCode Nerd Font Mono:h12"
|
|
|
|
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
|
|
}
|