Thomas Gideon
45af25f204
LSP breaks this because overlays with multiple lines are opened with a filetype of text causing the colorscheme to change unpredictably and sometimes break. Moved wiki/diary specific colorscheme to a project specific config outside of this repo.
139 lines
4.2 KiB
Lua
139 lines
4.2 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")
|
|
|
|
if vim.g.neovide then
|
|
require("size-matters")
|
|
end
|
|
|
|
-- 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 directory as well as $MYVIMRC
|
|
-- e.g. place .nvim.lua at the root of a project directory for project specific settings
|
|
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 desert")
|
|
vim.opt.background = "dark"
|
|
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"
|
|
|
|
if vim.fn.has('macunix') then
|
|
vim.opt.gfn = "FiraCode Nerd Font Mono:h16"
|
|
else
|
|
vim.opt.gfn = "FiraCode Nerd Font Mono:h12"
|
|
end
|
|
|
|
if not vim.fn.has('macunix') then
|
|
require('nvim-projectconfig').setup({autocmd=true})
|
|
end
|
|
require("trouble").setup {
|
|
-- your configuration comes here
|
|
-- or leave it empty to use the default settings
|
|
-- refer to the configuration section below
|
|
}
|