1
0
mirror of https://git.decapod.one/brethil/dotfiles synced 2024-11-10 14:01:30 +01:00

Compare commits

...

4 Commits

Author SHA1 Message Date
bretello
a8c89d32c9
zsh: functions: add mangrep 2023-01-23 20:21:57 +01:00
bretello
3b6cf2b92f
vim: tagbar: workaround for mouse-click issue
the world ends at column 223.

https://stackoverflow.com/questions/7000960/in-vim-why-doesnt-my-mouse-work-past-the-220th-column

Note that (at least on alacritty) the ttymouse=sgr workaround does not
work:

```vim
if has('mouse_sgr') " fixes unclickable panes after a specific column (~220?)
    set ttymouse=sgr
else
    set ttymouse=xterm2
end
```
2023-01-20 14:31:08 +01:00
bretello
8e3c36d200
vim: tagbar/airline: properly show tag in lower right corner 2023-01-20 14:30:16 +01:00
bretello
2066baee05
vim: linting cleanup 2023-01-19 17:33:44 +01:00
5 changed files with 70 additions and 52 deletions

View File

@ -266,3 +266,21 @@ make_backup() {
function find_by_mtime() { function find_by_mtime() {
find $@ -printf "%T+ %p\n" | sort find $@ -printf "%T+ %p\n" | sort
} }
function mangrep() {
set -x
if [[ -z "$@" ]]; then
echo "Usage: $0 <pattern> <command>"
echo "Opens man page for <command> at the first match for <pattern>"
return
fi
pattern=$1
cmd=$2
if [[ -z "$cmd" ]]; then
man "$cmd"
return
fi
MANPAGER="less -p \"$pattern\"" man "$cmd"
}

View File

@ -10,8 +10,8 @@ function! WinZoomToggle() abort
wincmd | wincmd |
let w:WinZoomIsZoomed = 1 let w:WinZoomIsZoomed = 1
elseif w:WinZoomIsZoomed == 1 elseif w:WinZoomIsZoomed == 1
execute "resize " . w:WinZoomOldHeight execute 'resize ' . w:WinZoomOldHeight
execute "vertical resize " . w:WinZoomOldWidth execute 'vertical resize ' . w:WinZoomOldWidth
let w:WinZoomIsZoomed = 0 let w:WinZoomIsZoomed = 0
endif endif
endfunction endfunction
@ -42,8 +42,8 @@ endfunction
" Don't close window, when deleting a buffer " Don't close window, when deleting a buffer
command! Bclose call <SID>BufcloseCloseIt() command! Bclose call <SID>BufcloseCloseIt()
function! <SID>BufcloseCloseIt() function! <SID>BufcloseCloseIt()
let l:currentBufNum = bufnr("%") let l:currentBufNum = bufnr('%')
let l:alternateBufNum = bufnr("#") let l:alternateBufNum = bufnr('#')
if buflisted(l:alternateBufNum) if buflisted(l:alternateBufNum)
buffer # buffer #
@ -51,35 +51,35 @@ function! <SID>BufcloseCloseIt()
bnext bnext
endif endif
if bufnr("%") == l:currentBufNum if bufnr('%') == l:currentBufNum
new new
endif endif
if buflisted(l:currentBufNum) if buflisted(l:currentBufNum)
execute("bdelete! ".l:currentBufNum) execute('bdelete! '.l:currentBufNum)
endif endif
endfunction endfunction
function! CmdLine(str) function! CmdLine(str)
call feedkeys(":" . a:str) call feedkeys(':' . a:str)
endfunction endfunction
" Call Git show on the selected text (must be a git ref) " Call Git show on the selected text (must be a git ref)
function! GitShowVisual() range function! GitShowVisual() range
execute "Git show " . @* execute 'Git show ' . @*
endfunction endfunction
function! VisualSelection(direction, extra_filter) range function! VisualSelection(direction, extra_filter) range
let l:saved_reg = @" let l:saved_reg = @"
execute "normal! vgvy" execute 'normal! vgvy'
let l:pattern = escape(@", "\\/.*'$^~[]") let l:pattern = escape(@', "\\/.*'$^~[]")
let l:pattern = substitute(l:pattern, "\n$", "", "") let l:pattern = substitute(l:pattern, '\n$', '', '')
if a:direction == 'ack' if a:direction ==# 'ack'
call CmdLine("Ack '" . l:pattern . "' ") call CmdLine("Ack '" . l:pattern . "' ")
elseif a:direction == 'replace' elseif a:direction ==# 'replace'
call CmdLine("%s" . '/'. l:pattern . '/') call CmdLine('%s' . '/'. l:pattern . '/')
endif endif
let @/ = l:pattern let @/ = l:pattern
@ -100,8 +100,8 @@ function! Redir(cmd, rng, start, end)
execute win . 'windo close' execute win . 'windo close'
endif endif
endfor endfor
if a:cmd =~ '^!' if a:cmd =~? '^!'
let cmd = a:cmd =~' %' let cmd = a:cmd =~?' %'
\ ? matchstr(substitute(a:cmd, ' %', ' ' . expand('%:p'), ''), '^!\zs.*') \ ? matchstr(substitute(a:cmd, ' %', ' ' . expand('%:p'), ''), '^!\zs.*')
\ : matchstr(a:cmd, '^!\zs.*') \ : matchstr(a:cmd, '^!\zs.*')
if a:rng == 0 if a:rng == 0
@ -109,7 +109,7 @@ function! Redir(cmd, rng, start, end)
else else
let joined_lines = join(getline(a:start, a:end), '\n') let joined_lines = join(getline(a:start, a:end), '\n')
let cleaned_lines = substitute(shellescape(joined_lines), "'\\\\''", "\\\\'", 'g') let cleaned_lines = substitute(shellescape(joined_lines), "'\\\\''", "\\\\'", 'g')
let output = systemlist(cmd . " <<< $" . cleaned_lines) let output = systemlist(cmd . ' <<< $' . cleaned_lines)
endif endif
else else
redir => output redir => output
@ -149,4 +149,3 @@ function! Cmd(cmd)
endfunction endfunction
command! -nargs=1 -complete=shellcmd Cmd silent call Cmd(<q-args>) command! -nargs=1 -complete=shellcmd Cmd silent call Cmd(<q-args>)

View File

@ -17,37 +17,37 @@ let g:ale_fixers = {
\ 'java': ['eclipselsp'], \ 'java': ['eclipselsp'],
\ 'yaml': ['prettier'], \ 'yaml': ['prettier'],
\ 'python': ['black', 'isort'], \ 'python': ['black', 'isort'],
\ 'go': ['gofmt', "goimports"], \ 'go': ['gofmt', 'goimports'],
\ 'rust': ['rustfmt'], \ 'rust': ['rustfmt'],
\ 'sql': ['pgformatter'], \ 'sql': ['pgformatter'],
\ "javascript": ["prettier", "eslint"], \ 'javascript': ['prettier', 'eslint'],
\ "vue": ["prettier", "eslint"] \ 'vue': ['prettier', 'eslint']
\} \}
let g:ale_fixers_aliases = {'vue': ['vue', 'javascript']} let g:ale_fixers_aliases = {'vue': ['vue', 'javascript']}
let g:ale_popup_menu_enabled =1 let g:ale_popup_menu_enabled = 1
let g:ale_python_bandit_options = "-c banditrc" let g:ale_python_bandit_options = '-c banditrc'
let g:ale_python_pylint_options = "-j0 --disable=W0511" let g:ale_python_pylint_options = '-j0 --disable=W0511'
let g:ale_python_mypy_options = "--ignore-missing-imports" let g:ale_python_mypy_options = '--ignore-missing-imports'
" let g:ale_cpp_clang_options = '-std=c++17 -Wall -Wpedantic' " let g:ale_cpp_clang_options = '-std=c++17 -Wall -Wpedantic'
" let g:ale_cpp_gcc_options = '-std=c++17 -Wall -Wpedantic' " let g:ale_cpp_gcc_options = '-std=c++17 -Wall -Wpedantic'
let g:ale_rust_cargo_use_clippy = 1 let g:ale_rust_cargo_use_clippy = 1
let g:ale_linters = { let g:ale_linters = {
\ 'bash': ['bash-language-server', 'bashlint', "shellcheck"], \ 'bash': ['bash-language-server', 'bashlint', 'shellcheck'],
\ 'dockerfile': ["hadolint"], \ 'dockerfile': ['hadolint'],
\ 'zsh': ['bashlint', "shellcheck"], \ 'zsh': ['bashlint', 'shellcheck'],
\ 'c': ['clangd'], \ 'c': ['clangd'],
\ 'cpp': ['clangd'], \ 'cpp': ['clangd'],
\ 'python': ['pylsp', 'pylint', 'bandit', "mypy", "flake8"], \ 'python': ['pylsp', 'pylint', 'bandit', 'mypy', 'flake8'],
\ 'go': ['gopls', 'gobuild'], \ 'go': ['gopls', 'gobuild'],
\ 'rust': ['analyzer'], \ 'rust': ['analyzer'],
\ 'yaml': ['yamllint'], \ 'yaml': ['yamllint'],
\ 'javascript': ["yarn lint", "eslint", "vls"] \ 'javascript': ['yarn lint', 'eslint', 'vls']
\} \}
let g:ale_linter_aliases = {'vue': ['vue', 'javascript']} let g:ale_linter_aliases = {'vue': ['vue', 'javascript']}
let g:ale_yaml_yamllint_options = "--config .editorconfig" let g:ale_yaml_yamllint_options = '--config .editorconfig'
let g:ale_open_list = 0 let g:ale_open_list = 0
let g:ale_keep_list_window_open = 1 let g:ale_keep_list_window_open = 1
@ -66,9 +66,9 @@ let g:ale_lsp_suggestions = 1
let g:ale_rename_tsserver_find_in_comment = 1 let g:ale_rename_tsserver_find_in_comment = 1
let g:ale_sign_priority = 99 let g:ale_sign_priority = 99
let g:ale_sign_error = "xx" let g:ale_sign_error = 'xx'
let g:ale_sign_warning = ">>" let g:ale_sign_warning = '>>'
let g:ale_sign_info = "--" let g:ale_sign_info = '--'
"let g:ale_sign_style_error = "let g:ale_sign_style_error =
"let g:ale_sign_style_warning = "let g:ale_sign_style_warning =
highlight link ALEVirtualTextError ALEError highlight link ALEVirtualTextError ALEError
@ -144,18 +144,15 @@ let g:airline_right_sep = ''
let g:airline_right_alt_sep = '' let g:airline_right_alt_sep = ''
let g:airline_symbols.branch = '' let g:airline_symbols.branch = ''
let g:airline_symbols.readonly = '' let g:airline_symbols.readonly = ''
" let g:airline_symbols.linenr = '☰'
let g:airline_symbols.colnr = ':' let g:airline_symbols.colnr = ':'
let g:airline_symbols.linenr = '' let g:airline_symbols.linenr = ''
let g:airline_symbols.maxlinenr = '' let g:airline_symbols.maxlinenr = ''
" let g:airline_section_c = ''
" let g:airline_section_c = '%t'
let g:airline_section_y = '' let g:airline_section_y = ''
" let g:airline_section_x = 'tagbar' let g:airline#extensions#tagbar#enabled = 1
let g:airline#extensions#tagbar#flags = 'p' let g:airline_section_x=' %{tagbar#currenttag("%s", "", "f")}'
let g:airline#extensions#tagbar#flags = 's'
let g:airline#extensions#tagbar#searchmethod = 'scoped-stl' let g:airline#extensions#tagbar#searchmethod = 'scoped-stl'
" let g:airline_symbols.dirty='⚡'
" let g:airline#extensions#branch#vcs_checks = ['untracked', 'dirty']
" These are the default mappings for vim-multi-cursor " These are the default mappings for vim-multi-cursor
let g:multi_cursor_start_word_key = '<C-n>' let g:multi_cursor_start_word_key = '<C-n>'
@ -190,10 +187,10 @@ let g:gutentags_ctags_extra_args = ['--tag-relative=always', ]
let NERDTreeIgnore=['__pycache__'] let NERDTreeIgnore=['__pycache__']
" ultisnips " ultisnips
let g:UltiSnipsExpandTrigger="<tab>" let g:UltiSnipsExpandTrigger='<tab>'
let g:UltiSnipsJumpForwardTrigger="<c-j>" let g:UltiSnipsJumpForwardTrigger='<c-j>'
let g:UltiSnipsJumpBackwardTrigger="<c-k>" let g:UltiSnipsJumpBackwardTrigger='<c-k>'
let g:UltiSnipsEditSplit="context" let g:UltiSnipsEditSplit='context'
"" Fzf "" Fzf
let g:fzf_layout = { 'window': { 'width': 1, 'height': 0.9 } } let g:fzf_layout = { 'window': { 'width': 1, 'height': 0.9 } }
@ -217,5 +214,9 @@ autocmd FileType fzf set laststatus=0 noshowmode noruler
\| autocmd BufLeave <buffer> set laststatus=2 showmode ruler \| autocmd BufLeave <buffer> set laststatus=2 showmode ruler
let g:goyo_width="85%" " Tagbar
let g:tagbar_left= 1
let g:goyo_width='85%'
let g:goyo_linenr=1 let g:goyo_linenr=1

