From c2aa612b757e2056128ce2eeccba9d291c4c9028 Mon Sep 17 00:00:00 2001 From: Michael Zhang Date: Wed, 13 Oct 2021 18:45:52 -0500 Subject: [PATCH] a --- dot_config/alacritty/alacritty.yml | 4 +- dot_config/i3blocks/executable_config | 6 +- dot_config/nvim/init.vim | 151 ++++++++++++++++++-------- 3 files changed, 112 insertions(+), 49 deletions(-) diff --git a/dot_config/alacritty/alacritty.yml b/dot_config/alacritty/alacritty.yml index 6a6d80c..3dad8a5 100644 --- a/dot_config/alacritty/alacritty.yml +++ b/dot_config/alacritty/alacritty.yml @@ -111,7 +111,7 @@ font: # - (macOS) Menlo # - (Linux/BSD) monospace # - (Windows) Consolas - family: "Roboto Mono" + family: "PragmataPro" # The `style` can be specified to pick a specific face. #style: Regular @@ -150,7 +150,7 @@ font: #style: Bold Italic # Point size - size: 10.0 + size: 12.0 # Offset is the extra space around each character. `offset.y` can be thought # of as modifying the line spacing, and `offset.x` as modifying the letter diff --git a/dot_config/i3blocks/executable_config b/dot_config/i3blocks/executable_config index 4738f77..006aaef 100644 --- a/dot_config/i3blocks/executable_config +++ b/dot_config/i3blocks/executable_config @@ -1,5 +1,5 @@ [memory] -command=/usr/lib/i3blocks/memory/memory +command=/usr/lib/i3blocks/memory label=MEM interval=20 @@ -9,13 +9,13 @@ interval=3600 color=#A4C2F4 [volume] -command=/usr/lib/i3blocks/volume/volume +command=/usr/lib/i3blocks/volume LABEL=VOL interval=once signal=10 [battery-poly] -command=/usr/lib/i3blocks/battery-poly/battery-poly +command=/usr/lib/i3blocks/battery-poly LABEL=BAT interval=5 color=#999999 diff --git a/dot_config/nvim/init.vim b/dot_config/nvim/init.vim index b188ded..d9cffea 100644 --- a/dot_config/nvim/init.vim +++ b/dot_config/nvim/init.vim @@ -3,9 +3,8 @@ call plug#begin(stdpath('data') . '/plugged') Plug 'vim-airline/vim-airline' exe 'source' (stdpath('config') . '/airline.vim') -Plug 'neoclide/coc.nvim', {'branch': 'release'} -exe 'source' (stdpath('config') . '/coc.vim') -" Plug 'file://'.expand('~/Projects/coc-nvim-rs/') +" Plug 'neoclide/coc.nvim', {'branch': 'release'} +" exe 'source' (stdpath('config') . '/coc.vim') Plug 'preservim/nerdtree' exe 'source' (stdpath('config') . '/nerdtree.vim') @@ -13,38 +12,21 @@ exe 'source' (stdpath('config') . '/nerdtree.vim') " Plug 'ctrlpvim/ctrlp.vim' let g:ctrlp_user_command = 'rg %s --files --color=never --glob ""' +Plug 'neovim/nvim-lspconfig' +Plug 'hrsh7th/nvim-compe' + Plug 'FStarLang/VimFStar', {'for': 'fstar'} Plug 'LnL7/vim-nix' -Plug 'ashinkarov/nvim-agda' +" Plug 'ashinkarov/nvim-agda' +Plug 'derekelkins/agda-vim' Plug 'evanleck/vim-svelte', {'branch': 'main'} Plug 'prettier/vim-prettier', { 'do': 'yarn install' } Plug 'sheerun/vim-polyglot' Plug 'tomasiser/vim-code-dark' Plug 'editorconfig/editorconfig-vim' Plug 'ctrlpvim/ctrlp.vim' - -" Plug 'jiangmiao/auto-pairs', { 'for': 'rust' } -" Plug 'kovisoft/slimv', { 'for': 'lisp' } -" Plug 'leafOfTree/vim-svelte-plugin' -" Plug 'JuliaEditorSupport/julia-vim' - -" Plug 'mhinz/vim-startify' -" Plug 'tpope/vim-sleuth' - -" Language plugins -" Plug 'kovisoft/slimv' -" Plug 'vmchale/dhall-vim' -" Plug 'qnighy/lalrpop.vim' -" Plug 'cespare/vim-toml' -" Plug 'GutenYe/json5.vim' -" Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' } -" Plug 'pest-parser/pest.vim', { 'for': 'pest' } -" Plug 'zah/nim.vim' - -" Plug 'godlygeek/tabular' -" Plug 'plasticboy/vim-markdown' - -" Plug 'aurieh/discord.nvim', { 'do': ':UpdateRemotePlugins'} +Plug 'wakatime/vim-wakatime' +Plug 'andweeb/presence.nvim' call plug#end() @@ -59,7 +41,7 @@ let g:vim_markdown_toml_frontmatter = 1 colorscheme codedark set splitright -set number +set number relativenumber set cursorline set hidden set modeline @@ -69,38 +51,119 @@ set shiftwidth=4 set expandtab set formatoptions+=t set colorcolumn=80 +set textwidth=80 syntax on filetype on filetype plugin indent on +augroup numbertoggle + autocmd! + autocmd BufEnter,FocusGained,InsertLeave,WinEnter * if &nu && mode() != "i" | set rnu | endif + autocmd BufLeave,FocusLost,InsertEnter,WinLeave * if &nu | set nornu | endif +augroup END + " Binds let mapleader = ";" let maplocalleader = ";" -" nnoremap ; : nnoremap T :vsplitvertical resize 54terminali imap kj -" imap ;; :wi nmap :TagbarToggle -" nmap ;; :w - -" let g:LanguageClient_serverCommands = { -" \ 'rust': ['rust-analyzer'], -" \ } -" nnoremap :call LanguageClient_contextMenu() -" function LC_maps() -" if has_key(g:LanguageClient_serverCommands, &filetype) -" nnoremap K :call LanguageClient#textDocument_hover() -" nnoremap gd :call LanguageClient#textDocument_definition() -" nnoremap :call LanguageClient#textDocument_rename() -" endif -" endfunction -" autocmd FileType * call LC_maps() " Plugin-related configs let g:go_fmt_command = "goimports" + +" LSP + +nnoremap gd lua vim.lsp.buf.definition() +nnoremap gD lua vim.lsp.buf.declaration() +nnoremap gr lua vim.lsp.buf.references() +nnoremap gi lua vim.lsp.buf.implementation() +nnoremap K lua vim.lsp.buf.hover() +nnoremap lua vim.lsp.buf.signature_help() +nnoremap k lua vim.lsp.diagnostic.goto_prev() +nnoremap j lua vim.lsp.diagnostic.goto_next() + +lua << EOF + vim.o.completeopt = "menuone,noselect" + + 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 = false; + + source = { + path = true; + buffer = true; + calc = true; + vsnip = true; + nvim_lsp = true; + nvim_lua = true; + spell = true; + tags = true; + snippets_nvim = true; + treesitter = true; + }; + } + local t = function(str) + return vim.api.nvim_replace_termcodes(str, true, true, true) + end + + local check_back_space = function() + local col = vim.fn.col('.') - 1 + if col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') then + return true + else + return false + end + end + + -- Use (s-)tab to: + --- move to prev/next item in completion menuone + --- jump to prev/next snippet's placeholder + _G.tab_complete = function() + if vim.fn.pumvisible() == 1 then + return t "" + elseif vim.fn.call("vsnip#available", {1}) == 1 then + return t "(vsnip-expand-or-jump)" + elseif check_back_space() then + return t "" + else + return vim.fn['compe#complete']() + end + end + _G.s_tab_complete = function() + if vim.fn.pumvisible() == 1 then + return t "" + elseif vim.fn.call("vsnip#jumpable", {-1}) == 1 then + return t "(vsnip-jump-prev)" + else + -- If is not working in your terminal, change it to + return t "" + end + end + + vim.api.nvim_set_keymap("i", "", "v:lua.tab_complete()", {expr = true}) + vim.api.nvim_set_keymap("s", "", "v:lua.tab_complete()", {expr = true}) + vim.api.nvim_set_keymap("i", "", "v:lua.s_tab_complete()", {expr = true}) + vim.api.nvim_set_keymap("s", "", "v:lua.s_tab_complete()", {expr = true}) + + require'lspconfig'.rust_analyzer.setup{} + require'lspconfig'.pyright.setup{} +EOF + +" vim: set sw=2 :