From f154d3f778214e5cca7f2e6fb9412184b57edf04 Mon Sep 17 00:00:00 2001 From: InigoGutierrez Date: Tue, 20 Sep 2022 13:57:02 +0200 Subject: Changes mostly to vim, trying neovim LSP. --- stow/nvim/.config/nvim/ftplugin/python/python.vim | 17 +++++++++++++ stow/nvim/.config/nvim/ftplugin/sh/sh.vim | 16 +++++++++++++ stow/nvim/.config/nvim/init.vim | 28 ++++++++++++++++++++++ stow/qutebrowser/.config/qutebrowser/config.py | 5 +++- stow/rcs/.bash_vars | 7 ++++-- stow/sxhkd/.config/sxhkd/sxhkdrc | 8 +++---- stow/vim/.vim/ftplugin/python/python.vim | 15 ++++++------ stow/vim/.vim/ftplugin/sh/sh.vim | 3 +-- stow/vim/.vim/ftplugin/sh/snippets/template.txt | 18 +++++++++----- stow/vim/.vim/ftplugin/tex/tex.vim | 5 ++++ stow/vim/.vim/ftplugin/vimwiki/vimwiki.vim | 2 -- stow/vim/.vim/rc/color.vim | 1 + stow/vim/.vim/rc/vimwiki.vim | 29 ++++++++++++++++++++++- stow/vim/.vimrc | 9 +++---- 14 files changed, 133 insertions(+), 30 deletions(-) create mode 100644 stow/nvim/.config/nvim/ftplugin/python/python.vim create mode 100644 stow/nvim/.config/nvim/ftplugin/sh/sh.vim diff --git a/stow/nvim/.config/nvim/ftplugin/python/python.vim b/stow/nvim/.config/nvim/ftplugin/python/python.vim new file mode 100644 index 0000000..9e56582 --- /dev/null +++ b/stow/nvim/.config/nvim/ftplugin/python/python.vim @@ -0,0 +1,17 @@ +let mapleader = " " + +nnoremap K :lua vim.lsp.buf.hover() +nnoremap gd :lua vim.lsp.buf.definition() +nnoremap gr :lua vim.lsp.buf.references() +nnoremap gR :lua vim.lsp.buf.rename() +nnoremap e :lua vim.diagnostic.open_float() +nnoremap E :lua vim.diagnostic.setloclist() +nnoremap [e :lua vim.diagnostic.goto_prev({float=false}) +nnoremap ]e :lua vim.diagnostic.goto_next({float=false}) +nnoremap a :lua vim.lsp.buf.code_action() +nnoremap ds :lua vim.lsp.buf.document_symbol() + +let mapleader = "," + +setlocal omnifunc=v:lua.vim.lsp.omnifunc +setlocal formatexpr=v:lua.vim.lsp.formatexpr() diff --git a/stow/nvim/.config/nvim/ftplugin/sh/sh.vim b/stow/nvim/.config/nvim/ftplugin/sh/sh.vim new file mode 100644 index 0000000..ca7a246 --- /dev/null +++ b/stow/nvim/.config/nvim/ftplugin/sh/sh.vim @@ -0,0 +1,16 @@ +let mapleader = " " + +nnoremap K :lua vim.lsp.buf.hover() +nnoremap gd :lua vim.lsp.buf.definition() +nnoremap gr :lua vim.lsp.buf.references() +nnoremap gR :lua vim.lsp.buf.rename() +nnoremap e :lua vim.diagnostic.open_float() +nnoremap E :lua vim.diagnostic.setloclist() +nnoremap [e :lua vim.diagnostic.goto_prev({float=false}) +nnoremap ]e :lua vim.diagnostic.goto_next({float=false}) +nnoremap ds :lua vim.lsp.buf.document_symbol() + +let mapleader = "," + +setlocal omnifunc=v:lua.vim.lsp.omnifunc +setlocal formatexpr=v:lua.vim.lsp.formatexpr() diff --git a/stow/nvim/.config/nvim/init.vim b/stow/nvim/.config/nvim/init.vim index f182e5b..f5360b1 100644 --- a/stow/nvim/.config/nvim/init.vim +++ b/stow/nvim/.config/nvim/init.vim @@ -1,3 +1,31 @@ set runtimepath^=~/.vim runtimepath+=~/.vim/after let &packpath = &runtimepath source ~/.vimrc + +sign define DiagnosticSignError text= texthl= linehl= numhl=DiagnosticSignError +sign define DiagnosticSignWarn text= texthl= linehl= numhl=DiagnosticSignWarn +sign define DiagnosticSignInfo text= texthl= linehl= numhl=DiagnosticSignInfo +sign define DiagnosticSignHint text= texthl= linehl= numhl=DiagnosticSignHint + +lua vim.diagnostic.config({ + \virtual_text = true, + \signs = true, underline = true, + \update_in_insert = + \true, severity_sort = true +\}) + +lua require('lspconfig').bashls.setup{} + +lua require('lspconfig').texlab.setup{} + +lua require('lspconfig').pylsp.setup{ + \settings = { + \pylsp = { + \plugins = { + \pycodestyle = { + \maxLineLength = 90 + \} + \} + \} + \} +\} diff --git a/stow/qutebrowser/.config/qutebrowser/config.py b/stow/qutebrowser/.config/qutebrowser/config.py index 7eb1365..2e0d422 100644 --- a/stow/qutebrowser/.config/qutebrowser/config.py +++ b/stow/qutebrowser/.config/qutebrowser/config.py @@ -1394,7 +1394,10 @@ c.url.searchengines = { 'keys': 'https://keys.openpgp.org/search?q={}', # openPGP keys 'fl': 'https://fallenlondon.wiki/w/index.php?search={}', # Fallen London wiki 'gt': 'https://translate.google.com/?sl=en&tl=es&text={}', # Google Translate - 'tiempo': 'https://www.eltiempo.es/{}.html', # eltiempo.es + 't': 'https://simplytranslate.org/?engine=google&text={}&sl=auto&tl=es', # SimplyTranslate + 'te': 'https://simplytranslate.org/?engine=google&text={}&sl=auto&tl=en', # SimplyTranslate to English + 'tiempo': 'https://www.eltiempo.es/{}.html', # eltiempo.es, + 'dq': 'https://dream-quest.fandom.com/wiki/{}', # Dream Quest 'wb': 'https://wiby.me/?q={}' # Wiby } diff --git a/stow/rcs/.bash_vars b/stow/rcs/.bash_vars index a73a118..40b751e 100644 --- a/stow/rcs/.bash_vars +++ b/stow/rcs/.bash_vars @@ -29,7 +29,10 @@ export CONFIG_DIC_ES="/usr/share/dict/spanish" export CONFIG_DIC_EN="/usr/share/dict/british" export CONFIG_DIC_PL="/usr/share/dict/słowa.txt" -export CONFIG_FOLDER_RANDOMBG="$HOME/images/wallpapers/shufs/current" +export CONFIG_FOLDER_RANDOMWP="$HOME/images/wallpapers/shufs/current" +export CONFIG_WPLIST="$HOME/.local/share/wpHistory.dat" +export CONFIG_WPPOINTER="/tmp/wppointer" + export CONFIG_FOLDER_LOGS="$HOME/logs" export CONFIG_WIFI_DEV="wlp2s0" @@ -65,7 +68,7 @@ export LESS_TERMCAP_ue=$'\E[0m' # Set LS_COLORS (enable color support of ls and others) if [ -x /usr/bin/dircolors ]; then dircolorsFile="$HOME/.config/dircolors" - [ -r "$dircolorsFile" ] && + [ -r "$dircolorsFile" ] && eval "$(dircolors -b $dircolorsFile)" || eval "$(dircolors -b)" fi diff --git a/stow/sxhkd/.config/sxhkd/sxhkdrc b/stow/sxhkd/.config/sxhkd/sxhkdrc index 5556aa9..7f3f786 100644 --- a/stow/sxhkd/.config/sxhkd/sxhkdrc +++ b/stow/sxhkd/.config/sxhkd/sxhkdrc @@ -74,12 +74,12 @@ super + q super + shift + f firefox -# super + shift + w -# prevBG - super + w setRandomBG.sh +super + ctrl + w; {n,p,o} + wpPointer.sh -{n,p,o} + Print screenshot.sh @@ -101,7 +101,7 @@ super + shift + c super + d dmenuDic.sh -super + shift + t +super + t dmenutranslate # Emoji keyboard diff --git a/stow/vim/.vim/ftplugin/python/python.vim b/stow/vim/.vim/ftplugin/python/python.vim index 0aeff8c..dab8c22 100644 --- a/stow/vim/.vim/ftplugin/python/python.vim +++ b/stow/vim/.vim/ftplugin/python/python.vim @@ -10,21 +10,20 @@ setlocal list call matchadd('ColorColumn', '\%91v', 100) setlocal textwidth=90 -let b:ale_python_pylint_options = '-d invalid-name' -let b:ale_fixers = ['yapf'] +"let b:ale_python_pylint_options = '-d invalid-name' +"let b:ale_fixers = ['yapf'] " Mappings let mapleader = " " nnoremap C :sp ~/.vim/ftplugin/python/python.vim -nnoremap x :! ./% -nnoremap X :! ./% +nnoremap x :w:!./% +nnoremap X :w:!./% -nnoremap gd (coc-definition) -nnoremap gy (coc-type-definition) -nnoremap gi (coc-implementation) -nnoremap gr (coc-references) +"nnoremap gd (coc-definition) +"nnoremap gy (coc-type-definition) +"nnoremap gr (coc-references) nnoremap s oimport pdbpdb.set_trace()2k nnoremap db :!tmux split-window -l '40\%' 'python -m̀ pdb %' diff --git a/stow/vim/.vim/ftplugin/sh/sh.vim b/stow/vim/.vim/ftplugin/sh/sh.vim index cc52e08..58d39fe 100644 --- a/stow/vim/.vim/ftplugin/sh/sh.vim +++ b/stow/vim/.vim/ftplugin/sh/sh.vim @@ -11,13 +11,12 @@ setlocal textwidth=110 let mapleader = " " nnoremap C :sp ~/.vim/ftplugin/sh/sh.vim -nnoremap sh :read ~/.vim/ftplugin/sh/snippets/template.txt nnoremap +x :!chmod 744 % nnoremap x :w:!./% nnoremap X :w:!./% -nnoremap e :Errors let mapleader = "," +inoremap sh :read ~/.vim/ftplugin/sh/snippets/template.txt inoremap if :read ~/.vim/ftplugin/sh/snippets/if.txtkdd/<+++>cf> inoremap case :read ~/.vim/ftplugin/sh/snippets/case.txtkdd/<+++>cf> diff --git a/stow/vim/.vim/ftplugin/sh/snippets/template.txt b/stow/vim/.vim/ftplugin/sh/snippets/template.txt index 64d3a2e..171dcf8 100644 --- a/stow/vim/.vim/ftplugin/sh/snippets/template.txt +++ b/stow/vim/.vim/ftplugin/sh/snippets/template.txt @@ -4,7 +4,15 @@ # # Usage: template.sh [-ac] [-b OPTARG] FILE... -usageMessage="Usage: template.sh [-ac] [-b OPTARG] FILE..." +usageMessage="Usage: ${0} [-ac] [-b OPTARG] FILE..." + +error() { + printf '%s error: %s\n' "$0" "$*" >&2 +} + +errorAndUsage() { + printf '%s error: %s\n%s\n' "$0" "$*" "$usageMessage" >&2 +} # Process options while getopts ':ab:c' opt; do @@ -15,7 +23,7 @@ while getopts ':ab:c' opt; do ;; 'b' ) - echo b $OPTARG + echo b "$OPTARG" ;; 'c' ) @@ -23,11 +31,9 @@ while getopts ':ab:c' opt; do ;; '?' ) - printf "${usageMessage}\n" + printf '%s\n' "$usageMessage" exit 1 esac done -shift $(($OPTIND - 1)) - -<++> +shift $((OPTIND - 1)) diff --git a/stow/vim/.vim/ftplugin/tex/tex.vim b/stow/vim/.vim/ftplugin/tex/tex.vim index 87f3c88..f84f73e 100644 --- a/stow/vim/.vim/ftplugin/tex/tex.vim +++ b/stow/vim/.vim/ftplugin/tex/tex.vim @@ -6,10 +6,15 @@ call matchadd('ColorColumn', '\%91v', 100) setlocal textwidth=80 +setlocal omnifunc=v:lua.vim.lsp.omnifunc +setlocal formatexpr=v:lua.vim.lsp.formatexpr() + let mapleader = " " nnoremap C :sp ~/.vim/ftplugin/tex/tex.vim nnoremap e :Errors +nnoremap K :lua vim.lsp.buf.hover() +nnoremap gd :lua vim.lsp.buf.definition() " proselint not enabled by default (it's slow) "nnoremap sp :SyntasticCheck proselint diff --git a/stow/vim/.vim/ftplugin/vimwiki/vimwiki.vim b/stow/vim/.vim/ftplugin/vimwiki/vimwiki.vim index d51844b..3a6a661 100644 --- a/stow/vim/.vim/ftplugin/vimwiki/vimwiki.vim +++ b/stow/vim/.vim/ftplugin/vimwiki/vimwiki.vim @@ -20,8 +20,6 @@ highlight Title ctermfg=blue highlight TitleHash ctermfg=cyan match TitleHash /^##*/ -setlocal conceallevel=0 - let mapleader = " " nnoremap C :sp ~/.vim/ftplugin/vimwiki/vimwiki.vim diff --git a/stow/vim/.vim/rc/color.vim b/stow/vim/.vim/rc/color.vim index ea8bf0e..ec18335 100644 --- a/stow/vim/.vim/rc/color.vim +++ b/stow/vim/.vim/rc/color.vim @@ -25,6 +25,7 @@ highlight MatchParen ctermbg=cyan ctermfg=black " Errors colors highlight Error ctermbg=red ctermfg=black +highlight ErrorMsg ctermbg=red ctermfg=black highlight SpellBad ctermbg=red ctermfg=black " Comments colors diff --git a/stow/vim/.vim/rc/vimwiki.vim b/stow/vim/.vim/rc/vimwiki.vim index e31d2da..c46f815 100644 --- a/stow/vim/.vim/rc/vimwiki.vim +++ b/stow/vim/.vim/rc/vimwiki.vim @@ -2,6 +2,33 @@ Plug 'vimwiki/vimwiki' " For vimwiki " filetype plugin on + +" Register relationships of extensions to syntaxes let g:vimwiki_ext2syntax = {'.md': 'markdown', '.markdown': 'markdown', '.mdown': 'markdown'} -let g:vimwiki_list = [{'path': '~/docs/notas/', 'syntax': 'markdown', 'ext': '.md'}, + +let g:vimwiki_list = [{'path': '~/docs/notas/', 'syntax': 'markdown', 'ext': '.md', 'diary_rel_path': 'diario/', 'diary_index': 'index'}, \ {'path': '~/docs/vimwiki/', 'syntax': 'markdown', 'ext': '.md'}] + +let g:vimwiki_conceallevel = 1 + +" Treat files with registered extensions as vimwiki +let g:vimwiki_global_ext = 1 + +" Symbols to show progression of list items +let g:vimwiki_listsyms = ' .oOX' + +" Append wiki file extension to links in Markdown +let g:vimwiki_markdown_link_ext = 1 + +" Perform an :lcd to the wiki's root folder on page opening +let g:vimwiki_auto_chdir = 1 + +" Automatically generate a level 1 header when creating a new wiki page +let g:vimwiki_auto_header = 1 + +let g:vimwiki_diary_months = { + \ 1: 'Enero', 2: 'Febrero', 3: 'Marzo', + \ 4: 'Abril', 5: 'Mayo', 6: 'Junio', + \ 7: 'Julio', 8: 'Agosto', 9: 'Septiembre', + \ 10: 'Octubre', 11: 'Noviembre', 12: 'Diciembre' +\ } diff --git a/stow/vim/.vimrc b/stow/vim/.vimrc index db8302a..9ef44be 100644 --- a/stow/vim/.vimrc +++ b/stow/vim/.vimrc @@ -15,18 +15,16 @@ source ~/.vim/rc/git.vim call plug#begin('~/.vim/plugged') "Update with PlugInstall Plug 'PotatoesMaster/i3-vim-syntax' +Plug 'dylanaraps/wal.vim' Plug 'arcticicestudio/nord-vim' Plug 'tpope/vim-surround' Plug 'tpope/vim-repeat' "Plug 'psliwka/vim-smoothie' -Plug 'dylanaraps/wal.vim' +Plug 'neovim/nvim-lspconfig' source ~/.vim/rc/goyo.vim source ~/.vim/rc/fzf.vim source ~/.vim/rc/vimwiki.vim source ~/.vim/rc/airline.vim -source ~/.vim/rc/nvim-jdtls.vim -"source ~/.vim/rc/ale.vim -source ~/.vim/rc/coc.vim call plug#end() @@ -36,4 +34,7 @@ call plug#end() "source ~/.vim/rc/omnisharp.vim "source ~/.vim/rc/syntastic.vim "source ~/.vim/rc/deoplete.vim +"source ~/.vim/rc/ale.vim +"source ~/.vim/rc/coc.vim "source ~/.vim/rc/youCompleteMe.vim +"source ~/.vim/rc/nvim-jdtls.vim -- cgit v1.2.1