" " " Plugins " " call plug#begin(stdpath('data') . '/plugged') Plug 'doums/darcula' Plug 'preservim/nerdtree' Plug 'ryanoasis/vim-devicons' Plug 'Xuyuanp/nerdtree-git-plugin' Plug 'nvim-lua/plenary.nvim' Plug 'nvim-telescope/telescope.nvim' Plug 'airblade/vim-gitgutter' Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} Plug 'lukas-reineke/indent-blankline.nvim' Plug 'iamcco/markdown-preview.nvim', {'do': { -> mkdp#util#install() }, 'for': ['markdown', 'vim-plug']} " if install fails do `:call mkdp#util#install() manually` Plug 'neovim/nvim-lspconfig' Plug 'williamboman/nvim-lsp-installer' Plug 'hrsh7th/nvim-cmp' Plug 'hrsh7th/cmp-nvim-lsp' Plug 'saadparwaiz1/cmp_luasnip' Plug 'L3MON4D3/LuaSnip' Plug 'https://gitlab.com/dweipert.de/rclone.nvim' call plug#end() " " " Config " " nnoremap let mapleader=" " set shiftwidth=2 set tabstop=2 set expandtab set list set listchars=tab:\ \ ,trail:- set mouse=a set splitright set updatetime=250 " ruler set relativenumber number augroup numbertoggle autocmd! autocmd BufEnter,WinEnter * if &nu && mode() != 'i' | set relativenumber | endif autocmd BufLeave,WinLeave * if &nu | set norelativenumber | endif augroup END colorscheme darcula set termguicolors hi Normal guibg=NONE ctermbg=NONE " Nerdtree let g:NERDTreeShowHidden=1 let g:NERDTreeGitStatusShowIgnored=1 if !&diff autocmd StdinReadPre * let s:std_in=1 autocmd VimEnter * NERDTree | if argc() > 0 || exists('s:std_in') | wincmd p | endif autocmd VimEnter * if argc() > 0 | silent NERDTreeFind | wincmd p | endif endif autocmd BufWinEnter * if getcmdwintype() == '' | silent NERDTreeMirror | endif autocmd BufEnter * if winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif map NERDTreeToggle " Telescope nnoremap ff Telescope find_files nnoremap fg Telescope live_grep nnoremap Telescope buffers " GitGutter nnoremap gp GitGutterPreviewHunk nnoremap gu GitGutterUndoHunk " Treesitter lua < buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc') -- Mappings. local opts = { noremap=true, silent=true } -- See :help vim.lsp.* for documentation on any of the below functions buf_set_keymap('n', 'gD', 'lua vim.lsp.buf.declaration()', opts) buf_set_keymap('n', 'gd', 'lua vim.lsp.buf.definition()', opts) buf_set_keymap('n', 'K', 'lua vim.lsp.buf.hover()', opts) buf_set_keymap('n', 'gi', 'lua vim.lsp.buf.implementation()', opts) buf_set_keymap('n', '', 'lua vim.lsp.buf.signature_help()', opts) buf_set_keymap('n', 'wa', 'lua vim.lsp.buf.add_workspace_folder()', opts) buf_set_keymap('n', 'wr', 'lua vim.lsp.buf.remove_workspace_folder()', opts) buf_set_keymap('n', 'wl', 'lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))', opts) buf_set_keymap('n', 'D', 'lua vim.lsp.buf.type_definition()', opts) buf_set_keymap('n', 'rn', 'lua vim.lsp.buf.rename()', opts) buf_set_keymap('n', 'ca', 'lua vim.lsp.buf.code_action()', opts) buf_set_keymap('n', 'gr', 'lua vim.lsp.buf.references()', opts) buf_set_keymap('n', 'e', 'lua vim.lsp.diagnostic.show_line_diagnostics()', opts) buf_set_keymap('n', '[d', 'lua vim.lsp.diagnostic.goto_prev()', opts) buf_set_keymap('n', ']d', 'lua vim.lsp.diagnostic.goto_next()', opts) buf_set_keymap('n', 'q', 'lua vim.lsp.diagnostic.set_loclist()', opts) buf_set_keymap('n', 'f', 'lua vim.lsp.buf.formatting()', opts) end local capabilities = vim.lsp.protocol.make_client_capabilities() capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities) vim.o.completeopt = 'menuone,noselect' local lsp_installer = require('nvim-lsp-installer') lsp_installer.on_server_ready(function(server) server:setup({ on_attach = on_attach, capabilities = capabilities, }) end) local cmp = require('cmp') local luasnip = require('luasnip') cmp.setup { snippet = { expand = function(args) luasnip.lsp_expand(args.body) end, }, mapping = { [''] = cmp.mapping.select_prev_item(), [''] = cmp.mapping.select_next_item(), [''] = cmp.mapping.scroll_docs(-4), [''] = cmp.mapping.scroll_docs(4), [''] = cmp.mapping.complete(), [''] = cmp.mapping.close(), [''] = cmp.mapping.confirm { behavior = cmp.ConfirmBehavior.Replace, select = true, }, [''] = function(fallback) if cmp.visible() then cmp.select_next_item() elseif luasnip.expand_or_jumpable() then luasnip.expand_or_jump() else fallback() end end, [''] = function(fallback) if cmp.visible() then cmp.select_prev_item() elseif luasnip.jumpable(-1) then luasnip.jump(-1) else fallback() end end, }, sources = { { name = 'nvim_lsp' }, { name = 'luasnip' }, }, } EOF " " " Keys " " " buffer pane navigation nnoremap nnoremap nnoremap nnoremap nnoremap tabprevious nnoremap tabnext " esc / quit map nnoremap q " save nnoremap w inoremap w