2023-01-17 12:25:23 +02:00
|
|
|
" Load plugins
|
|
|
|
call plug#begin()
|
|
|
|
|
2024-11-08 09:15:36 +02:00
|
|
|
" CodeStats and Airline
|
|
|
|
Plug 'https://gitlab.com/code-stats/code-stats-vim.git'
|
|
|
|
Plug 'vim-airline/vim-airline'
|
|
|
|
|
|
|
|
" Syntax highlighters
|
|
|
|
Plug 'tikhomirov/vim-glsl'
|
|
|
|
|
|
|
|
" Treesitter things
|
2023-01-17 12:25:23 +02:00
|
|
|
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
|
2024-11-08 09:15:36 +02:00
|
|
|
|
|
|
|
" Language server protocol
|
|
|
|
Plug 'neovim/nvim-lspconfig'
|
|
|
|
|
|
|
|
" Autocompletion shenanigans
|
|
|
|
Plug 'hrsh7th/cmp-nvim-lsp'
|
|
|
|
Plug 'hrsh7th/cmp-buffer'
|
|
|
|
Plug 'hrsh7th/cmp-path'
|
|
|
|
Plug 'hrsh7th/cmp-cmdline'
|
|
|
|
Plug 'hrsh7th/nvim-cmp'
|
|
|
|
Plug 'hrsh7th/cmp-vsnip'
|
|
|
|
Plug 'hrsh7th/vim-vsnip'
|
|
|
|
Plug 'petertriho/cmp-git'
|
2023-01-17 12:25:23 +02:00
|
|
|
|
|
|
|
call plug#end()
|
|
|
|
|
2024-11-08 09:15:36 +02:00
|
|
|
" Set custom glsl extensions
|
|
|
|
autocmd! BufNewFile,BufRead *.effect set ft=glsl
|
|
|
|
|
2023-01-17 12:25:23 +02:00
|
|
|
" Python plugins, needed for CodeStats
|
2023-01-18 21:14:06 +02:00
|
|
|
let g:python3_host_prog = '/usr/bin/python'
|
2023-01-17 12:25:23 +02:00
|
|
|
|
|
|
|
" CodeStats
|
|
|
|
let g:codestats_api_key = $CODESTATS_API_KEY
|
|
|
|
|
|
|
|
" Main configuration
|
2023-01-07 16:12:59 +02:00
|
|
|
set tabstop=2 softtabstop=2 shiftwidth=2 expandtab smarttab autoindent
|
2023-01-17 12:25:23 +02:00
|
|
|
set mouse=
|
2023-01-07 16:12:59 +02:00
|
|
|
set laststatus=2
|
|
|
|
set t_Co=256
|
2023-01-17 12:25:23 +02:00
|
|
|
|
|
|
|
lua <<EOF
|
2024-11-08 09:15:36 +02:00
|
|
|
require'nvim-treesitter.configs'.setup {
|
|
|
|
ensure_installed = {
|
|
|
|
"bash", "vim", "regex",
|
|
|
|
"cpp", "go", "rust",
|
|
|
|
"diff", "make",
|
|
|
|
"dockerfile",
|
|
|
|
"elixir", "erlang",
|
|
|
|
"godot_resource", "gdscript",
|
|
|
|
"git_rebase", "gitattributes", "gitcommit", "gitignore",
|
|
|
|
"html", "scss",
|
|
|
|
"http", "sql",
|
|
|
|
"javascript", "jsdoc", "typescript", "vue",
|
|
|
|
"json", "json5", "jq",
|
|
|
|
"lua", "php", "phpdoc",
|
|
|
|
"markdown", "markdown_inline",
|
|
|
|
"rst", "yaml"
|
|
|
|
},
|
|
|
|
highlight = {
|
|
|
|
enable = true,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
-- Parser config for dfraw language
|
|
|
|
local parser_config = require'nvim-treesitter.parsers'.get_parser_configs()
|
|
|
|
parser_config.dfraw = {
|
|
|
|
install_info = {
|
|
|
|
url = 'https://code.criminallycute.fi/mirrors/tree-sitter-dfraw',
|
|
|
|
files = {'src/parser.c'},
|
|
|
|
branch = 'main',
|
|
|
|
},
|
|
|
|
filetype = 'text',
|
|
|
|
used_by = {'dfraw'},
|
|
|
|
}
|
|
|
|
|
|
|
|
-- Autocompletion shenanigans
|
|
|
|
local cmp = require'cmp'
|
|
|
|
|
|
|
|
cmp.setup({
|
|
|
|
snippet = {
|
|
|
|
expand = function(args)
|
|
|
|
vim.fn["vsnip#anonymous"](args.body)
|
|
|
|
end,
|
|
|
|
},
|
|
|
|
window = {
|
|
|
|
completion = cmp.config.window.bordered(),
|
|
|
|
documentation = cmp.config.window.bordered(),
|
|
|
|
},
|
|
|
|
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 = 'buffer' },
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
-- filetype specific setup
|
|
|
|
-- gitconfig
|
|
|
|
cmp.setup.filetype('gitcommit', {
|
|
|
|
sources = cmp.config.sources({
|
|
|
|
{ name = 'git' },
|
|
|
|
{ name = 'buffer' },
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
-- / andd ? completion
|
|
|
|
cmp.setup.cmdline({'/', '?'}, {
|
|
|
|
mapping = cmp.mapping.preset.cmdline(),
|
|
|
|
sources = { { name = 'buffer' } },
|
|
|
|
})
|
|
|
|
|
|
|
|
-- : completion
|
|
|
|
cmp.setup.cmdline(':', {
|
|
|
|
mapping = cmp.mapping.preset.cmdline(),
|
|
|
|
sources = {
|
|
|
|
{ name = 'path' },
|
|
|
|
{ name = 'cmdline' },
|
|
|
|
},
|
|
|
|
matching = { disallow_symbol_nonprefix_matching = false },
|
|
|
|
})
|
|
|
|
|
|
|
|
-- Elixir LSP configuration
|
|
|
|
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
|
|
|
require'lspconfig'.elixirls.setup {
|
|
|
|
capabilities = capabilities,
|
|
|
|
cmd = { '~/.local/share/lsp-servers/elixir-ls/language_server.sh' }
|
2023-01-17 12:25:23 +02:00
|
|
|
}
|
|
|
|
EOF
|
|
|
|
|
|
|
|
" disable dfraw for text files
|
|
|
|
if did_filetype()
|
|
|
|
finish
|
|
|
|
endif
|
|
|
|
if getline(1) =~# '[a-z_]'
|
|
|
|
setfiletype dfraw
|
|
|
|
endif
|
|
|
|
|