From f704dd8b5ea321dc63cc208e5715ac0009cb3f2f Mon Sep 17 00:00:00 2001 From: TiynGER Date: Fri, 30 Oct 2020 08:12:56 +0100 Subject: [PATCH] qol changes - minor changes to snippets - minor changes to aliases - switching from ycm to coc for nvim autocomplete --- .config/aliasrc | 7 +- .config/fontconfig/fonts.conf | 2 +- .config/mimeapps.list | 9 --- .config/nvim/.netrwhist | 7 -- .config/nvim/UltiSnips/tex.snippets | 37 ++++++--- .config/nvim/init.vim | 116 +++++++++++++++++++++------- .config/sxhkd/sxhkdrc | 8 +- .local/bin/tools/dwm/togglemonitor | 4 +- 8 files changed, 126 insertions(+), 64 deletions(-) delete mode 100644 .config/mimeapps.list delete mode 100644 .config/nvim/.netrwhist diff --git a/.config/aliasrc b/.config/aliasrc index 3fba568..2634dee 100644 --- a/.config/aliasrc +++ b/.config/aliasrc @@ -39,7 +39,7 @@ haste() { } #khal -alias calendar="khal" +alias calendar="khal interactive" # khard alias contacts="khard" @@ -53,8 +53,9 @@ alias tree="lsd --tree" # mkdir alias mkdir="mkdir -p" -# mount -alias mount="mount |column -t" +# mutt +alias mutt="neomutt" +alias upmutt="mbsync -a && neomutt" # mv alias mv="mv -i" diff --git a/.config/fontconfig/fonts.conf b/.config/fontconfig/fonts.conf index e9c9b3f..1a5f2b0 100644 --- a/.config/fontconfig/fonts.conf +++ b/.config/fontconfig/fonts.conf @@ -28,7 +28,7 @@ monospace - JetBrainsMono Nerd Font Mono + JetBrainsMono Nerd Font Mono BlexMono Nerd Font Mono Joy Pixels Noto Color Emoji diff --git a/.config/mimeapps.list b/.config/mimeapps.list deleted file mode 100644 index 535afe0..0000000 --- a/.config/mimeapps.list +++ /dev/null @@ -1,9 +0,0 @@ -[Default Applications] -x-scheme-handler/mailto=mail.desktop -text/plain=text.desktop; -text/x-shellscript=text.desktop; -application/pdf=pdf.desktop; -image/png=img.desktop; -image/jpeg=img.desktop; -image/gif=img.desktop; -application/rss+xml=rss.desktop diff --git a/.config/nvim/.netrwhist b/.config/nvim/.netrwhist deleted file mode 100644 index aca4713..0000000 --- a/.config/nvim/.netrwhist +++ /dev/null @@ -1,7 +0,0 @@ -let g:netrw_dirhistmax =10 -let g:netrw_dirhistcnt =5 -let g:netrw_dirhist_5='/etc/security' -let g:netrw_dirhist_4='/home/tiynger/irc/irc.gnu.org/#gnu' -let g:netrw_dirhist_3='/home/tiynger/irc/irc.hackint.org/#36c3-hall-b' -let g:netrw_dirhist_2='/home/tiynger/.config/zsh' -let g:netrw_dirhist_1='/boot/loader/entries' diff --git a/.config/nvim/UltiSnips/tex.snippets b/.config/nvim/UltiSnips/tex.snippets index 52a1bd7..5ed668d 100644 --- a/.config/nvim/UltiSnips/tex.snippets +++ b/.config/nvim/UltiSnips/tex.snippets @@ -29,10 +29,11 @@ snippet ,fr "Frame" A \frametitle{$1} $2 \end{frame} +$3 endsnippet snippet ,em "Emphasis" A -\emph{$1} +\emph{$1} $2 endsnippet snippet ,bf "Bold" A @@ -55,12 +56,14 @@ snippet ,ol "Enumeration" A \begin{enumerate} \item $1 \end{enumerate} +$2 endsnippet snippet ,ul "Itemization" A \begin{itemize} \item $1 \end{itemize} +$2 endsnippet snippet ,li "List element" A @@ -76,6 +79,7 @@ snippet ,tab "Tabular" A \begin{tabular} $1 \end{tabular} +$2 endsnippet snippet ,a "Hyperlink" A @@ -87,34 +91,45 @@ snippet ,sc "Small caps" A endsnippet snippet ,chap "Chapter" A -\chapter{$1} +\chapter {$1} $2 endsnippet snippet ,sec "Section" A -\section*{$1} +\section* {$1} +$2 +endsnippet + +snippet ,lsec "Section" A +\section {$1} $2 endsnippet snippet ,ssec "Subsection" A -\subsection*{$1} +\subsection* {$1} $2 endsnippet snippet ,sssec "Subsubsection" A -\subsubsection*{$1} +\subsubsection* {$1} $2 endsnippet -snippet ,up "Use Packagage" A -\usepackage{$1} +snippet ,par "Paragraph" A +\paragraph* {$1} +$2 endsnippet -snippet ,tt "Typewriter" A -\texttt{$1} $2 +snippet ,spar "Subparagraph" A +\subparagraph* {$1} +$2 endsnippet -snippet ,par "Paragraph" A -\paragraph*{$1} +snippet ,up "Use Packagage" A +\usepackage{$1} $2 endsnippet + +snippet ,ttt "Typewriter" A +\texttt{$1} $2 +endsnippet diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index 4a0d1c4..3ac23e4 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -6,11 +6,15 @@ if ! filereadable(expand('~/.config/nvim/autoload/plug.vim')) autocmd VimEnter * PlugInstall endif +" Read files correctly +autocmd BufRead,BufNewFile *.tex set filetype=tex +autocmd BufRead,BufNewFile *.h set filetype=c + call plug#begin('~/.local/share/nvim/plugged') Plug 'lervag/vimtex' , {'for' : 'tex'} " Tex library for autocompletion Plug 'donRaphaco/neotex' , {'for': 'tex'} " Asynchronous pdf rendering Plug 'scrooloose/nerdtree', {'on': 'NERDTreeToggle'} " Filetree -Plug 'majutsushi/tagbar' " Show tags +Plug 'majutsushi/tagbar', {'on': 'TagbarToggle'} " Show tags Plug 'airblade/vim-gitgutter' " Git Upgrades Plug 'qpkorr/vim-renamer' " Bulk renamer Plug 'sirver/ultisnips' " Snippets @@ -20,31 +24,77 @@ Plug 'junegunn/fzf.vim' " Quickly jump files using fzf Plug 'ryanoasis/vim-devicons' " Enable Icons for vim Plug 'rrethy/vim-hexokinase' , {'do': 'make hexokinase'} " Color Preview Plug 'tomasiser/vim-code-dark' " adding colorscheme -"Plug 'blueshirts/darcula' -Plug 'godlygeek/tabular' " Tabularizing things -Plug 'plasticboy/vim-markdown' , {'for': 'md'} " Helps for markdown Plug 'tpope/vim-surround' " Help for quotes/parantheses Plug 'alvan/vim-closetag' " Auto close HTML tags +Plug 'neoclide/coc.nvim', {'do': 'yarn install --frozen-lockfile'} call plug#end() +" Coc +inoremap + \ pumvisible() ? "\" : + \ check_back_space() ? "\" : + \ coc#refresh() +inoremap pumvisible() ? "\" : "\" + +function! s:check_back_space() abort + let col = col('.') - 1 + return !col || getline('.')[col - 1] =~# '\s' +endfunction + +let g:coc_global_extensions = [ + \ 'coc-java', + \ 'coc-python', + \ 'coc-vimtex', + \ ] + +if has('nvim') + inoremap coc#refresh() +else + inoremap coc#refresh() +endif + +inoremap pumvisible() ? coc#_select_confirm() + \: "\u\\=coc#on_enter()\" + +nmap gd (coc-definition) +nmap gy (coc-type-definition) +nmap gi (coc-implementation) +nmap gr (coc-references) +nnoremap K :call show_documentation() + +function! s:show_documentation() + if (index(['vim','help'], &filetype) >= 0) + execute 'h '.expand('') + elseif (coc#rpc#ready()) + call CocActionAsync('doHover') + else + execute '!' . &keywordprg . " " . expand('') + endif +endfunction + +autocmd CursorHold * silent call CocActionAsync('highlight') + +nmap rn (coc-rename) + +xmap f (coc-format-selected) +nmap f (coc-format-selected) + +augroup mygroup + autocmd! + autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected') + autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') +augroup end + +set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')} + " Colorscheme colorscheme codedark " Rainbow -au FileType java,c,cpp,py,h call rainbow#load() - -" You complete me -let g:ycm_global_ycm_extra_conf = '/home/tiynger/.config/nvim/ycm_extra_conf.py' -let g:ycm_autoclose_preview_window_after_completion = 1 -let g:ycm_autoclose_preview_window_after_insertion = 1 -let g:ycm_semantic_triggers = { - \ 'tex' : ['{'] - \} -if !exists('g:ycm_semantic_triggers') - let g:ycm_semantic_triggers = {} -endif -let g:ycm_semantic_triggers.tex = g:vimtex#re#youcompleteme -let g:ycm_filepath_blacklist = {'*': 1} +au FileType,BufNewFile,BufRead java,c,cpp,py,h call rainbow#load() + +" Ultisnippets +let g:UltiSnipsExpandTrigger="" " Tagbar map :TagbarToggle @@ -76,10 +126,6 @@ let g:Hexokinase_optInPatterns = [ let g:Hexokinase_highlighters = ['backgroundfull'] autocmd VimEnter * HexokinaseTurnOn -" Vim-Mardown -let g:vim_markdown_folding_disabled=1 -let g:vim_markdown_no_default_key_mappings=1 - " Vim-Closetag let g:closetag_filenames = '*.html,*.xhtml,*.phtml' let g:closetag_xhtml_filenames = '*.xhtml,*.jsx' @@ -126,6 +172,22 @@ set number relativenumber " Speedup vim with long lines set ttyfast set lazyredraw +" TextEdit might fail without hidden +set hidden +" Disable Backupfiles for Lsp +set nobackup +set nowritebackup +" Dont pass messages to ins-completion-menu +set shortmess+=c +" Always show the signcolumn, otherwise it would shift the text each time +" diagnostics appear/become resolved. +if has("patch-8.1.1564") + " Recently vim can merge signcolumn and number column into one + set signcolumn=number +else + set signcolumn=yes +endif + " enable persistent undo if has('persistent_undo') @@ -144,9 +206,6 @@ autocmd BufWritePre * :call TrimWhitespace() autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o " Clean LaTex build files autocmd VimLeave *.tex !texclear % -" Read files correctly -autocmd BufRead,BufNewFile *.tex set filetype=tex -autocmd BufRead,BufNewFile *.h set filetype=c " Mapping Dictionaries map :setlocal spell! spelllang=de_de @@ -170,16 +229,19 @@ nnoremap S :%s//gI " Start Formatting section -autocmd FileType java,python,c,tex,latex noremap gggqG - au FileType python setlocal formatprg=autopep8\ - au FileType java setlocal formatprg=astyle\ --indent=spaces=2\ --style=google + autocmd FileType java setlocal shiftwidth=2 softtabstop=2 au FileType c setlocal formatprg=astyle\ --mode=c au FileType tex,latex setlocal formatprg=latexindent\ - +autocmd FileType java,python,c,tex,latex noremap gggqG + +au FileType markdown noremap :silent %!prettier --stdin-filepath % + " End Formatting section diff --git a/.config/sxhkd/sxhkdrc b/.config/sxhkd/sxhkdrc index d3014c6..8621cb9 100644 --- a/.config/sxhkd/sxhkdrc +++ b/.config/sxhkd/sxhkdrc @@ -23,13 +23,13 @@ super + F7 super + F8 dmenuumount super + F9 - sudo -A systemmctl restart NetworkManager + sudo -A systemctl restart NetworkManager super + F10 - prompt "Lock computer?" slock + prompt "Lock computer?" "slock" super + F11 - prompt "Shutdown computer?" sudo -A shutdown -h now + prompt "Shutdown computer?" "sudo -A shutdown -h now" super + F12 - prompt "Reboot computer?" sudo -A reboot now + prompt "Reboot computer?" "sudo -A reboot now" XF86Launch1 xset dpms force off XF86AudioMute diff --git a/.local/bin/tools/dwm/togglemonitor b/.local/bin/tools/dwm/togglemonitor index 7ccc1e0..c894b0d 100755 --- a/.local/bin/tools/dwm/togglemonitor +++ b/.local/bin/tools/dwm/togglemonitor @@ -3,8 +3,8 @@ # toggle external monitor # by lukesmithxyz, checkout github.com/lukesmithxyz/voidrice -intern=LVDS-1 -extern=HDMI-2 +intern=LVDS1 +extern=HDMI2 (xrandr | grep "$extern disconnected") (xrandr --listactivemonitors | grep $extern) || ((xrandr --output $extern --right-of $intern --auto && setbg) & exit) (xrandr --listactivemonitors | grep $extern) && xrandr --output $extern --off