This repository has been archived on 2022-05-11. You can view files and clone it, but cannot push or open issues or pull requests.
misc/.vimrc

246 lines
8.1 KiB
VimL

set nocompatible " stops wack stuff
set wildmenu " better command line completion
set showmode " show editing mode
set showcmd " show partial commands
set encoding=UTF-8
set title
" spellcheck
set spelllang=en,fr,de,cjk
set spellsuggest=best,9
nnoremap <silent> <F11> :set spell!<cr>
inoremap <silent> <F11> <C-O>:set spell!<cr>
" use case-insensitive search except when using capitals
set ignorecase
set smartcase
set backspace=indent,eol,start " Allow backspacing over autoindent, line breaks and start of insert action
set nostartofline " stop certain things from going to first character in line
set ruler " display cursor position
set confirm " ask to save stuff before failed command
set visualbell " visual indicator instead of beep
set t_vb= " reset terminal code for visual bell
set cmdheight=2 " set command window height to 2 lines
set number " display line numbers
set notimeout ttimeout ttimeoutlen=200 " timeout on keycodes but not mappings
" Indentation Stuff
set shiftwidth=4
set tabstop=4
set autoindent " keep indent of file or smth
" Use <Tab> and <S-Tab> to navigate through pop-up menu
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
nnoremap f <cmd>CHADopen<cr>
set lazyredraw
" auto-indenting
if has('filetype')
filetype indent plugin on
endif
" syntax highlighting
if has('syntax')
syntax on
endif
" latex config
let g:tex_flavor = 'latex'
let g:tex_conceal = ''
"let g:vimtex_fold_manual = 1
"let g:vimtex_latexmk_continuous = 1
"let g:vimtex_compiler_progname = 'nvr'
" Plugins will be downloaded under the specified directory.
call plug#begin(has('nvim') ? stdpath('data') . '/plugged' : '~/.vim/plugged')
" Declare the list of plugins.
" Theme
Plug 'catppuccin/nvim', {'as': 'catppuccin'}
" Statusline plugin
Plug 'feline-nvim/feline.nvim', { 'branch': 'develop' }
" Misc
Plug 'glepnir/dashboard-nvim' " startup dashboard
Plug 'kyazdani42/nvim-web-devicons' " icons!
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} " better syntax highlighting
Plug 'lewis6991/spellsitter.nvim' " treesitter for spelling
Plug 'alaviss/nim.nvim' " nim language support
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } " searching
Plug 'junegunn/fzf.vim'
Plug 'tpope/vim-commentary' " commenting tool
Plug 'rrethy/vim-hexokinase', { 'do': 'make hexokinase' } " show colours
"Plug 'folke/trouble.nvim'
" git signs
Plug 'nvim-lua/plenary.nvim'
Plug 'lewis6991/gitsigns.nvim'
" LaTeX
"Plug 'lervag/vimtex'
Plug 'Konfekt/FastFold' " speeds or folding or smth
Plug 'matze/vim-tex-fold'
" rust-lsp configuration
Plug 'neovim/nvim-lspconfig'
"Plug 'simrat39/rust-tools.nvim'
" Plug 'nvim-lua/lsp_extensions.nvim'
" File tree
Plug 'ms-jpq/chadtree', {'branch': 'chad', 'do': 'python3 -m chadtree deps'}
" Optional dependencies
Plug 'nvim-lua/popup.nvim'
" Plug 'nvim-telescope/telescope.nvim'
call plug#end()
" Set colour scheme
autocmd vimenter * ++nested colorscheme catppuccin
colorscheme catppuccin
let g:Hexokinase_highlighters = ['sign_column']
" Setup plugins
lua require('feline').setup({components = require('catppuccin.core.integrations.feline'),})
lua require('gitsigns').setup()
lua require('spellsitter').setup()
" LSP config
lua << EOF
-- Mappings.
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
local opts = { noremap=true, silent=true }
-- Use an on_attach function to only map the following keys
-- after the language server attaches to the current buffer
local on_attach = function(client, bufnr)
-- Enable completion triggered by <c-x><c-o>
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
-- Mappings.
-- See `:help vim.lsp.*` for documentation on any of the below functions
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts)
end
-- Use a loop to conveniently call 'setup' on multiple servers and
-- map buffer local keybindings when the language server attaches
local servers = { 'pylsp', 'rust_analyzer', 'asm_lsp', 'gdscript' }
for _, lsp in pairs(servers) do
require('lspconfig')[lsp].setup {
on_attach = on_attach,
flags = {
-- This will be the default in neovim 0.7+
debounce_text_changes = 150,
}
}
end
require('lspconfig').arduino_language_server.setup({
cmd = {
-- Required
"arduino-language-server",
"-cli-config", "/home/erin/.arduino15/arduino-cli.yaml",
-- Optional
"-cli", "/usr/bin/arduino-cli",
"-clangd", "/usr/bin/clangd"
}
})
EOF
" Default value is clap
let g:dashboard_default_executive ='fzf'
let g:dashboard_custom_header=[
\'',
\'⡆⣐⢕⢕⢕⢕⢕⢕⢕⢕⠅⢗⢕⢕⢕⢕⢕⢕⢕⠕⠕⢕⢕⢕⢕⢕⢕⢕⢕⢕',
\'⢐⢕⢕⢕⢕⢕⣕⢕⢕⠕⠁⢕⢕⢕⢕⢕⢕⢕⢕⠅⡄⢕⢕⢕⢕⢕⢕⢕⢕⢕',
\'⢕⢕⢕⢕⢕⠅⢗⢕⠕⣠⠄⣗⢕⢕⠕⢕⢕⢕⠕⢠⣿⠐⢕⢕⢕⠑⢕⢕⠵⢕',
\'⢕⢕⢕⢕⠁⢜⠕⢁⣴⣿⡇⢓⢕⢵⢐⢕⢕⠕⢁⣾⢿⣧⠑⢕⢕⠄⢑⢕⠅⢕',
\'⢕⢕⠵⢁⠔⢁⣤⣤⣶⣶⣶⡐⣕⢽⠐⢕⠕⣡⣾⣶⣶⣶⣤⡁⢓⢕⠄⢑⢅⢑',
\'⠍⣧⠄⣶⣾⣿⣿⣿⣿⣿⣿⣷⣔⢕⢄⢡⣾⣿⣿⣿⣿⣿⣿⣿⣦⡑⢕⢤⠱⢐',
\'⢠⢕⠅⣾⣿⠋⢿⣿⣿⣿⠉⣿⣿⣷⣦⣶⣽⣿⣿⠈⣿⣿⣿⣿⠏⢹⣷⣷⡅⢐',
\'⣔⢕⢥⢻⣿⡀⠈⠛⠛⠁⢠⣿⣿⣿⣿⣿⣿⣿⣿⡀⠈⠛⠛⠁⠄⣼⣿⣿⡇⢔',
\'⢕⢕⢽⢸⢟⢟⢖⢖⢤⣶⡟⢻⣿⡿⠻⣿⣿⡟⢀⣿⣦⢤⢤⢔⢞⢿⢿⣿⠁⢕',
\'⢕⢕⠅⣐⢕⢕⢕⢕⢕⣿⣿⡄⠛⢀⣦⠈⠛⢁⣼⣿⢗⢕⢕⢕⢕⢕⢕⡏⣘⢕',
\'⢕⢕⠅⢓⣕⣕⣕⣕⣵⣿⣿⣿⣾⣿⣿⣿⣿⣿⣿⣿⣷⣕⢕⢕⢕⢕⡵⢀⢕⢕',
\'⢑⢕⠃⡈⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢃⢕⢕⢕',
\'⣆⢕⠄⢱⣄⠛⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⢁⢕⢕⠕⢁',
\'⣿⣦⡀⣿⣿⣷⣶⣬⣍⣛⣛⣛⡛⠿⠿⠿⠛⠛⢛⣛⣉⣭⣤⣂⢜⠕⢑⣡⣴⣿',
\'',
\]
" trouble config
" seems to be broken rn?
" lua require("trouble").setup()
lua <<EOF
require'nvim-web-devicons'.setup {
-- your personnal icons can go here (to override)
-- you can specify color or cterm_color instead of specifying both of them
-- DevIcon will be appended to `name`
override = {
zsh = {
icon = "",
color = "#428850",
cterm_color = "65",
name = "Zsh"
}
};
-- globally enable default icons (default to false)
-- will get overriden by `get_icons` option
default = true;
}
EOF
" Setup treesitter
lua <<EOF
require'nvim-treesitter.configs'.setup {
-- One of "all", "maintained" (parsers with maintainers), or a list of languages
ensure_installed = "maintained",
-- Install languages synchronously (only applied to `ensure_installed`)
sync_install = true,
-- List of parsers to ignore installing
ignore_install = { "javascript", "typescript" },
highlight = {
-- `false` will disable the whole extension
enable = true,
-- list of language that will be disabled
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = false,
},
}
EOF
" Set completeopt to have a better completion experience
" :help completeopt
" menuone: popup even when there's only one match
" noinsert: Do not insert text until a selection is made
" noselect: Do not select, force user to select one from the menu
set completeopt=menuone,noinsert,noselect
" Avoid showing extra messages when using completion
set shortmess+=c