View File

@ -14,7 +14,7 @@ Plug 'https://github.com/morhetz/gruvbox'
"Plug 'kristijanhusak/vim-hybrid-material' "Plug 'kristijanhusak/vim-hybrid-material'
"Plug 'https://github.com/rafi/awesome-vim-colorschemes' "Plug 'https://github.com/rafi/awesome-vim-colorschemes'
" Csv files 🤦" " Csv files 🤦
Plug 'https://github.com/mechatroner/rainbow_csv', { 'for': 'csv' } Plug 'https://github.com/mechatroner/rainbow_csv', { 'for': 'csv' }
" Asynchronous Linting Engine " Asynchronous Linting Engine
@ -50,7 +50,7 @@ Plug 'junegunn/fzf.vim'
Plug 'https://github.com/ludovicchabant/vim-gutentags.git' Plug 'https://github.com/ludovicchabant/vim-gutentags.git'
" snippets " snippets
if has("python3") if has('python3')
Plug 'https://github.com/SirVer/ultisnips' Plug 'https://github.com/SirVer/ultisnips'
Plug 'https://github.com/honza/vim-snippets' Plug 'https://github.com/honza/vim-snippets'
endif endif

View File

@ -1,5 +1,5 @@
"""" Leader shortcuts """" Leader shortcuts
let mapleader = "," let mapleader = ','
" also use space as leader " also use space as leader
map <Space> <leader> map <Space> <leader>
@ -122,12 +122,12 @@ nmap <leader>zz :Goyo<CR>
nmap <F8> :TagbarToggle<CR> nmap <F8> :TagbarToggle<CR>
""Misc stuff ""Misc stuff
if g:uname == "Darwin" if g:uname ==? 'Darwin'
"" Mac specific stuff "" Mac specific stuff
elseif g:uname == "Linux" elseif g:uname ==? 'Linux'
"" Linux specific stuff "" Linux specific stuff
function! s:WaylandYank() function! s:WaylandYank()
if v:event['regname'] == '+' || (v:event['regname'] == 'w' && s:plus_to_w) if v:event['regname'] ==# '+' || (v:event['regname'] ==# 'w' && s:plus_to_w)
call system('wl-copy', getreg(v:event['regname'])) call system('wl-copy', getreg(v:event['regname']))
endif endif
endfunction endfunction