163 lines
5.0 KiB
Lua
163 lines
5.0 KiB
Lua
-- Change diagnostic signs.
|
|
vim.fn.sign_define("DiagnosticSignError", { text = "✗", texthl = "DiagnosticSignError" })
|
|
vim.fn.sign_define("DiagnosticSignWarn", { text = "!", texthl = "DiagnosticSignWarn" })
|
|
vim.fn.sign_define("DiagnosticSignInformation", { text = "", texthl = "DiagnosticSignInfo" })
|
|
vim.fn.sign_define("DiagnosticSignHint", { text = "", texthl = "DiagnosticSignHint" })
|
|
-- global config for diagnostic
|
|
vim.diagnostic.config({
|
|
underline = false,
|
|
virtual_text = true,
|
|
signs = true,
|
|
severity_sort = true,
|
|
})
|
|
-- Variables
|
|
HOME = os.getenv("HOME")
|
|
|
|
-- Basic Functions/Settings
|
|
vim.opt.backspace = "indent,eol,start" -- backspace works on every char in insert mode
|
|
vim.opt.completeopt = 'menuone,noselect'
|
|
vim.opt.history = 1000
|
|
vim.opt.startofline = true
|
|
|
|
-- UI
|
|
vim.opt.background= 'dark'
|
|
vim.opt.termguicolors = true
|
|
vim.opt.ttyfast = true
|
|
vim.opt.autoread = true
|
|
vim.opt.hlsearch = true
|
|
vim.opt.number = true
|
|
vim.opt.title = true
|
|
vim.opt.scrolloff = 1000 -- center current line in screen
|
|
vim.opt.synmaxcol = 300 -- stop syntax highlight after x lines for performance
|
|
vim.opt.laststatus = 2 -- always show status line
|
|
|
|
-- Styleguide/Preferences
|
|
vim.opt.autoindent = true
|
|
|
|
-- Localization
|
|
vim.opt.encoding = "utf-8"
|
|
vim.opt.dictionary = '/usr/share/dict/words'
|
|
vim.opt.spelllang = 'en_ca'
|
|
|
|
-- Define files to spellcheck
|
|
vim.api.nvim_create_autocmd(
|
|
{
|
|
"BufRead",
|
|
"BufNewFile"
|
|
},{
|
|
pattern = {
|
|
"gitcommit",
|
|
"gitrebase",
|
|
"*.txt",
|
|
"*.md",
|
|
"*.tex"
|
|
},
|
|
command = "setlocal spell"
|
|
}
|
|
)
|
|
|
|
-- Mapping Timeouts
|
|
vim.opt.timeout = false
|
|
vim.opt.ttimeout = true
|
|
vim.opt.ttimeoutlen = 100
|
|
|
|
-- Display Hints/Highlights
|
|
vim.opt.colorcolumn="101"
|
|
vim.api.nvim_set_hl(0, 'ColorColumn', { bg='red' })
|
|
vim.api.nvim_set_hl(0, 'TODO', { bg='white' })
|
|
vim.api.nvim_set_hl(0, 'ExtraWhitespace', { bg='lightred' })
|
|
vim.cmd[[ match ExtraWhitespace /\s\+\%#\@<!$/ ]]
|
|
vim.cmd[[ match TODO /\bTODO\b/ ]]
|
|
|
|
vim.opt.showmatch = true -- show matching brackets
|
|
vim.opt.list = true
|
|
vim.opt.listchars = 'tab:» ,trail:·'
|
|
vim.opt.foldenable = false
|
|
vim.opt.foldlevel = 4 -- limit folding to 4 levels
|
|
vim.opt.foldmethod = 'syntax' -- use language syntax to generate folds
|
|
vim.opt.wrap = true --do not wrap lines even if very long
|
|
vim.opt.eol = false -- show if there's no eol char
|
|
vim.opt.showbreak= '↳' -- character to show when line is broken
|
|
-- Remove trailing whitespace
|
|
vim.api.nvim_create_autocmd(
|
|
{
|
|
"BufWritePre",
|
|
"BufWinEnter",
|
|
"InsertEnter",
|
|
"InsertLeave"
|
|
},{
|
|
pattern = { "*" },
|
|
command = [[%s/\s\+$//e]]
|
|
}
|
|
)
|
|
|
|
-- Sidebar
|
|
vim.opt.number = true -- line number on the left
|
|
vim.opt.numberwidth = 4 -- always reserve 4 spaces for line number
|
|
vim.opt.signcolumn = 'yes' -- keep 1 column for coc.vim check
|
|
vim.opt.modelines = 0
|
|
vim.opt.showcmd = true -- display command in bottom bar
|
|
|
|
-- Search
|
|
vim.opt.incsearch = true -- starts searching as soon as typing, without enter needed
|
|
vim.opt.ignorecase = true -- ignore letter case when searching
|
|
vim.opt.smartcase = true -- case insentive unless capitals used in search
|
|
vim.opt.matchtime = 2 -- delay before showing matching paren
|
|
|
|
-- White characters
|
|
vim.opt.autoindent = true
|
|
vim.opt.smartindent = true
|
|
vim.opt.tabstop = 4 -- 1 tab = 2 spaces
|
|
vim.opt.shiftwidth = 4 -- indentation rule
|
|
vim.opt.formatoptions = 'qnj1' -- q - comment formatting; n - numbered lists; j - remove comment when joining lines; 1 - don't break after one-letter word
|
|
vim.opt.expandtab = true -- expand tab to spaces
|
|
|
|
-- Backup files
|
|
vim.opt.undodir = HOME .. '/.spool/nvim/tmp/undo//' -- undo files
|
|
vim.opt.backup = true -- use backup files
|
|
vim.opt.writebackup = true -- use temporary backup during write
|
|
vim.opt.backupdir = HOME .. '/.spool/nvim/tmp/backup//' -- backups
|
|
vim.opt.swapfile = false -- don't use swap file
|
|
--vim.opt.directory = HOME .. '/.spool/nvim/tmp/swap//' -- swap files
|
|
|
|
-- Commands mode
|
|
vim.opt.wildmenu = true -- on TAB, complete options for system command
|
|
vim.opt.wildignore = 'deps,.svn,CVS,.git,.hg,*.o,*.a,*.class,*.mo,*.la,*.so,*.obj,*.swp,*.jpg,*.png,*.xpm,*.gif,.DS_Store,*.aux,*.out,*.toc'
|
|
|
|
-- Executables
|
|
vim.g.python3_host_prog = "/var/home/jpm/.pyenv/shims/python3"
|
|
vim.g.python_host_prog = "/var/home/jpm/.pyenv/shims/python2"
|
|
|
|
-- Theme
|
|
vim.opt.background = 'dark'
|
|
vim.colorscheme = 'gruvbox'
|
|
vim.cmd([[
|
|
set t_Co=256
|
|
let g:airline_theme="base16_gruvbox_dark_hard"
|
|
let g:gruvbox_contrast_dark="hard"
|
|
let g:gruvbox_italic=1
|
|
let g:gruvbox_bold=1
|
|
let g:gruvbox_underline=1
|
|
let g:gruvbox_undercurl=1
|
|
let g:gruvbox_termcolors=256
|
|
syn on se title
|
|
]])
|
|
|
|
-- Abbreviations
|
|
vim.cmd([[
|
|
source ${HOME}/.dotfiles/vim/abbreviations/personalAbbreviations.vim
|
|
source ${HOME}/.dotfiles/vim/abbreviations/codingAbbreviations.vim
|
|
]])
|
|
|
|
-- Fix indentation in file
|
|
--viml: map <leader>i mmgg=G`m<CR>
|
|
vim.g.mapleader = ','
|
|
vim.g.maplocalleader = '\\'
|
|
vim.keymap.set("i", "kj", "<esc>", { silent = true })
|
|
|
|
-- Configure tabline
|
|
vim.cmd([[
|
|
set showtabline=2
|
|
let g:tablabel = "%N%{flagship#tabmodified()} %{flagship#tabcwds('shorten',',')}"
|
|
]])
|