From 6bbc6d0d9df11fcae18a4421af23f889c88b8480 Mon Sep 17 00:00:00 2001 From: DeadGit Date: Mon, 21 Sep 2020 16:57:42 -0300 Subject: [PATCH] Hice un re quilombo de cosas. Por un lado, comenze el destete de coc.nvim, para tal fin volvi a incorporar fzf, lo cual no fue tan directo como dice la documentacion, mas sobre eso en el blog. Tambien segui modularizando la configuracion que ya estaba aprovechando los directorios que provee nvim. Retoque bastante el tema de funciones y autcmds. Modifique status y tab line ya que estaba, quedaron bastante cancheras ahora pero seguro le haga un par de cambios mas en el futuro. Agregue mappings nuevos para funciones que ya existen y los relevantes de los plugins y tambien algunas opciones de configuracion. Adopte un par nuevos para ver como me resultan: Fern y GitGutter. Reacomode todo el tema de colores y lo puse entre funciones y autocmds a ver si cargan bien despues de un nested source, todavia no lo probe. Por otro lado, retoque un par de scripts y adopte uno buenisimo para sesiones de tmux con soporte para fzf y toda la bola, tengo que ver si lo puedo tunear mas para elegir usarlo con dmenu o fzf segun como se lo invoque. Agregue un par de cambios minimos de teclas, tmux, y zsh. Ah y la configuracion de bat, porque no estaba, si bien son 3 lineas o algo asi. MUCHO laburo en el git config, porque estoy tratando de usarlo de una manera mas "pro", de a poco lo estoy integrando mas con nvim. El primer paso es probar estos commits larguisimos, y el resto lo iremos viendo. --- .config/bat/config | 5 ++ .config/git/config | 24 ++++-- .config/nvim/after/ftplugin/javascript.vim | 3 + .config/nvim/after/plugin/color.vim | 19 ----- .config/nvim/autoload/dead/colores.vim | 41 ++++++++++ .config/nvim/autoload/dead/functions.vim | 8 +- .config/nvim/autoload/dead/statusline.vim | 35 +++++++-- .config/nvim/autoload/dead/tabline.vim | 2 +- .config/nvim/coc-settings.json | 29 +------ .config/nvim/init.vim | 31 +++++--- .config/nvim/plugin/autocmds.vim | 30 ++++---- .config/nvim/plugin/gitgutter.vim | 6 ++ .config/nvim/plugin/mappings/fm.vim | 45 +++++++++++ .config/nvim/plugin/mappings/fzf.vim | 5 ++ .config/nvim/plugin/mappings/gitgutter.vim | 5 ++ .config/nvim/plugin/mappings/normal.vim | 19 ++++- .config/nvim/plugin/settings.vim | 26 +++---- .config/nvim/plugin/statusline.vim | 46 +++++------ .config/nvim/syntax/folding.vim | 38 ---------- .config/sxhkd/sxhkdrc | 6 +- .config/tmux/tmux.conf | 1 + .config/zsh/.zshrc | 1 + .config/zsh/aliases.zsh | 10 ++- .config/zsh/autocompletar.zsh | 88 +++++++++++----------- .local/bin/cfg | 1 + .local/bin/escribir | 16 ++-- .local/bin/stx | 2 +- .local/bin/termux | 46 ++++++++++- doc/xbpaketes | 3 +- 29 files changed, 352 insertions(+), 239 deletions(-) create mode 100644 .config/bat/config delete mode 100644 .config/nvim/after/plugin/color.vim create mode 100644 .config/nvim/autoload/dead/colores.vim create mode 100644 .config/nvim/plugin/gitgutter.vim create mode 100644 .config/nvim/plugin/mappings/fm.vim create mode 100644 .config/nvim/plugin/mappings/fzf.vim create mode 100644 .config/nvim/plugin/mappings/gitgutter.vim delete mode 100644 .config/nvim/syntax/folding.vim diff --git a/.config/bat/config b/.config/bat/config new file mode 100644 index 0000000..2c1b80e --- /dev/null +++ b/.config/bat/config @@ -0,0 +1,5 @@ +--theme="TwoDark" +--italic-text=always +--style="numbers,changes,header" +--color=always +--terminal-width=-10 diff --git a/.config/git/config b/.config/git/config index 7d4dfee..b09bc3a 100644 --- a/.config/git/config +++ b/.config/git/config @@ -1,5 +1,15 @@ [alias] st = status + fx = commit --fixup=HEAD + ci = commit -v + ri = rebase -i --autosquash + wc = whatchanged + amend = commit --amend -v + full = show --format=fuller + noed = commit --amend --no-edit + tr = log --graph --date-order --date=short --pretty=format:'%C(cyan)%h %C(blue)%ar%C(auto)%d%C(yellow)%s%+b %C(black)%ae' + fz = !sha=$( git -c color.ui=always log --oneline -n 1000 | fzf +s --no-multi --prompt 'Fixup> ' ) && git commit --fixup "${sha%% *}" + wd = "!f() { git --paginate diff --dirstat=cumulative,files,0 ${1:-HEAD} | awk '{print $2}' | cut -d / -f1-${2:-4} | sort | uniq; }; f" [hub] protocol = ssh @@ -11,9 +21,6 @@ name = DeadGit email = adeadgit@gmail.com -[include] - path = config.local - [sendemail] smtpserver = smtp.gmail.com smtpuser = adeadgit@gmail.com @@ -35,16 +42,16 @@ [delta] features = side-by-side line-numbers decorations - syntax-theme = Dracula + syntax-theme = zenburn plus-style = syntax "#003800" minus-style = syntax "#3f0001" whitespace-error-style = 22 reverse [delta "decorations"] - commit-decoration-style = bold yellow box ul - file-style = bold yellow ul + commit-decoration-style = yellow ul ol + file-style = yellow ul file-decoration-style = none - hunk-header-decoration-style = cyan box ul + hunk-header-decoration-style = cyan box [delta "line-numbers"] line-numbers-left-style = cyan @@ -124,3 +131,6 @@ [log] decorate = short + +[include] + path = config.local diff --git a/.config/nvim/after/ftplugin/javascript.vim b/.config/nvim/after/ftplugin/javascript.vim index 92d2e06..f7e3848 100644 --- a/.config/nvim/after/ftplugin/javascript.vim +++ b/.config/nvim/after/ftplugin/javascript.vim @@ -1,5 +1,8 @@ let b:ale_linters = ['prettier_standard'] let b:ale_fixers = ['prettier_standard'] +setlocal path=.,** +setlocal path-=/usr/include setlocal suffixesadd+=.js setlocal include=^\\s*[^\/]\\+\\(from\\\|require(['\"]\\) setlocal define=^\\s*function +set wildignore=*.min.*,*/.git/**/*,node_modules/* diff --git a/.config/nvim/after/plugin/color.vim b/.config/nvim/after/plugin/color.vim deleted file mode 100644 index 96696be..0000000 --- a/.config/nvim/after/plugin/color.vim +++ /dev/null @@ -1,19 +0,0 @@ -highlight! VertSplit ctermbg=NONE ctermfg=NONE cterm=NONE guibg=NONE guifg=#080808 gui=NONE -highlight! TabLineFill ctermbg=NONE ctermfg=NONE cterm=NONE guibg=NONE guifg=#ef2f27 gui=NONE -highlight! TablineSel ctermbg=NONE ctermfg=234 guibg=NONE guifg=#008bbd -highlight! CocWarningHighlight ctermfg=4 cterm=undercurl guifg=#c4ab39 gui=undercurl -highlight! CocErrorHighlight ctermfg=red cterm=undercurl guifg=#c4384b gui=undercurl -highlight! CocUnderline cterm=undercurl gui=undercurl -highlight! PmenuSel guibg=#111111 guifg=#6699cc -highlight! Folded ctermbg=NONE guibg=NONE -highlight! RedrawDebugClear guibg=#080808 -highlight! NvimInternalError guifg=#080808 -highlight! DiffAdded guifg=#333333 -highlight! PmenuThumb guifg=#333333 -highlight! link CocErrorSign WarningMsg -highlight! link CocWarningSign Number -highlight! link CocInfoSign Type - -if &diff - highlight! link DiffText MatchParen -endif diff --git a/.config/nvim/autoload/dead/colores.vim b/.config/nvim/autoload/dead/colores.vim new file mode 100644 index 0000000..4b7540d --- /dev/null +++ b/.config/nvim/autoload/dead/colores.vim @@ -0,0 +1,41 @@ +function! dead#colores#MyHighlights() abort + highlight Trail ctermbg=red guibg=red + call matchadd('Trail', '\s\+$', 100) + highlight ColorColumn ctermbg=magenta + call matchadd('ColorColumn', '\%81v', 100) +endfunction + +function! dead#colores#Maquillaje() abort + highlight! VertSplit ctermbg=NONE ctermfg=0 cterm=NONE guibg=NONE guifg=#080808 gui=NONE + highlight! TabLineFill ctermbg=NONE ctermfg=NONE cterm=NONE guibg=NONE guifg=#ef2f27 gui=NONE + highlight! TablineSel ctermbg=NONE ctermfg=234 guibg=NONE guifg=#008bbd + highlight! ALEWarningSignLineNr ctermfg=4 cterm=undercurl guifg=#c4ab39 gui=undercurl + highlight! ALEErrorSignLineNr ctermfg=red cterm=undercurl guifg=#c4384b gui=undercurl + highlight! CocUnderline cterm=undercurl gui=undercurl + highlight! PmenuSel guibg=#111111 guifg=#6699cc + highlight! RedrawDebugClear guibg=#080808 + highlight! NvimInternalError guifg=#080808 + highlight! DiffAdded guifg=#333333 + highlight! PmenuThumb guifg=#333333 + + highlight! link Folded Comment + highlight! link NonText VertSplit + + if &diff + highlight! link DiffText MatchParen + highlight! DiffAdd guibg=#0f111a guifg=#43a047 + highlight! DiffChange guibg=#0f111a guifg=#fdd835 + highlight! DiffRemoved guibg=#0f111a guifg=#e53935 + endif +endfunction + +function! dead#colores#Barra() abort + highlight User1 ctermfg=251 ctermbg=NONE guibg=NONE guifg=#666666 cterm=none + highlight User2 ctermfg=234 ctermbg=NONE guibg=NONE guifg=#f74782 cterm=none + highlight User3 ctermfg=234 ctermbg=4 guibg=NONE guifg=#008bb4 cterm=none + highlight User4 ctermfg=234 ctermbg=251 guibg=NONE guifg=#c6c6c6 cterm=none + highlight User5 ctermfg=234 ctermbg=4 guibg=NONE guifg=#e64eff cterm=none + highlight User6 ctermfg=234 ctermbg=9 guibg=NONE guifg=#fbad34 cterm=none + highlight User7 ctermfg=234 ctermbg=251 guibg=NONE guifg=#407e4a cterm=none + highlight User8 ctermfg=NONE ctermbg=NONE guibg=NONE guifg=NONE cterm=NONE +endfunction diff --git a/.config/nvim/autoload/dead/functions.vim b/.config/nvim/autoload/dead/functions.vim index 7e03e84..7e41971 100644 --- a/.config/nvim/autoload/dead/functions.vim +++ b/.config/nvim/autoload/dead/functions.vim @@ -1,10 +1,3 @@ -function! dead#functions#MyHighlights() abort - highlight Trail ctermbg=red guibg=red - call matchadd('Trail', '\s\+$', 100) - highlight ColorColumn ctermbg=magenta - call matchadd('ColorColumn', '\%81v', 100) -endfunction - function! dead#functions#PopOutOfInsertMode() abort if v:insertmode call feedkeys("\\") @@ -14,6 +7,7 @@ endfunction function! dead#functions#Relativize(v) abort if &number let &relativenumber = a:v + let &cursorline = a:v endif endfunction diff --git a/.config/nvim/autoload/dead/statusline.vim b/.config/nvim/autoload/dead/statusline.vim index b3bd3fc..e7c21b3 100644 --- a/.config/nvim/autoload/dead/statusline.vim +++ b/.config/nvim/autoload/dead/statusline.vim @@ -3,7 +3,7 @@ function! dead#statusline#ModeColor() abort endfunction function! dead#statusline#CurrentMode() abort - return ' ' . get(g:modes, mode(), '-')[1] . ' ' + return get(g:modes, mode(), '-')[1] endfunction function! dead#statusline#StatusLine() abort @@ -13,6 +13,9 @@ function! dead#statusline#StatusLine() abort let l:statusline.='%#User1#' let l:statusline.=dead#statusline#LinePasteMode() let l:statusline.='%= ' + let l:statusline.=dead#statusline#GitStatus() + let l:statusline.='%#User7#' + let l:statusline.=' %l:%c ' let l:statusline.=dead#statusline#ModeColor() let l:statusline.=dead#statusline#CurrentMode() return l:statusline @@ -34,6 +37,14 @@ function! dead#statusline#HelpStatusLine() abort return l:statusline endfunction +function! dead#statusline#FernStatusLine() abort + let l:statusline='' + let l:statusline.='%#User8#' + let l:statusline.='%= ' + let l:statusline.='% ' + return l:statusline +endfunction + function! dead#statusline#UpdateInactiveWindows() for winnum in range(1, winnr('$')) if winnum != winnr() @@ -42,6 +53,15 @@ function! dead#statusline#UpdateInactiveWindows() endfor endfunction +function! dead#statusline#LinePasteMode() abort + let paste_status = &paste + if paste_status == 1 + return ' paste ' + else + return '' + endif +endfunction + function! dead#statusline#RefreshStatusLine(mode) if (a:mode == "active" && &filetype !=? 'help') setlocal statusline=%!dead#statusline#StatusLine() @@ -51,6 +71,9 @@ function! dead#statusline#RefreshStatusLine(mode) if &filetype ==? 'help' setlocal statusline=%!dead#statusline#HelpStatusLine() endif + if &filetype ==? 'fern' + setlocal statusline=%!dead#statusline#FernStatusLine() + endif endfunction function! dead#statusline#LinterStatus() abort @@ -64,11 +87,7 @@ function! dead#statusline#LinterStatus() abort \) endfunction -function! dead#statusline#LinePasteMode() abort - let paste_status = &paste - if paste_status == 1 - return ' paste ' - else - return '' - endif +function! dead#statusline#GitStatus() + let [a,m,r] = GitGutterGetHunkSummary() + return printf('+%d ~%d -%d', a, m, r) endfunction diff --git a/.config/nvim/autoload/dead/tabline.vim b/.config/nvim/autoload/dead/tabline.vim index fdc7c48..2e84efa 100644 --- a/.config/nvim/autoload/dead/tabline.vim +++ b/.config/nvim/autoload/dead/tabline.vim @@ -12,7 +12,7 @@ function! dead#tabline#Tabline() abort let s .= '%' . tab . 'T' let s .= (tab == tabpagenr() ? '%#TabLineSel#' : '%#TabLine#') - let s .= ' ' . tab .':' + let s .= ' ' . tab .' ' let s .= (bufname !=? '' ? fnamemodify(bufname, ':f') . ' ' : '[Untitled] ') if bufmodified diff --git a/.config/nvim/coc-settings.json b/.config/nvim/coc-settings.json index 06fd5f7..4804569 100644 --- a/.config/nvim/coc-settings.json +++ b/.config/nvim/coc-settings.json @@ -1,35 +1,12 @@ { "coc.preferences.hoverTarget": "float", + "coc.preferences.useQuickfixForLocations": true, + "coc.preferences.bracketEnterImprove": false, "diagnostic.displayByAle": true, - "diagnostic.infoSign": "● ", - "diagnostic.errorSign": " ", - "diagnostic.warningSign": " ", - "diagnostic.messageTarget": "float", - "diagnostic.enableMessage": "always", - "explorer.width": 25, - "explorer.icon.enableNerdfont": true, - "explorer.icon.enableVimDevicons": false, - "explorer.previewAction.onHover": false, - "explorer.keyMappings": { - "v": "open:vsplit", - "s": "open:split", - "f": "addFile", - "D": "addDirectory", - "dd": "deleteForever", - "b": "search" - }, - "explorer.quitOnOpen": true, - "explorer.datetime.format": "yyyy-MM-dd HH:mm", - "list.source.files.command": "fd", - "list.source.files.args": ["-t", "f", "-S", "-2m", "-F", "-H"], - "list.source.grep.args": ["--vimgrep", "--hiden", "--no-heading"], - "list.source.mru.ignoreGitIgnore": true, - "list.previewSplitRight": true, - "list.indicator": ">", - "list.selectedSignText": " ", "suggest.echodocSupport": true, "suggest.maxPreviewWidth": 100, "suggest.noselect": false, + "suggest.removeDuplicateItems": true, "session.saveOnVimLeave": false, "snippets.extends": { "javascriptreact": ["javascript"], diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index 25456ef..5e016a0 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -1,4 +1,4 @@ -" Important {{{ +" Externals {{{ let g:loaded_python_provider=1 " Disable python 2 interface let g:python_host_skip_check=1 " Skip python 2 host check if filereadable('bin/python3') @@ -6,6 +6,10 @@ if filereadable('bin/python3') endif let g:node_host_prog = '~/.local/share/npm/bin/neovim-node-host' let $GIT_EDITOR = 'nvr -cc split --remote-wait' +if executable("rg") + set grepprg=rg\ --vimgrep +endif +set runtimepath+=/usr/share/vim/vimfiles/ let mapleader="\" let maplocalleader=',' " }}} @@ -17,6 +21,8 @@ let g:ale_linters_explicit = 1 let g:ale_use_global_executables = 1 let g:ale_close_preview_on_insert = 1 let g:ale_sign_highlight_linenrs = 1 +let g:ale_echo_cursor = 0 +let g:ale_virtualtext_cursor = 1 let g:ale_set_highlights = 1 let g:ale_set_signs = 1 let g:ale_javascript_eslint_suppress_missing_config = 1 @@ -34,18 +40,10 @@ nmap (ale_previous_wrap) nmap (ale_next_wrap) " }}} " CoC {{{ -let g:coc_global_extensions = ['coc-lists', 'coc-highlight', 'coc-explorer', 'coc-snippets', 'coc-tsserver', 'coc-css', 'coc-html', 'coc-json', 'coc-emmet'] +let g:coc_global_extensions = ['coc-highlight', 'coc-snippets', 'coc-tsserver', 'coc-css', 'coc-html', 'coc-json', 'coc-emmet'] -" Lists -nnoremap :CocList -S --ignore-case helptags -nnoremap :CocList -S --ignore-case files -nnoremap :CocList --normal buffers -nnoremap :CocList windows -nnoremap :CocList snippets -" Explorer -nnoremap :CocCommand explorer " Config -nnoremap :CocConfig +nnoremap :vsplit:CocConfig inoremap \ pumvisible() ? coc#_select_confirm() : @@ -58,7 +56,8 @@ function! s:check_back_space() abort return !col || getline('.')[col - 1] =~# '\s' endfunction -let g:coc_snippet_next = '' +let g:coc_snippet_next = '' +let g:coc_snippet_prev = '' " to confirm completion inoremap pumvisible() ? "\" : "\" @@ -92,10 +91,18 @@ let g:javascript_plugin_jsdoc = 1 packadd! pear-tree packadd! loupe packadd! vim-commentary +packadd! fzf.vim +packadd! fern.vim packadd! gina.vim " }}} " Colors {{{ set termguicolors +aug colores + au! + au ColorScheme * call dead#colores#Barra() + au ColorScheme * call dead#colores#Maquillaje() + au ColorScheme * call dead#colores#MyHighlights() +aug END let g:srcery_transparent_background = 1 let g:srcery_italic = 1 let g:srcery_underline = 1 diff --git a/.config/nvim/plugin/autocmds.vim b/.config/nvim/plugin/autocmds.vim index 3378c17..80b174f 100644 --- a/.config/nvim/plugin/autocmds.vim +++ b/.config/nvim/plugin/autocmds.vim @@ -3,37 +3,30 @@ scriptencoding utf-8 if !exists('autocommands_loaded') && has('autocmd') let autocommands_loaded = 1 - aug relativize - au BufWinEnter,FocusGained,InsertLeave,WinEnter * call dead#functions#Relativize(1) - au BufWinLeave,FocusLost,InsertEnter,WinLeave * call dead#functions#Relativize(0) - aug END - aug miscs au CursorHold * silent call CocActionAsync('highlight') au User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') - au ColorScheme * call dead#functions#MyHighlights() aug END aug inserts - au InsertEnter * setlocal nocursorline - au InsertLeave * setlocal cursorline nopaste + au BufWinEnter,FocusGained,InsertLeave,WinEnter * call dead#functions#Relativize(1) + au BufWinLeave,FocusLost,InsertEnter,WinLeave * call dead#functions#Relativize(0) + au InsertLeave * setlocal nopaste au InsertLeave,CompleteDone * if pumvisible() == 0 | pclose | endif - au FocusLost,TabLeave * call dead#functions#PopOutOfInsertMode() - au WinLeave * setlocal nocursorline aug END aug file_types - au BufNewFile ~/doc/blog/*.wiki 0r ~/.config/nvim/templates/wiki.skeleton - au FileType typescript,json setlocal formatexpr=CocAction('formatSelected') + au BufNewFile ~/doc/blog/*.md 0r ~/.config/nvim/templates/wiki.skeleton au FileType gitcommit,gitrebase,gitconfig set bufhidden=delete au BufNewFile,BufRead requirements*.txt set syntax=python + au FileType fzf tnoremap aug END - aug statusline + aug status_line au VimEnter * call dead#statusline#UpdateInactiveWindows() au VimEnter,WinEnter,BufWinEnter * call dead#statusline#RefreshStatusLine('active') au WinLeave * call dead#statusline#RefreshStatusLine('inactive') - augroup END + aug END aug on_save au BufWritePre * :%s/\s\+$//e @@ -42,4 +35,13 @@ if !exists('autocommands_loaded') && has('autocmd') au BufWritePost *.tex !pdflatex % au QuitPre * if empty(&buftype) | lclose | endif aug END + + aug MyTerminal + au TermOpen * setlocal wrap nonumber norelativenumber noruler signcolumn=no + au TermOpen * set laststatus=0 showtabline=0 + " workaround for a segfault: https://github.com/neovim/neovim/issues/11548#issuecomment-583081783 + " immediately enter insert mode when switching to a terminal + au BufEnter term://* startinsert! + au TermClose * set laststatus=2 showtabline=2 + aug END endif diff --git a/.config/nvim/plugin/gitgutter.vim b/.config/nvim/plugin/gitgutter.vim new file mode 100644 index 0000000..8039a86 --- /dev/null +++ b/.config/nvim/plugin/gitgutter.vim @@ -0,0 +1,6 @@ +let g:gitgutter_highlight_lines = 1 +let g:gitgutter_highlight_linenrs = 1 +let g:gitgutter_set_sign_backgrounds = 1 +let g:gitgutter_sign_allow_clobber = 0 +let g:gitgutter_map_keys = 0 +let g:gitgutter_grep = 'rg --color=never' diff --git a/.config/nvim/plugin/mappings/fm.vim b/.config/nvim/plugin/mappings/fm.vim new file mode 100644 index 0000000..fb6f32d --- /dev/null +++ b/.config/nvim/plugin/mappings/fm.vim @@ -0,0 +1,45 @@ +nnoremap :Fern . -reveal=% -drawer -toggle -width=20 + +function! s:init_fern() abort + setlocal nonumber norelativenumber + + nmap + \ (fern-my-expand-or-collapse) + \ fern#smart#leaf( + \ "\(fern-action-collapse)", + \ "\(fern-action-expand)", + \ "\(fern-action-collapse)", + \ ) + + nmap + \ (fern-my-open-expand-collapse) + \ fern#smart#leaf( + \ "\(fern-action-open:select)", + \ "\(fern-action-expand)", + \ "\(fern-action-collapse)", + \ ) + + nmap H (fern-action-open:split) + nmap V (fern-action-open:vsplit) + nmap t (fern-action-open:tabedit) + nmap r (fern-action-rename) + nmap R (fern-action-reload) + nmap N (fern-action-new-file) + nmap K (fern-action-new-dir) + nmap c (fern-action-copy) + nmap m (fern-action-move) + nmap h (fern-action-hidden:toggle) + nmap C (fern-action-clipboard-copy) + nmap M (fern-action-clipboard-move) + nmap P (fern-action-clipboard-paste) + nmap D (fern-action-remove) + nmap (fern-action-leave) + nmap (fern-action-mark-toggle) + nmap (fern-my-open-expand-collapse) + nmap o (fern-my-expand-or-collapse) +endfunction + +augroup fern-custom + autocmd! * + autocmd FileType fern call s:init_fern() +augroup END diff --git a/.config/nvim/plugin/mappings/fzf.vim b/.config/nvim/plugin/mappings/fzf.vim new file mode 100644 index 0000000..9b072a3 --- /dev/null +++ b/.config/nvim/plugin/mappings/fzf.vim @@ -0,0 +1,5 @@ +nnoremap :Helptags +nnoremap :Files =expand("%:h")/ +nnoremap :Files +nnoremap :Buffers +nnoremap :Rg diff --git a/.config/nvim/plugin/mappings/gitgutter.vim b/.config/nvim/plugin/mappings/gitgutter.vim new file mode 100644 index 0000000..d89bccf --- /dev/null +++ b/.config/nvim/plugin/mappings/gitgutter.vim @@ -0,0 +1,5 @@ +nmap ghp (GitGutterPreviewHunk) +nmap ghu (GitGutterUndoHunk) +nmap ghs (GitGutterStageHunk) +nmap {c (GitGutterPrevHunk) +nmap }c (GitGutterNextHunk) diff --git a/.config/nvim/plugin/mappings/normal.vim b/.config/nvim/plugin/mappings/normal.vim index 1eb6827..cdccbb4 100644 --- a/.config/nvim/plugin/mappings/normal.vim +++ b/.config/nvim/plugin/mappings/normal.vim @@ -1,6 +1,19 @@ " Ñ master race nnoremap ñ ; nnoremap Ñ , +nnoremap {q :cprev +nnoremap }q :cnext +nnoremap {Q :cfirst +nnoremap }Q :clast +nnoremap {o :call append(line('.'), '') +nnoremap }o :call append(line('.')-1, '') + +" Find +nnoremap F :find =expand('%:h').'/*' +nnoremap S :sfind =expand('%:h').'/*' +nnoremap V :vert sfind =expand('%:h').'/*' +nnoremap T :tabfind =expand('%:h').'/*' +nnoremap G :g/ " Rearrange Splits nnoremap H @@ -20,14 +33,12 @@ nnoremap nnoremap nnoremap -" Gotta Go Fast (save, buffer close, quit, messages, newlines, SOF, EOF) +" Gotta Go Fast (save, buffers, quit, messages, newlines, SOF, EOF) nnoremap g :w! -nnoremap b :bdelete +nnoremap b :noautocmd :ls:b nnoremap q :q! nnoremap Q :qa! nnoremap m :messages -nnoremap o :call append(line('.'), '') -nnoremap O :call append(line('.')-1, '') nnoremap gg nnoremap ¿ G diff --git a/.config/nvim/plugin/settings.vim b/.config/nvim/plugin/settings.vim index 6c91202..c762091 100644 --- a/.config/nvim/plugin/settings.vim +++ b/.config/nvim/plugin/settings.vim @@ -12,10 +12,9 @@ set hidden set lazyredraw set showmatch set matchpairs+=<:> -set matchtime=1 set cpoptions-=m set nojoinspaces -set updatetime=300 +set updatetime=100 set synmaxcol=200 set splitbelow set splitright @@ -23,8 +22,7 @@ set notimeout set ignorecase set scrolloff=5 set sidescroll=5 -set shortmess+=aoOIWcs -set foldnestmax=10 +set shortmess+=aoOWsc set foldmethod=marker set foldclose=all set foldlevelstart=10 @@ -44,22 +42,20 @@ set redrawtime=500 set ttimeoutlen=10 set nowritebackup set completeopt-=preview -set nostartofline set undofile set undolevels=1000 set undoreload=10000 -set formatoptions+=nl -set formatoptions-=crot -set fillchars+=vert:\ set listchars+=precedes:<,extends:> -set conceallevel=1 set diffopt+=algorithm:histogram,indent-heuristic set diffopt+=foldcolumn:0 -match ErrorMsg '^\(<\|=\|>\)\{7\}\([^=].\+\)\?$' +set fillchars=eob:\ ,stlnc:\ ,stl:\ ,vert:\│ let formatlistpat='^\s*\(\d\+[\]:.)}\t ]\|[*-][\t ]\)\s*' let g:netrw_dirhistmax=0 - -if exists('$SUDO_USER') - set nobackup - set noundofile -endif +match ErrorMsg '^\(<\|=\|>\)\{7\}\([^=].\+\)\?$' +set formatoptions& + \ formatoptions+=n + \ formatoptions+=l + \ formatoptions-=c + \ formatoptions-=r + \ formatoptions-=o + \ formatoptions-=t diff --git a/.config/nvim/plugin/statusline.vim b/.config/nvim/plugin/statusline.vim index 8028f78..bd7bbde 100644 --- a/.config/nvim/plugin/statusline.vim +++ b/.config/nvim/plugin/statusline.vim @@ -1,31 +1,23 @@ scriptencoding utf-8 -highlight User1 ctermfg=251 ctermbg=NONE guibg=NONE guifg=#666666 cterm=none -highlight User2 ctermfg=234 ctermbg=NONE guibg=NONE guifg=#f74782 cterm=none -highlight User3 ctermfg=234 ctermbg=4 guibg=NONE guifg=#008bb4 cterm=none -highlight User4 ctermfg=234 ctermbg=251 guibg=NONE guifg=#c6c6c6 cterm=none -highlight User5 ctermfg=234 ctermbg=4 guibg=NONE guifg=#e64eff cterm=none -highlight User6 ctermfg=234 ctermbg=9 guibg=NONE guifg=#fbad34 cterm=none -highlight User7 ctermfg=234 ctermbg=251 guibg=NONE guifg=#407e4a cterm=none - let g:modes={ - \ 'n' : ['%3*', 'NORMAL'], - \ 'no' : ['%3*', 'N·OPERATOR PENDING'], - \ 'v' : ['%5*', 'VISUAL'], - \ 'V' : ['%5*', 'V·LINE'], - \ '' : ['%5*', 'V·BLOCK'], - \ 's' : ['%7*', 'SELECT'], - \ 'S' : ['%7*', 'S·LINE'], - \ '' : ['%7*', 'S·BLOCK'], - \ 'i' : ['%4*', 'INSERT'], - \ 'R' : ['%2*', 'REPLACE'], - \ 'Rv' : ['%2*', 'V·REPLACE'], - \ 'c' : ['%6*', 'COMMAND'], - \ 'cv' : ['%6*', 'VIM EX'], - \ 'ce' : ['%6*', 'EX'], - \ 'r' : ['%1*', 'PROMPT'], - \ 'rm' : ['%1*', 'MORE'], - \ 'r?' : ['%1*', 'CONFIRM'], - \ '!' : ['%*1', 'SHELL'], - \ 't' : ['%*1', 'TERMINAL'] + \ 'n' : ['%3*','NORMAL'], + \ 'no' : ['%3*','N·OPERATOR PENDING'], + \ 'v' : ['%5*','VISUAL'], + \ 'V' : ['%5*','V·LINE'], + \ '' : ['%5*','V·BLOCK'], + \ 's' : ['%7*','SELECT'], + \ 'S' : ['%7*','S·LINE'], + \ '' : ['%7*','S·BLOCK'], + \ 'i' : ['%4*','INSERT'], + \ 'R' : ['%2*','REPLACE'], + \ 'Rv' : ['%2*','V·REPLACE'], + \ 'c' : ['%6*','COMMAND'], + \ 'cv' : ['%6*','VIM EX'], + \ 'ce' : ['%6*','EX'], + \ 'r' : ['%1*','PROMPT'], + \ 'rm' : ['%1*','MORE'], + \ 'r?' : ['%1*','CONFIRM'], + \ '!' : ['%*1','SHELL'], + \ 't' : ['%*1','TERMINAL'] \} diff --git a/.config/nvim/syntax/folding.vim b/.config/nvim/syntax/folding.vim deleted file mode 100644 index 7dcaee2..0000000 --- a/.config/nvim/syntax/folding.vim +++ /dev/null @@ -1,38 +0,0 @@ -setlocal foldmethod=expr -setlocal foldexpr=GetGdscriptFold(v:ln) - -function! IndentLevel(ln) - return indent(a:ln) / &shiftwidth -endfunction - -function! NextLine(ln) - let numLines = line('$') - let current = a:ln + 1 - - while current <= numLines - if getline(current) =~? '\v\S' - return current - endif - - let current += 1 - endwhile - - return -2 -endfunction - -function! GetGdscriptFold(ln) - if getline(a:ln) =~? '\v\s*$' - return '-1' - endif - - let ci = IndentLevel(a:ln) - let ni = IndentLevel(NextLine(a:ln)) - - if ni == ci - return ci - elseif ni < ci - return ci - elseif ni > ci - return '>' . ni - endif -endfunction diff --git a/.config/sxhkd/sxhkdrc b/.config/sxhkd/sxhkdrc index 155b840..bdb75c5 100644 --- a/.config/sxhkd/sxhkdrc +++ b/.config/sxhkd/sxhkdrc @@ -49,13 +49,13 @@ super + ctrl + m espejo super + {a,x,v,z} - alacritty {_,--class=flota,--class=flota -e pulsemixer,--class=multi -e termux} + $TERMINAL {_,--class=flota,--class=flota -e pulsemixer,--class=multi -e termux} super + space j4-dmenu-desktop --dmenu="dmenu -i -w 250 -p ' ' " --no-generic -super + {F1,F2,F3,F4} - {fecha,tapa,notifocus,touchpad} +super + {F1,F2,F3} + {fecha,tapa,notifocus} ctrl + alt + x xkill diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf index e535e77..730f89d 100644 --- a/.config/tmux/tmux.conf +++ b/.config/tmux/tmux.conf @@ -13,6 +13,7 @@ set -g mouse on set -gq utf8 on set -gq status-utf8 on set -wg wrap-search off +set -g focus-events on # Ventanas set -wg automatic-rename on diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index fac9616..b6ab3ed 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -5,6 +5,7 @@ autoload -Uz bracketed-paste-url-magic zle -N bracketed-paste bracketed-paste-url-magic setopt RM_STAR_WAIT +setopt PRINT_EIGHT_BIT # Print character as eight bit to prevent mojibake setopt COMBINING_CHARS # Combine accents with the base character. setopt INTERACTIVE_COMMENTS # Enable comments in interactive shell. setopt RC_QUOTES # Allow 'Henry''s Garage' instead of 'Henry'\''s Garage'. diff --git a/.config/zsh/aliases.zsh b/.config/zsh/aliases.zsh index 80cf543..8437c55 100644 --- a/.config/zsh/aliases.zsh +++ b/.config/zsh/aliases.zsh @@ -24,10 +24,15 @@ alias \ xp='xpkg -m > ~/doc/xbpaketes' # Tmux +if [[ -n $TMUX ]]; then + alias txa='tmux switch-client -t' +else + alias txa='tmux attach-session -t' +fi alias \ - txa='tmux attach -t' \ txn='tmux new-session -s' \ txk='tmux kill-session -t' \ + txz='tmux kill-server' # LaTeX alias \ @@ -44,7 +49,8 @@ alias \ # Dotfiles alias \ hxa='hx add -v' \ - hxu='hx add -vu && hx commit -m' \ + hxu='hx add -vu' \ + hxc='hx commit' \ hxp='hx push' \ hxs='hx status' \ hxl='hx log --stat' \ diff --git a/.config/zsh/autocompletar.zsh b/.config/zsh/autocompletar.zsh index 83bbb9d..ac0b858 100644 --- a/.config/zsh/autocompletar.zsh +++ b/.config/zsh/autocompletar.zsh @@ -8,6 +8,8 @@ setopt AUTO_MENU # Show completion menu on a successive tab press. setopt AUTO_LIST # Automatically list choices on ambiguous completion. setopt EXTENDED_GLOB # Needed for file modification glob modifiers with compinit setopt NO_NOMATCH # [default] unmatched patterns are left unchanged +setopt GLOB_COMPLETE # Complete without expanding glob +setopt NOAUTOREMOVESLASH # Do not remove postfix slash of command line unsetopt MENU_COMPLETE # Do not autoselect the first completion entry. unsetopt FLOW_CONTROL # Disable start/stop characters in shell editor. @@ -20,49 +22,49 @@ else fi unset _comp_files -zstyle ':completion:*' matcher-list '' '+m:{[:lower:]}={[:upper:]}' '+m:{[:upper:]}={[:lower:]}' '+m:{_-}={-_}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' -zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS} -zstyle -e ':completion:*' special-dirs '[[ $PREFIX = (../)#(..) ]] && reply=(..)' +zstyle ':completion:*' matcher-list '' '+m:{[:lower:]}={[:upper:]}' '+m:{[:upper:]}={[:lower:]}' '+m:{_-}={-_}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' +zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS} +zstyle -e ':completion:*' special-dirs '[[ $PREFIX = (../)#(..) ]] && reply=(..)' zstyle ':completion:*:complete:(cd|pushd):*' tag-order 'local-directories named-directories' -zstyle ':completion:*' group-name '' -zstyle ':completion:*:descriptions' format '%F{yellow}%d %f' -zstyle ':completion:*' menu select -zstyle ':completion::complete:*' use-cache on -zstyle ':completion::complete:*' cache-path "$XDG_CACHE_HOME/zcompcache" -zstyle ':completion:*:matches' group 'yes' -zstyle ':completion:*:options' description 'yes' -zstyle ':completion:*:options' auto-description '%d' -zstyle ':completion:*:default' list-prompt '%S%M matches%s' -zstyle ':completion:*' verbose yes -zstyle ':completion:*' completer _complete _match _approximate -zstyle ':completion:*:match:*' original only -zstyle ':completion:*:approximate:*' max-errors 1 numeric -zstyle -e ':completion:*:approximate:*' max-errors 'reply=($((($#PREFIX+$#SUFFIX)/3>7?7:($#PREFIX+$#SUFFIX)/3))numeric)' -zstyle ':completion:*:functions' ignored-patterns '(_*|pre(cmd|exec))' -zstyle ':completion:*:*:-subscript-:*' tag-order indexes parameters +zstyle ':completion:*' group-name '' +zstyle ':completion:*:descriptions' format '%F{yellow}%d %f' +zstyle ':completion:*' menu select +zstyle ':completion::complete:*' use-cache on +zstyle ':completion::complete:*' cache-path "$XDG_CACHE_HOME/zcompcache" +zstyle ':completion:*:matches' group 'yes' +zstyle ':completion:*:options' description 'yes' +zstyle ':completion:*:options' auto-description '%d' +zstyle ':completion:*:default' list-prompt '%S%M matches%s' +zstyle ':completion:*' verbose yes +zstyle ':completion:*' completer _complete _match _approximate +zstyle ':completion:*:match:*' original only +zstyle ':completion:*:approximate:*' max-errors 1 numeric +zstyle -e ':completion:*:approximate:*' max-errors 'reply=($((($#PREFIX+$#SUFFIX)/3>7?7:($#PREFIX+$#SUFFIX)/3))numeric)' +zstyle ':completion:*:functions' ignored-patterns '(_*|pre(cmd|exec))' +zstyle ':completion:*:*:-subscript-:*' tag-order indexes parameters zstyle ':completion:*:*:cd:*:directory-stack' menu yes select -zstyle ':completion:*:-tilde-:*' group-order 'named-directories' 'path-directories' 'users' 'expand' -zstyle ':completion:*:history-words' stop yes -zstyle ':completion:*:history-words' remove-all-dups yes -zstyle ':completion:*:history-words' list false -zstyle ':completion:*:history-words' menu yes +zstyle ':completion:*:-tilde-:*' group-order 'named-directories' 'path-directories' 'users' 'expand' +zstyle ':completion:*:history-words' stop yes +zstyle ':completion:*:history-words' remove-all-dups yes +zstyle ':completion:*:history-words' list false +zstyle ':completion:*:history-words' menu yes zstyle ':completion::*:(-command-|export):*' fake-parameters ${${${_comps[(I)-value-*]#*,}%%,*}:#-*-} -zstyle ':completion:*:(rm|kill|diff):*' ignore-line other -zstyle ':completion:*:rm:*' file-patterns '*:all-files' -zstyle ':completion:*:*:*:*:processes' command 'ps -u $LOGNAME -o pid,user,command -w' -zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;36=0=01' -zstyle ':completion:*:*:kill:*' menu yes select -zstyle ':completion:*:*:kill:*' force-list always -zstyle ':completion:*:*:kill:*' insert-ids single -zstyle ':completion:*:man:*' menu yes select -zstyle ':completion:*:manuals' separate-sections true -zstyle ':completion:*:manuals.(^1*)' insert-sections true -zstyle ':completion:*:parameters' list-colors '=*=34' -zstyle ':completion:*:commands' list-colors '=*=32' -zstyle ':completion:*:builtins' list-colors '=*=1;38;5;142' -zstyle ':completion:*:aliases' list-colors '=*=2;38;5;120' -zstyle ':completion:*:options' list-colors '=^(-- *)=34' -zstyle ':completion:*:default' list-colors '=(#b)*(-- *)=36=33' '=*=36' -zstyle ':completion:*' rehash true -zstyle ':completion:*' list-separator " " -zstyle ':completion:*' list-dirs-first true +zstyle ':completion:*:(rm|kill|diff):*' ignore-line other +zstyle ':completion:*:rm:*' file-patterns '*:all-files' +zstyle ':completion:*:*:*:*:processes' command 'ps -u $LOGNAME -o pid,user,command -w' +zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;36=0=01' +zstyle ':completion:*:*:kill:*' menu yes select +zstyle ':completion:*:*:kill:*' force-list always +zstyle ':completion:*:*:kill:*' insert-ids single +zstyle ':completion:*:man:*' menu yes select +zstyle ':completion:*:manuals' separate-sections true +zstyle ':completion:*:manuals.(^1*)' insert-sections true +zstyle ':completion:*:parameters' list-colors '=*=34' +zstyle ':completion:*:commands' list-colors '=*=32' +zstyle ':completion:*:builtins' list-colors '=*=1;38;5;142' +zstyle ':completion:*:aliases' list-colors '=*=2;38;5;120' +zstyle ':completion:*:options' list-colors '=^(-- *)=34' +zstyle ':completion:*:default' list-colors '=(#b)*(-- *)=36=33' '=*=36' +zstyle ':completion:*' rehash true +zstyle ':completion:*' list-separator " " +zstyle ':completion:*' list-dirs-first true diff --git a/.local/bin/cfg b/.local/bin/cfg index b4c0f02..5979c8c 100755 --- a/.local/bin/cfg +++ b/.local/bin/cfg @@ -4,6 +4,7 @@ function () { # Bookmarks local -A bookmarks=( 'nvim' '~/.config/nvim/init.vim' + 'git' '$XDG_CONFIG_HOME/git/config' 'gtk2' '~/.config/gtk-2.0/gtkrc-2.0' 'gtk3' '~/.config/gtk-3.0/settings.ini' 'lf' '~/.config/lf/lfrc' diff --git a/.local/bin/escribir b/.local/bin/escribir index 567f749..92b5ad6 100755 --- a/.local/bin/escribir +++ b/.local/bin/escribir @@ -1,12 +1,16 @@ #!/bin/sh +prog() { + $TERMINAL --class=flota -e nvim "$@" +} + diario() { cd "$HOME/doc/blog" || exit menuBlog=$(printf "Hoy\\nMañana\\nAyer\\nArchivo" | dmenu -i -w 120 -p " ") case $menuBlog in - "Hoy") alacritty --class=flota -e nvim "$(date -I)".md ;; - "Mañana") alacritty --class=flota -e nvim "$(date --date='tomorrow' +%F)".md ;; - "Ayer") alacritty --class=flota -e nvim "$(date --date='yesterday' +%F)".md ;; + "Hoy") prog "$(date -I)".md ;; + "Mañana") prog "$(date --date='tomorrow' +%F)".md ;; + "Ayer") prog "$(date --date='yesterday' +%F)".md ;; "Archivo") archivo ;; esac } @@ -17,7 +21,7 @@ notas() { case $menuNota in "Nueva") nombre="$(dmenu -i -p "Titulo: ")" 2>/dev/null - alacritty --class=flota -e nvim "$nombre".md + prog "$nombre".md ;; "Archivo") archivo ;; esac @@ -30,13 +34,13 @@ articulo() { nombreForm="$(echo "$nombre" | tr ' ' '-')" hugo new articulos/"$nombreForm".md sleep 1 - alacritty --class=flota -e nvim content/articulos/"$nombre".md + prog content/articulos/"$nombre".md } archivo() { selarch=$(fd -d 1 -e md | sort -Mr | dmenu -i -w 200 -p " ") [ -z "$selarch" ] && exit 0 - alacritty --class=flota -e nvim "$selarch" + prog "$selarch" } MENU="$(printf "Artículo\\nPersonal\\nNotas" | dmenu -i -w 130 -p " ")" diff --git a/.local/bin/stx b/.local/bin/stx index 15b4ba6..d5922fb 100755 --- a/.local/bin/stx +++ b/.local/bin/stx @@ -1,3 +1,3 @@ #!/bin/sh -alacritty --class=multi -e termux +$TERMINAL --class=multi -e tmux new -A -s "Z" diff --git a/.local/bin/termux b/.local/bin/termux index ca71369..21c820b 100755 --- a/.local/bin/termux +++ b/.local/bin/termux @@ -1,6 +1,44 @@ -#!/bin/sh +#!/bin/zsh -if command -v tmux >/dev/null 2>&1; then - test -z "$TMUX" && (tmux new -A -s "Z" ) -fi +tmux_new_session() { + if [[ -n $TMUX ]]; then + tmux switch-client -t "$(TMUX= tmux -S "${TMUX%,*,*}" new-session -dP "$@")" + else + echo -n "Nombre de Sesión: " + read REPLY + if [[ -n $REPLY ]]; then + tmux new-session -s "$REPLY" + else + tmux new-session + fi + fi +} +tmux_sessions() { + # Select existing session or create session with fuzzy search tool + # get the IDs + if ! ID="$(tmux list-sessions 2>/dev/null)"; then + # tmux returned error, so try cleaning up /tmp + rm -rf /tmp/tmux* + fi + create_new_session="Crear Sesión" + if [[ -n "$ID" ]]; then + ID="${create_new_session}:\n$ID" + else + ID="${create_new_session}:" + fi + ID="$(echo $ID | fzf | cut -d: -f1)" + if [[ "$ID" == "${create_new_session}" ]]; then + tmux_new_session + elif [[ -n "$ID" ]]; then + if [[ -n $TMUX ]]; then + tmux switch-client -t "$ID" + else + tmux attach-session -t "$ID" + fi + else + : # Start terminal normally + fi +} + +tmux_sessions diff --git a/doc/xbpaketes b/doc/xbpaketes index a55445e..49e55be 100644 --- a/doc/xbpaketes +++ b/doc/xbpaketes @@ -91,7 +91,6 @@ neovim neovim-remote newsboat nfs-utils -nmap nodejs notmuch noto-fonts-cjk @@ -112,7 +111,7 @@ pulseaudio pulsemixer python3 python3-pip -python3-vint +ripgrep setxkbmap shellcheck shfmt