etc/vimrc

423 lines
11 KiB
VimL

se nocompatible
call plug#begin('~/.vim/plugged')
Plug 'tpope/vim-sensible'
Plug 'ntpeters/vim-better-whitespace'
Plug 'nathanaelkane/vim-indent-guides'
Plug 'chrisbra/Recover.vim'
Plug 'Shougo/vimproc.vim' , { 'do': 'make -f make_unix.mak' }
Plug 'ciaranm/securemodelines'
Plug 'chrisbra/SudoEdit.vim'
Plug 'majutsushi/tagbar'
Plug 'bling/vim-airline'
Plug 'tomtom/tcomment_vim'
" Plug 'jalcine/cmake.vim' --slow
Plug 'editorconfig/editorconfig-vim'
" vim-sleuth?
" Plug 'kchmck/vim-coffee-script' " BANNED for messing with html indentation
Plug 'pangloss/vim-javascript'
Plug 'mtscout6/vim-cjsx'
Plug 'mxw/vim-jsx'
Plug 'othree/html5.vim'
Plug 'digitaltoad/vim-jade'
Plug 'ledger/vim-ledger'
Plug 'dag/vim2hs'
" clojure
Plug 'tpope/vim-leiningen'
Plug 'tpope/vim-projectionist'
Plug 'tpope/vim-dispatch'
Plug 'tpope/vim-fireplace'
Plug 'jnwhiteh/vim-golang'
Plug 'Blackrush/vim-gocode'
Plug 'zah/nimrod.vim'
Plug 'wting/rust.vim'
Plug 'cespare/vim-toml'
Plug 'derekwyatt/vim-scala'
Plug 'dogrover/vim-pentadactyl'
Plug 'superbrothers/vim-vimperator'
Plug 'idris-hackers/idris-vim'
Plug 'tpope/vim-fugitive' " git integration
Plug 'airblade/vim-gitgutter'
Plug 'lervag/vimtex'
Plug 'kana/vim-textobj-user'
Plug 'kana/vim-textobj-indent'
Plug 'rhysd/vim-grammarous'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-characterize'
Plug 'peterhoeg/vim-qml'
Plug 'ekalinin/Dockerfile.vim'
Plug 'jvoorhis/coq.vim'
Plug 'LnL7/vim-nix'
Plug 'urbit/hoon.vim'
Plug 'ahf/twelf-syntax'
Plug 'c-cube/vim-tptp'
Plug 'sirtaj/vim-openscad'
" Plug 'nanotech/jellybeans.vim'
" Plug 'sonph/onehalf', { 'rtp': 'vim' }
" Plug 'polirritmico/monokai-nightasty.nvim'
" Plug '~/dgapt', { 'rtp': 'vim' }
Plug 'rickhowe/diffchar.vim'
Plug 'raichoo/smt-vim'
Plug 'tkztmk/vim-vala'
Plug 'wlangstroth/vim-racket'
Plug 'dag/vim-fish'
Plug 'elixir-editors/vim-elixir'
" Plug 'glacambre/firenvim', { 'do': { _ -> firenvim#install(0) } }
if has('nvim-0.5')
Plug 'nvim-lua/plenary.nvim'
" Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
" Plug 'nvim-treesitter/nvim-treesitter-textobjects'
" Plug 'nvim-treesitter/playground'
Plug 'hrsh7th/cmp-nvim-lsp'
Plug 'hrsh7th/cmp-buffer'
Plug 'hrsh7th/cmp-path'
Plug 'hrsh7th/cmp-cmdline'
Plug 'hrsh7th/nvim-cmp'
if isdirectory(expand('~/lean.nvim'))
Plug '~/lean.nvim'
else
Plug 'Julian/lean.nvim'
endif
Plug 'neovim/nvim-lspconfig'
Plug 'folke/neodev.nvim'
Plug 'simrat39/rust-tools.nvim'
Plug 'nvim-lua/popup.nvim'
Plug 'nvim-lua/plenary.nvim'
Plug 'nvim-telescope/telescope.nvim'
Plug 'gebner/VimFStar'
Plug 'hashivim/vim-terraform'
else
Plug 'junegunn/fzf', { 'dir': '~/.fzf' }
Plug 'junegunn/fzf.vim'
endif
call plug#end()
filetype plugin indent on
set tw=0 expandtab ts=8 sts=2 sw=2 sm ai si
set noml mls=5 " scan 5 lines for modelines
syn on " enable syntax highlighting
set hls " highlight search
" set bg=dark " dark background
se foldlevel=99
set vb " turn on the "visual bell" - which is much quieter than the "audio blink"
set nobackup
se bs=2
se nosc " disable flashing partial commands in status bar
set backupcopy=yes
se inccommand=nosplit
set mouse=nv
set title
se scl=yes:1 " say no to wobbly side column
let mapleader=" "
let g:jellybeans_overrides = {
\ 'background': { 'guibg': '000000' },
\ 'Normal': { 'guifg': 'ffffff' },
\ 'SignColumn': { 'guibg': '191919' },
\}
" if exists('g:started_by_firenvim')
" set bg=light
" colors onehalflight
" else
" colors jellybeans
" endif
" colors monokai-nightasty
colors vim
au syntax java setl ts=4 sts=4 sw=4
au BufNewFile,BufRead *.s setl ft=tptp
au BufNewFile,BufRead *.s.out setl ft=tptp
au BufNewFile,BufRead *.tptp setl ft=tptp
au BufNewFile,BufRead *.smt2 setl ft=smt
au BufReadCmd *.epub call zip#Browse(expand("<amatch>"))
au BufReadCmd *.FCStd call zip#Browse(expand("<amatch>"))
let g:haskell_conceal = 0
call tcomment#type#Define('nix', '# %s')
call tcomment#type#Define('chaskell', '-- %s')
call tcomment#type#Define('vala', '// %s')
call tcomment#type#Define('tptp', '%% %s')
call tcomment#type#Define('lean', '-- %s')
call tcomment#type#Define('lean3', '-- %s')
au syntax tex setl iskeyword+=:
au syntax tex syn region texZone start="\\begin{clilisting}" end="\\end{clilisting}\|%stopzone\>"
au syntax tex syn region texZone start="\\begin{tacticslisting}" end="\\end{tacticslisting}\|%stopzone\>"
au syntax tex syn region texZone start="\\begin{tacticsoutput}" end="\\end{tacticsoutput}\|%stopzone\>"
" disable annoying "file is read-only" warnings
au FileChangedRO * set noreadonly
if has('nvim-0.5')
lua <<EOF
require('lean').setup{
abbreviations = {
extras = {
},
builtin = true,
},
mappings = true,
infoview = {
autoopen = false,
},
-- treesitter = {},
lsp = {
on_attach = function(client, bufnr)
vim.api.nvim_exec([[
augroup lsp_document_highlight
autocmd!
" autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()
" autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references()
augroup END
]], false)
end,
init_options = {
semanticHighlighting = true,
},
},
}
require'fstar'.setup{}
-- require('nvim-treesitter.configs').setup{
-- -- playground = {
-- -- enable = true,
-- -- disable = {},
-- -- updatetime = 25,
-- -- },
-- -- query_linter = {
-- -- enable = true,
-- -- use_virtual_text = true,
-- -- lint_events = {"BufWrite", "CursorHold"},
-- -- },
-- highlight = { enable = true },
-- indent = { enable = true },
-- textobjects = {
-- select = {
-- enable = true,
-- keymaps = {
-- ["af"] = "@function.outer",
-- ["if"] = "@function.inner",
-- ["ac"] = "@class.outer",
-- ["ic"] = "@class.inner",
-- ["aa"] = "@parameter.outer",
-- ["ia"] = "@parameter.inner",
-- },
-- },
-- },
-- }
local cmp = require'cmp'
cmp.setup {
enabled = true;
-- autocomplete = false;
-- debug = false;
-- min_length = 1;
-- preselect = 'enable';
-- throttle_time = 80;
-- source_timeout = 200;
-- incomplete_delay = 400;
-- max_abbr_width = 100;
-- max_kind_width = 100;
-- max_menu_width = 100;
-- documentation = true;
mapping = cmp.mapping.preset.insert({
['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.abort(),
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
});
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
-- { name = 'vsnip' }, -- For vsnip users.
-- { name = 'luasnip' }, -- For luasnip users.
-- { name = 'ultisnips' }, -- For ultisnips users.
-- { name = 'snippy' }, -- For snippy users.
}, {
{ name = 'buffer' },
});
}
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
vim.lsp.diagnostic.on_publish_diagnostics, {
-- Enable underline, use default values
underline = true,
-- Enable virtual text, override spacing to 4
virtual_text = {
spacing = 4,
},
-- Use a function to dynamically turn signs off
-- and on, using buffer local variables
-- signs = function(bufnr, client_id)
-- return vim.bo[bufnr].show_signs == false
-- end,
update_in_insert = true,
})
vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(
vim.lsp.handlers.hover, {
-- Use a sharp border with `FloatBorder` highlights
border = "single"
})
local luadev = require("neodev").setup({
lspconfig = {
cmd = {"lua-language-server"}
},
})
local lspconfig = require('lspconfig')
lspconfig.lua_ls.setup(luadev)
lspconfig.ccls.setup{}
lspconfig.pylsp.setup{}
lspconfig.ts_ls.setup{}
lspconfig.texlab.setup{}
lspconfig.terraformls.setup{}
-- require'monokai-nightasty'.load{ }
--vim.lsp.set_log_level("debug")
require('rust-tools').setup{}
require('telescope').setup{
defaults = {
file_ignore_patterns = {
'stage0/.*'
},
},
}
require'osc52'
EOF
hi LspReferenceRead cterm=bold ctermbg=red guibg=#303030
hi LspReferenceText cterm=bold ctermbg=red guibg=#303030
hi LspReferenceWrite cterm=bold ctermbg=red guibg=#303030
hi LspDiagnosticsDefaultError cterm=bold ctermfg=Red
hi LspDiagnosticsDefaultWarning cterm=bold ctermfg=Yellow
hi LspDiagnosticsDefaultInformation ctermfg=Blue
hi LspDiagnosticsUnderlineError gui=undercurl
hi LspDiagnosticsUnderlineWarning gui=undercurl
hi LspDiagnosticsUnderlineInformation gui=undercurl
hi LspDiagnosticsUnderlineHint gui=undercurl
hi DiagnosticDefaultError cterm=bold ctermfg=Red
hi DiagnosticDefaultWarning cterm=bold ctermfg=Yellow
hi DiagnosticDefaultInformation ctermfg=Blue
hi DiagnosticUnderlineError gui=undercurl
hi DiagnosticUnderlineWarn gui=undercurl
hi DiagnosticUnderlineInfo gui=undercurl
hi DiagnosticUnderlineHint gui=undercurl
hi link SpecialChar Character
hi Pmenu ctermfg=White ctermbg=Black guifg=#ffffff guibg=#000000
au syntax leaninfo setl scl=no
nnoremap gD <Cmd>lua vim.lsp.buf.declaration()<CR>
nnoremap gd <Cmd>lua vim.lsp.buf.definition()<CR>
nnoremap K <Cmd>lua vim.lsp.buf.hover()<CR>
nnoremap <leader>K <cmd>lua vim.diagnostic.open_float{header = ''}<CR>
nnoremap gi <cmd>lua vim.lsp.buf.implementation()<CR>
nnoremap <C-k> <cmd>lua vim.lsp.buf.signature_help()<CR>
nnoremap <space>wa <cmd>lua vim.lsp.buf.add_workspace_folder()<CR>
nnoremap <space>wr <cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>
nnoremap <space>wl <cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>
nnoremap <space>D <cmd>lua vim.lsp.buf.type_definition()<CR>
nnoremap <space>rn <cmd>lua vim.lsp.buf.rename()<CR>
nnoremap <space>ca <cmd>lua vim.lsp.buf.code_action()<CR>
nnoremap gr <cmd>lua vim.lsp.buf.references()<CR>
nnoremap [d <cmd>lua vim.diagnostic.goto_prev()<CR>
nnoremap ]d <cmd>lua vim.diagnostic.goto_next()<CR>
nnoremap <space>q <cmd>lua vim.lsp.diagnostic.set_loclist()<CR>
nnoremap <space>f <cmd>lua vim.lsp.buf.formatting()<CR>
" nnoremap <leader>i <Cmd>lua require('lean.infoview').toggle()<CR>
au filetype lean,lean3 nnoremap <buffer> <leader>K <CMD>LeanLineDiagnostics<CR>
au filetype lean,lean3 nnoremap <buffer> <leader>g <CMD>LeanGoal<CR>
au filetype lean nnoremap <buffer> <leader>G <CMD>LeanTermGoal<CR>
nnoremap <c-p> <cmd>Telescope find_files<cr>
nnoremap <leader>ff <cmd>Telescope find_files<cr>
nnoremap <leader>fg <cmd>Telescope live_grep<cr>
nnoremap <leader>fb <cmd>Telescope buffers<cr>
nnoremap <leader>fh <cmd>Telescope help_tags<cr>
nnoremap <leader>fs <cmd>lua require 'telescope.builtin'.lsp_dynamic_workspace_symbols({symbol_type_width=1, symbol_width=50})<cr>
else
nnoremap <c-p> :FZF<cr>
endif
let g:tex_flavor = 'latex'
let g:vimtex_compiler_progname = 'nvr'
let g:vimtex_indent_enabled = 0
au syntax tex setl indentexpr= " disable vim crap: https://github.com/lervag/vimtex/issues/2007#issuecomment-808768783