" Plugins{{{ call plug#begin() Plug 'williamboman/mason.nvim' Plug 'williamboman/mason-lspconfig.nvim' Plug 'neovim/nvim-lspconfig' Plug 'tpope/vim-surround' Plug 'tpope/vim-repeat' Plug 'tpope/vim-unimpaired' Plug 'tpope/vim-fugitive' Plug 'tpope/vim-commentary' Plug 'hrsh7th/cmp-nvim-lsp' Plug 'hrsh7th/cmp-buffer' Plug 'hrsh7th/nvim-cmp' Plug 'nvim-treesitter/nvim-treesitter' Plug 'nvim-lua/plenary.nvim' Plug 'nvim-telescope/telescope.nvim', { 'branch': '0.1.x' } "Plug 'github/copilot.vim' Plug 'udalov/kotlin-vim' Plug 'NLKNguyen/papercolor-theme' Plug 'lervag/vimtex' call plug#end() " }}} colorscheme PaperColor " Treesitter {{{ " lua << EOF " require'nvim-treesitter.configs'.setup { " ensure_installed = { "typescript", "java", "tsx", "go" }, " auto_install = false, " highlight = { " enable = true, " }, " indent = { " enable = true, " }, " incremental_selection = { " enable = true, " }, " } " EOF " }}} " Telescope {{{ lua <ff', builtin.find_files, {}) vim.keymap.set('n', 'fg', builtin.live_grep, {}) EOF " }}} " Latex {{{ let g:vimtex_view_method = 'general' let g:vimtex_quickfix_open_on_warning = 0 "}}} " Completion{{{ set completeopt+=menuone set completeopt+=noselect " Close completion window autocmd CompleteDone * pclose lua <'] = cmp.mapping.confirm({ select = true }), }), preselect = cmp.PreselectMode.None, }) EOF "}}} " LSP {{{ lua <'] = cmp.mapping.complete(), [''] = cmp.mapping.abort() }), sources = cmp.config.sources({ { name = 'nvim_lsp' }, }, { { name = 'buffer', option = { get_bufnrs = function() local bufs = {} for _, win in ipairs(vim.api.nvim_list_wins()) do bufs[vim.api.nvim_win_get_buf(win)] = true end return vim.tbl_keys(bufs) end }, }, }) }) vim.api.nvim_create_autocmd('LspAttach', { group = vim.api.nvim_create_augroup('UserLspConfig', {}), callback = function(ev) local opts = { buffer = ev.buf } vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts) vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts) vim.keymap.set('n', 'a', vim.lsp.buf.code_action, opts) vim.keymap.set('n', 'r', vim.lsp.buf.rename, opts) vim.keymap.set('n', 'd', vim.diagnostic.disable, opts) vim.keymap.set('n', 'he', vim.diagnostic.open_float, opts) vim.keymap.set('n', 'hh', vim.lsp.buf.hover, opts) vim.keymap.set('n', 'q', vim.diagnostic.setqflist, opts) vim.keymap.set('n', 'c', vim.lsp.buf.format, opts) -- Hmm det er faktisk ikke så fedt -- vim.cmd [[autocmd BufWritePre * lua vim.lsp.buf.format()]] vim.api.nvim_set_hl(0, '@lsp.type.function', {}) end, }) EOF " }}}