dotfiles/.config/nvim/init.vim

106 lines
2.7 KiB
VimL

set nocompatible
filetype off
" ----[Plugins]----
call plug#begin()
Plug 'ms-jpq/coq_nvim', {'branch': 'coq'}
Plug 'ms-jpq/coq.artifacts', {'branch': 'artifacts'}
Plug 'ms-jpq/coq.thirdparty', {'branch': '3p'}
Plug 'neovim/nvim-lspconfig'
Plug 'williamboman/nvim-lsp-installer'
Plug 'preservim/nerdtree'
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'tikhomirov/vim-glsl'
call plug#end()
" ----[COQ]----
let g:coq_settings = {'auto_start': 'shut-up', 'display.pum.fast_close': v:false}
" ----[NVim LSPConfig]----
lua << EOF
local lsp = require 'lspconfig'
local coq = require 'coq'
lsp.clangd.setup{}
lsp.cmake.setup{}
lsp.pyright.setup{}
lsp.clangd.setup{coq.lsp_ensure_capabilities{}}
lsp.cmake.setup{coq.lsp_ensure_capabilities{}}
lsp.pyright.setup{coq.lsp_ensure_capabilities{}}
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float)
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev)
vim.keymap.set('n', ']d', vim.diagnostic.goto_next)
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist)
EOF
" ----[Look and Feel]----
" Syntax hilighting and line numbers
syntax on
set encoding=utf-8
set number relativenumber
set wildmode=longest,list,full
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
set title
" Indents
filetype plugin indent on
" Tabbing
set tabstop=4
set shiftwidth=4
set softtabstop=4 expandtab
" Splits below and right
set splitbelow splitright
" Block cursor
set guicursor=i:block
" ----[File Specific Stuff]----
" yml
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
autocmd FileType yml setlocal ts=2 sts=2 sw=2 expandtab
autocmd FileType meson setlocal ts=4 sts=4 sw=4 expandtab
autocmd FileType xacro setlocal ts=2 sts=2 sw=2 expandtab
autocmd FileType xml setlocal ts=2 sts=2 sw=2 expandtab
autocmd FileType urdf setlocal ts=2 sts=2 sw=2 expandtab
autocmd FileType idl setlocal ts=2 sts=2 sw=2 expandtab
autocmd! BufNewFile,BufRead *.vs,*.fs,*.glvs,*.glfs,*.glsl set ft=glsl
" ----[NERDTree]----
nnoremap <tab> :NERDTreeToggle<cr>
" ----[Macros]----
" Find and replace macro
nnoremap S :%s//g<Left><Left>
" Copy paste
vnoremap <C-c> "+y
map <C-p> "+P
" Markers
inoremap <leader><leader> <Esc>/<++><Enter>"_c4l
vnoremap <leader><leader> <Esc>/<++><Enter>"_c4l
map <leader><leader> <Esc>/<++><Enter>"_c4l
" sudo write, TODO: make this not fuck things up
" command W :execute ':silent w !sudo tee % > /dev/null' | :edit!
" ----[Pre / Post Write]----
" Get rid of extra whitespace
autocmd BufWritePre * %s/\s\+$//e
" Run xrdb when Xresources or Xdefaults are changed
autocmd BufWritePost *Xresources,*Xdefaults !xrdb %
" Reload sxhkd when config is edited
autocmd BufWritePost sxhkdrc :silent !pkill sxhkd; sxhkd &
autocmd BufNewFile,BufRead *.compute set syntax=hlsl