From d3a6faf2e4fc6e7e60ccab47f1db977fc0d4ec7e Mon Sep 17 00:00:00 2001 From: johannst Date: Sun, 20 Jun 2021 13:23:34 +0200 Subject: nvim: added completion/fzf/bas16 plugins, pyright lsp and other options --- nvim.init.vim.experimental | 52 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 50 insertions(+), 2 deletions(-) (limited to 'nvim.init.vim.experimental') diff --git a/nvim.init.vim.experimental b/nvim.init.vim.experimental index 2a7d81d..6872a22 100644 --- a/nvim.init.vim.experimental +++ b/nvim.init.vim.experimental @@ -8,8 +8,16 @@ let mapleader=" " " ----------------- call plug#begin('~/.nvim/plugged') - Plug 'gruvbox-community/gruvbox' + " Colors. + Plug 'chriskempson/base16-vim' + + " LSP & Completion. Plug 'neovim/nvim-lspconfig' + Plug 'hrsh7th/nvim-compe' + + " FZF. + Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } + Plug 'junegunn/fzf.vim' call plug#end() " ----------------- @@ -18,7 +26,7 @@ call plug#end() set termguicolors set background=dark -colorscheme gruvbox +colorscheme base16-default-dark set relativenumber set number @@ -43,6 +51,8 @@ set noswapfile set hlsearch set incsearch +set nowrap + if executable('rg') set grepprg=rg\ --vimgrep endif @@ -64,6 +74,7 @@ local on_attach = function(_client, bufnr) vim.api.nvim_buf_set_keymap(bufnr, "n", "", "lua vim.lsp.buf.definition()", opts) vim.api.nvim_buf_set_keymap(bufnr, "n", "r", "lua vim.lsp.buf.references()", opts) vim.api.nvim_buf_set_keymap(bufnr, "n", "i", "lua vim.lsp.buf.implementation()", opts) + vim.api.nvim_buf_set_keymap(bufnr, "n", "f", "lua vim.lsp.buf.formatting()", opts) end -- Setup rust-analyzer. @@ -76,6 +87,43 @@ require'lspconfig'.clangd.setup { cmd = { "clangd", "--background-index", "--completion-style=detailed" }, on_attach = on_attach, } + +-- Setup pyright. +require'lspconfig'.pyright.setup { + on_attach = on_attach, +} + +-- Setup nvim-compe. +require'compe'.setup { + enabled = true; + autocomplete = true; + debug = false; + min_length = 1; + preselect = 'enable'; + throttle_time = 80; + source_timeout = 200; + incomplete_delay = 400; + max_abbr_width = 100; + max_kind_width = 100; + max_menu_width = 100; + documentation = true; + + source = { + path = true; + buffer = false; + calc = false; + nvim_lsp = true; + nvim_lua = false; + vsnip = false; + ultisnips = false; + }; +} + +vim.o.completeopt = "menuone,noselect" + +vim.api.nvim_set_keymap("i", "", "compe#complete()", {expr = true}) +vim.api.nvim_set_keymap("i", "", "compe#confirm('')", {expr = true}) +vim.api.nvim_set_keymap("i", "", "compe#close('')", {expr = true}) EOF " ----------------- -- cgit v1.2.3