From e16094582b32adb48c47f9e3437a2d64f34e46b3 Mon Sep 17 00:00:00 2001 From: johannst Date: Sat, 10 Apr 2021 00:01:31 +0200 Subject: added nvim experimental --- nvim.init.vim.experimental | 92 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 nvim.init.vim.experimental diff --git a/nvim.init.vim.experimental b/nvim.init.vim.experimental new file mode 100644 index 0000000..015532c --- /dev/null +++ b/nvim.init.vim.experimental @@ -0,0 +1,92 @@ +let mapleader=" " + +" ----------------- +" Plugins. +" ----------------- + +call plug#begin('~/.nvim/plugged') + Plug 'gruvbox-community/gruvbox' + Plug 'neovim/nvim-lspconfig' +call plug#end() + +" ----------------- +" Setters. +" ----------------- + +set termguicolors +set background=dark +colorscheme gruvbox + +set relativenumber +set number +set expandtab +set signcolumn=yes + +set mouse=a +set scrolloff=8 + +set tabstop=4 +set softtabstop=4 +set shiftwidth=4 +set smartindent +set expandtab + +set list +set listchars=tab:>-,trail:- + +set hidden +set nobackup +set noswapfile + +set hlsearch +set incsearch + +if executable('rg') + set grepprg=rg\ --vimgrep +endif + +" ----------------- +" LSP & Complete. +" ----------------- + +set completeopt=menuone,noinsert,noselect + +lua << EOF +local on_attach = function(_client, bufnr) + -- Install `omnifunc` completion handler, get completion with . + vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc") + + -- Key mappings. + local opts = { noremap=true, silent=true } + vim.api.nvim_buf_set_keymap(bufnr, "n", "K", "lua vim.lsp.buf.hover()", opts) + 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) +end + +-- Setup rust-analyzer. +require'lspconfig'.rust_analyzer.setup { + on_attach = on_attach, +} + +-- Setup clangd. +require'lspconfig'.clangd.setup { + cmd = { "clangd", "--background-index", "--completion-style=detailed" }, + on_attach = on_attach, +} +EOF + +" ----------------- +" Mappings. +" ----------------- + +vnoremap p "_dP + +" ----------------- +" Autogroups. +" ----------------- + +augroup AG_highlight_yank + autocmd! + autocmd TextYankPost * silent! lua require'vim.highlight'.on_yank({timeout = 300}) +augroup END -- cgit v1.2.3