From 2c7b5d03152c0754b49460d698a5d5e012a29eab Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Sun, 26 Sep 2021 17:03:27 -0700 Subject: [PATCH] new: neovim config --- install.conf.yaml | 3 ++ nvim_init.vim | 120 ++++++++++++++++++++++++++++++++++++++++++++++ zsh/zshrc | 1 + 3 files changed, 124 insertions(+) create mode 100644 nvim_init.vim diff --git a/install.conf.yaml b/install.conf.yaml index 9ce7eed..d837ac9 100644 --- a/install.conf.yaml +++ b/install.conf.yaml @@ -32,3 +32,6 @@ ~/.config/kak/kakrc: create: true path: kakrc + ~/.config/nvim/init.vim: + create: true + path: nvim_init.vim diff --git a/nvim_init.vim b/nvim_init.vim new file mode 100644 index 0000000..23e3a34 --- /dev/null +++ b/nvim_init.vim @@ -0,0 +1,120 @@ +" Stick with vimscript at the moment, but prefer lua for config + +lua << EOF +local set = vim.opt + +set.number = true +set.autoindent = true +set.colorcolumn = {80, 100, 120} +set.cursorline = true +set.expandtab = true +set.backup = true +set.backupdir = { '~/.vim-tmp', '~/.tmp', '~/tmp', '/var/tmp', '/tmp' } +set.backupskip = { '/tmp/*', '/private/tmp/*' } +set.directory = { '~/.vim-tmp', '~/.tmp', '~/tmp', '/var/tmp', '/tmp' } +set.writebackup = true +set.list = true +set.listchars = { trail = '~', tab = '>=' } +set.mouse = 'a' +set.completeopt = { 'menu', 'menuone', 'noselect' } +set.termguicolors = true + +require('packer').startup(function() + ----------------------------------------------------------------------------- + use 'wbthomason/packer.nvim' + + ----------------------------------------------------------------------------- + use 'wakatime/vim-wakatime' + + ----------------------------------------------------------------------------- + use 'neovim/nvim-lspconfig' + require('lspconfig').pyright.setup({ + settings = { + python = { + venvPath = "~/.conda/envs", + analysis = { + useLibraryCodeForTypes = true, + } + } + } + }) + require('lspconfig').rust_analyzer.setup({}) + + ----------------------------------------------------------------------------- + use 'chriskempson/base16-vim' + vim.cmd('source ~/.vimrc_background') + vim.g.base16colorspace = 256 + + ----------------------------------------------------------------------------- + use { + 'nvim-telescope/telescope.nvim', + requires = { + { 'nvim-lua/plenary.nvim' }, + { 'kyazdani42/nvim-web-devicons' } + } + } + vim.api.nvim_set_keymap('n', '-', 'Telescope find_files', { noremap = true }) + + ----------------------------------------------------------------------------- + use { 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate' } + + ----------------------------------------------------------------------------- + use 'hrsh7th/nvim-cmp' + use 'hrsh7th/cmp-nvim-lsp' + use 'hrsh7th/cmp-buffer' + use 'hrsh7th/cmp-vsnip' + use 'hrsh7th/vim-vsnip' + local cmp = require('cmp') + cmp.setup({ + snippet = { + expand = function(args) + vim.fn["vsnip#anonymous"](args.body) + end, + }, + mapping = { + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.close(), + [''] = cmp.mapping.confirm({ select = true }), + }, + sources = { + { name = 'nvim_lsp' }, + { name = 'vsnip' }, + { name = 'buffer' }, + } + }) + + ----------------------------------------------------------------------------- + use { + 'lewis6991/gitsigns.nvim', + requires = { { 'nvim-lua/plenary.nvim' } } + } + require('gitsigns').setup({}) + + ----------------------------------------------------------------------------- + use { + 'simrat39/rust-tools.nvim', + requires = { + { 'nvim-lua/popup.nvim' }, + { 'nvim-lua/plenary.nvim' } + } + } + require('rust-tools').setup({}) + + ----------------------------------------------------------------------------- + use { + 'GustavoKatel/sidebar.nvim', + requires = { { 'GustavoKatel/todo-comments.nvim' } } + } + require('sidebar-nvim').setup({ + side = 'right', + sections = { 'datetime', 'git-status', 'lsp-diagnostics', 'todos' } + }) + + ----------------------------------------------------------------------------- + use 'famiu/feline.nvim' + require('feline').setup({ preset = 'noicon' }) + +end) +EOF diff --git a/zsh/zshrc b/zsh/zshrc index b8a9363..de05496 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -20,6 +20,7 @@ source "$HOME/.cargo/env" alias q="conda activate q2dev" alias i="ipython3" alias greg="grep" +alias vim="nvim" BASE16_SHELL=$HOME/.config/base16-shell/ [ -n "$PS1" ] && [ -s $BASE16_SHELL/profile_helper.sh ] && eval "$($BASE16_SHELL/profile_helper.sh)"