From a9815d3f5b66cf0a5439d0c8c0895d7b446b9511 Mon Sep 17 00:00:00 2001 From: Agatha Lovelace Date: Wed, 11 May 2022 16:14:46 +0200 Subject: [PATCH] new nvim config; some fixes --- .config/nvim/init.vim | 151 +++++++++++++++++++++++++++++++++++++++++ .config/polybar/config | 18 +++-- .config/sxhkd/sxhkdrc | 17 +++-- .vimrc | 80 ++++++++++++++++------ 4 files changed, 238 insertions(+), 28 deletions(-) create mode 100644 .config/nvim/init.vim diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim new file mode 100644 index 0000000..f6af177 --- /dev/null +++ b/.config/nvim/init.vim @@ -0,0 +1,151 @@ +" __ +" / -, +" || ) ; ' +" ~||---) _-_ /'\\ \\/\ \\ \\/\\/\\ +" ~||---, || \\ || || || | || || || || +" ~|| / ||/ || || || | || || || || +" |, / \\,/ \\,/ \\/ \\ \\ \\ \\ +" -_- --~ +" + +" import .vimrc +set runtimepath^=~/.vim runtimepath+=~/.vim/after +let &packpath = &runtimepath +source ~/.vimrc + +" colors +highlight Pmenu guibg=black + +" refresh time +set updatetime=500 + +" keybinds +" code actions +nnoremap :lua vim.lsp.buf.code_action() + +" ale +let g:ale_linters = {'rust': ['analyzer']} + +let g:ale_rust_analyzer_config = { + \ 'cargo': { 'loadOutDirsFromCheck': v:true }, + \ 'procMacro': { 'enable': v:true }, + \ 'checkOnSave': { 'command': 'clippy', 'enable': v:true } +\ } + +let g:lightline.component_expand = { + \ 'linter_checking': 'lightline#ale#checking', + \ 'linter_infos': 'lightline#ale#infos', + \ 'linter_warnings': 'lightline#ale#warnings', + \ 'linter_errors': 'lightline#ale#errors', + \ 'linter_ok': 'lightline#ale#ok', +\ } + +let g:lightline.component_function = { +\ 'gitbranch': 'FugitiveHead' +\ } + +let g:lightline.component_type = { + \ 'linter_checking': 'right', + \ 'linter_infos': 'right', + \ 'linter_warnings': 'warning', + \ 'linter_errors': 'error', + \ 'linter_ok': 'right', +\ } + +" lightline symbols +let g:lightline#ale#indicator_checking = "\uf110" +let g:lightline#ale#indicator_infos = "\uf129" +let g:lightline#ale#indicator_warnings = "\uf071" +let g:lightline#ale#indicator_errors = "\uf05e" +let g:lightline#ale#indicator_ok = "\uf00c" + +" lightline modules +let g:lightline.active = { +\ 'left' : [ +\ ['mode', 'paste'], +\ ['gitbranch', 'readonly', 'filename', 'modified'] +\ ], +\ 'right': [ +\ ['linter_checking', 'linter_errors', 'linter_warnings'], +\ ['lineinfo'], +\ ['percent'], +\ ['fileformat', 'fileencoding', 'filetype'] +\ ] +\} + + +lua << EOF + +-- cursor animations +require('specs').setup{ + show_jumps = true, + min_jump = 30, + popup = { + delay_ms = 100, -- delay before popup displays + inc_ms = 20, -- time increments used for fade/resize effects + blend = 10, -- starting blend, between 0-100 (fully transparent), see :h winblend + width = 10, + winhl = "PMenu", + fader = require('specs').exp_fader, + resizer = require('specs').shrink_resizer + }, + ignore_buftypes = { + nofile = true, + }, +} + +-- lsp config +local nvim_lsp = require 'lspconfig' +local cmp = require'cmp' + +nvim_lsp.rust_analyzer.setup({}) + +local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()) +require('lspconfig')['rust_analyzer'].setup { + capabilities = capabilities +} + +vim.diagnostic.config({ + virtual_text = { + prefix = '' + }, + signs = false +}) + +-- complations +cmp.setup({ + snippet = { + expand = function(args) + vim.fn["vsnip#anonymous"](args.body) + end, + }, + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.abort(), + [''] = cmp.mapping.confirm({ select = true }), + }), + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = 'vsnip' }, + { name = 'calc' }, + }, { + { name = 'buffer' }, + }) +}) + + +require("todo-comments").setup {} + +-- loading status +require"fidget".setup{ + text = { + spinner = "star" + } +} + +require'nvim-web-devicons'.setup { +} + +EOF diff --git a/.config/polybar/config b/.config/polybar/config index 6483ec9..c6e12ea 100644 --- a/.config/polybar/config +++ b/.config/polybar/config @@ -52,10 +52,11 @@ font-0 = DaddyTimeMono:pixelsize=10;3 font-1 = unifont:fontformat=truetype:size=8:antialias=false;2 font-2 = Siji:pixelsize=11;2 font-3 = Symbols Nerd Font:pixelsize=10;2 +font-4 = unifont:fontformat=truetype:size=8:antialias=false;1 modules-left = bspwm modules-center = date -modules-right = filesystem battery pulseaudio xkeyboard memory cpu powermenu +modules-right = filesystem battery pulseaudio xkeyboard vpn-wireguard-wg memory cpu powermenu wm-restack = bspwm @@ -207,7 +208,7 @@ label-volume-foreground = ${root.foreground} label-muted =  muted label-muted-foreground = #666 -bar-volume-width = 25 +bar-volume-width = 14 bar-volume-foreground-0 = #55aa55 bar-volume-foreground-1 = #55aa55 bar-volume-foreground-2 = #55aa55 @@ -217,10 +218,10 @@ bar-volume-foreground-5 = #f5a70a bar-volume-foreground-6 = #ff5555 bar-volume-gradient = false bar-volume-indicator = | -bar-volume-indicator-font = 2 -bar-volume-fill = - +bar-volume-indicator-font = 5 +bar-volume-fill = ─ bar-volume-fill-font = 2 -bar-volume-empty = - +bar-volume-empty = ─ bar-volume-empty-font = 2 bar-volume-empty-foreground = ${colors.foreground-alt} @@ -364,6 +365,13 @@ exec = ~/.config/polybar/scripts/mullvad-status.sh | sed 's/VPN disconnected//g' interval = 2 format-prefix = " " +[module/vpn-wireguard-wg] +type = custom/script +exec = ~/.config/polybar/scripts/vpn-wireguard-wg.sh +interval = 5 +click-left = kitty nmtui +format-prefix = " " + [module/notification-status] type = custom/script exec = ~/.config/polybar/scripts/notification-status.sh diff --git a/.config/sxhkd/sxhkdrc b/.config/sxhkd/sxhkdrc index 297e21e..d6f8b76 100644 --- a/.config/sxhkd/sxhkdrc +++ b/.config/sxhkd/sxhkdrc @@ -36,13 +36,17 @@ super + slash # open clipboard alt + v - CM_LAUNCHER=rofi clipmenu \ - -theme-str 'listview \{ spacing: 0; \}' \ - -theme-str 'window \{ width: 30em; \}' + CM_LAUNCHER=rofi clipmenu \ + -theme-str 'listview \{ spacing: 0; \}' \ + -theme-str 'window \{ width: 30em; \}' # open calculator alt + c - rofi -show calc -modi calc -calc-command 'xdotool type --clearmodifiers "\{result\}"' + rofi -show calc -modi calc -calc-command 'xdotool type --clearmodifiers "\{result\}"' + +# kill program +super + shift + x + kill -9 $(ps --sort=-pcpu -ax | rofi -dmenu | choose 0 ) # open a terminal emulator Caps_Lock @@ -204,3 +208,8 @@ super + r # move a floating window super + {Left,Down,Up,Right} bspc node -v {-20 0,0 20,0 -20,20 0} + + +# lock screen +super + x + betterlockscreen --lock dimblur diff --git a/.vimrc b/.vimrc index ad4f52e..8d7b929 100644 --- a/.vimrc +++ b/.vimrc @@ -9,45 +9,78 @@ " Load plugins call plug#begin('~/.vim/bundle') -Plug 'aliva/vim-fish' +Plug 'aliva/vim-fish', {'for': 'fish'} Plug 'cocopon/iceberg.vim' Plug 'dhruvasagar/vim-table-mode' Plug 'fadein/vim-FIGlet' Plug 'gkeep/iceberg-dark' Plug 'itchyny/lightline.vim' -Plug 'karolbelina/uxntal.vim' -Plug 'lambdalisue/fern-renderer-nerdfont.vim' -Plug 'lambdalisue/fern.vim' -Plug 'lambdalisue/nerdfont.vim' +Plug 'jistr/vim-nerdtree-tabs' +Plug 'karolbelina/uxntal.vim', {'for': 'uxntal'} Plug 'lilydjwg/colorizer' +Plug 'mg979/vim-visual-multi' Plug 'owickstrom/vim-colors-paramount' +Plug 'raimondi/delimitmate' Plug 'tpope/vim-commentary' -Plug 'vim-scripts/nginx.vim' +Plug 'vim-scripts/nginx.vim', {'for': 'nginx'} Plug 'yuttie/comfortable-motion.vim' + +Plug 'ryanoasis/vim-devicons' +" don't install these plugins on remote servers +if has('nvim') + Plug 'folke/todo-comments.nvim' + Plug 'hrsh7th/cmp-calc' + Plug 'j-hui/fidget.nvim' + Plug 'jghauser/mkdir.nvim' + Plug 'stevearc/dressing.nvim' + Plug 'airblade/vim-gitgutter' + Plug 'antoinemadec/FixCursorHold.nvim' + Plug 'edluffy/specs.nvim' + Plug 'folke/lsp-colors.nvim' + Plug 'folke/trouble.nvim' + Plug 'hrsh7th/cmp-buffer' + Plug 'hrsh7th/cmp-cmdline' + Plug 'hrsh7th/cmp-nvim-lsp' + Plug 'hrsh7th/cmp-path' + Plug 'hrsh7th/cmp-vsnip' + Plug 'hrsh7th/nvim-cmp' + Plug 'hrsh7th/vim-vsnip' + Plug 'kyazdani42/nvim-web-devicons' + Plug 'maximbaz/lightline-ale' + Plug 'neovim/nvim-lspconfig' + Plug 'nvim-lua/plenary.nvim' + Plug 'nvim-telescope/telescope.nvim' + Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} + Plug 'tpope/vim-fugitive' + Plug 'w0rp/ale' + Plug 'xuyuanp/nerdtree-git-plugin' +endif + call plug#end() - " Lightline config let g:lightline = { \ 'colorscheme': 'icebergDark', \ } - -" Fern config -let g:fern#renderer = "nerdfont" - - " Comfortable Motion config noremap :call comfortable_motion#flick(20) noremap :call comfortable_motion#flick(-20) +" VM config +let g:VM_maps = {} +let g:VM_maps["I BS"] = '' -" Aliases +" Nerdtree/git config +let g:NERDTreeGitStatusConcealBrackets = 1 + + +" Aliases command Header FIGlet -f Gothic cmap W w !sudo tee > /dev/null % -nnoremap :NERDTreeToggle - +nnoremap :NERDTreeTabsToggle + " Colorscheme set background=dark set termguicolors @@ -55,18 +88,19 @@ colorscheme paramount let bgcolor = synIDattr(hlID("Normal"), "bg") let fgcolor = synIDattr(hlID("Identifier"), "fg") +let colors = "\033]11;" . fgcolor . "\007\033]11;" . bgcolor . "\007" if has('gui_running') || has('nvim') - hi Normal guifg=fgcolor guibg=bgcolor + autocmd VimEnter * call chansend(v:stderr, colors) + autocmd VimLeave * call chansend(v:stderr, "\033]110\007\033]111\007") else " Set the terminal default background and foreground colors, thereby " improving performance by not needing to set these colors on empty cells. hi Normal guifg=NONE guibg=NONE ctermfg=NONE ctermbg=NONE - let &t_ti = &t_ti . "\033]10;" . fgcolor . "\007\033]11;" . bgcolor . "\007" + let &t_ti = &t_ti . colors let &t_te = &t_te . "\033]110\007\033]111\007" endif - " Vanilla config syntax on filetype plugin indent on @@ -75,12 +109,16 @@ set number set wrap set mouse=a set softtabstop=4 noexpandtab +set ts=4 sw=4 + +set autoindent +set smartindent set laststatus=2 set noshowmode set whichwrap+=<,>,h,l -" let &t_SI = "\[6 q" +let &t_SI = "\[6 q" " let &t_SR = "\[4 q" let &t_EI = "\[2 q" @@ -89,8 +127,12 @@ set clipboard=unnamedplus nnoremap d "_d vnoremap d "_d +set ignorecase +set smartcase set hlsearch +let @/='' " fix search on startup set encoding=utf-8 scriptencoding utf-8 setglobal fileencoding=utf-8 +set ffs=unix,dos