dotfiles/.config/nvim/init.vim

176 lines
3.9 KiB
VimL

" __
" / -,
" || ) ; '
" ~||---) _-_ /'\\ \\/\ \\ \\/\\/\\
" ~||---, || \\ || || || | || || || ||
" ~|| / ||/ || || || | || || || ||
" |, / \\,/ \\,/ \\/ \\ \\ \\ \\
" -_- --~
"
" import .vimrc
set runtimepath^=~/.vim runtimepath+=~/.vim/after
let &packpath = &runtimepath
source ~/.vimrc
" colors
highlight Pmenu guibg=black
" refresh time
set updatetime=500
" keybinds
" code actions
nnoremap <C-c><C-a> :lua vim.lsp.buf.code_action()<CR>
" ale
let g:ale_linters = {'rust': ['analyzer'], 'css': ['csslint']}
let g:ale_fixers = {
\ '*': ['remove_trailing_lines', 'trim_whitespace'],
\ 'html': ['prettier'],
\ 'css': ['prettier'],
\ }
let g:ale_fix_on_save = 1
let g:ale_javascript_prettier_options = '--tab-width 4'
let g:ale_rust_analyzer_config = {
\ 'cargo': { 'loadOutDirsFromCheck': v:true },
\ 'procMacro': { 'enable': v:true },
\ 'checkOnSave': { 'command': 'clippy', 'enable': v:true }
\ }
let g:lightline.component_expand = {
\ 'linter_checking': 'lightline#ale#checking',
\ 'linter_infos': 'lightline#ale#infos',
\ 'linter_warnings': 'lightline#ale#warnings',
\ 'linter_errors': 'lightline#ale#errors',
\ 'linter_ok': 'lightline#ale#ok',
\ }
let g:lightline.component_function = {
\ 'gitbranch': 'FugitiveHead'
\ }
let g:lightline.component_type = {
\ 'linter_checking': 'right',
\ 'linter_infos': 'right',
\ 'linter_warnings': 'warning',
\ 'linter_errors': 'error',
\ 'linter_ok': 'right',
\ }
" lightline symbols
let g:lightline#ale#indicator_checking = "\uf110"
let g:lightline#ale#indicator_infos = "\uf129"
let g:lightline#ale#indicator_warnings = "\uf071"
let g:lightline#ale#indicator_errors = "\uf05e"
let g:lightline#ale#indicator_ok = "\uf00c"
" lightline modules
let g:lightline.active = {
\ 'left' : [
\ ['mode', 'paste'],
\ ['gitbranch', 'readonly', 'filename', 'modified']
\ ],
\ 'right': [
\ ['linter_checking', 'linter_errors', 'linter_warnings'],
\ ['lineinfo'],
\ ['percent'],
\ ['fileformat', 'fileencoding', 'filetype']
\ ]
\}
" CtrlSF
let g:ctrlsf_default_root = "project"
lua << EOF
-- cursor animations
require('specs').setup{
show_jumps = true,
min_jump = 30,
popup = {
delay_ms = 100, -- delay before popup displays
inc_ms = 20, -- time increments used for fade/resize effects
blend = 10, -- starting blend, between 0-100 (fully transparent), see :h winblend
width = 10,
winhl = "PMenu",
fader = require('specs').exp_fader,
resizer = require('specs').shrink_resizer
},
ignore_buftypes = {
nofile = true,
},
}
-- lsp config
local lsp_installer = require("nvim-lsp-installer")
local nvim_lsp = require 'lspconfig'
local cmp = require'cmp'
lsp_installer.setup {
automatic_installation = true
}
for _, server in ipairs(lsp_installer.get_installed_servers()) do
nvim_lsp[server.name].setup {}
end
local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
local servers = { 'rust_analyzer', 'emmet_ls', 'cssls' }
for _, lsp in ipairs(servers) do
nvim_lsp[lsp].setup {
capabilities = capabilities,
}
end
vim.diagnostic.config({
virtual_text = {
prefix = ''
},
signs = false
})
-- complations
cmp.setup({
snippet = {
expand = function(args)
vim.fn["vsnip#anonymous"](args.body)
end,
},
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 }),
}),
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'vsnip' },
{ name = 'calc' },
}, {
{ name = 'buffer' },
})
})
require("todo-comments").setup {}
-- loading status
require"fidget".setup{
text = {
spinner = "star"
}
}
require'nvim-web-devicons'.setup {
}
EOF