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

View File

@ -17,37 +17,37 @@ let g:ale_fixers = {
\ 'java': ['eclipselsp'],
\ 'yaml': ['prettier'],
\ 'python': ['black', 'isort'],
\ 'go': ['gofmt', "goimports"],
\ 'go': ['gofmt', 'goimports'],
\ 'rust': ['rustfmt'],
\ 'sql': ['pgformatter'],
\ "javascript": ["prettier", "eslint"],
\ "vue": ["prettier", "eslint"]
\ 'javascript': ['prettier', 'eslint'],
\ 'vue': ['prettier', 'eslint']
\}
let g:ale_fixers_aliases = {'vue': ['vue', 'javascript']}
let g:ale_popup_menu_enabled =1
let g:ale_python_bandit_options = "-c banditrc"
let g:ale_python_pylint_options = "-j0 --disable=W0511"
let g:ale_python_mypy_options = "--ignore-missing-imports"
let g:ale_popup_menu_enabled = 1
let g:ale_python_bandit_options = '-c banditrc'
let g:ale_python_pylint_options = '-j0 --disable=W0511'
let g:ale_python_mypy_options = '--ignore-missing-imports'
" 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_rust_cargo_use_clippy = 1
let g:ale_linters = {
\ 'bash': ['bash-language-server', 'bashlint', "shellcheck"],
\ 'dockerfile': ["hadolint"],
\ 'zsh': ['bashlint', "shellcheck"],
\ 'bash': ['bash-language-server', 'bashlint', 'shellcheck'],
\ 'dockerfile': ['hadolint'],
\ 'zsh': ['bashlint', 'shellcheck'],
\ 'c': ['clangd'],
\ 'cpp': ['clangd'],
\ 'python': ['pylsp', 'pylint', 'bandit', "mypy", "flake8"],
\ 'python': ['pylsp', 'pylint', 'bandit', 'mypy', 'flake8'],
\ 'go': ['gopls', 'gobuild'],
\ 'rust': ['analyzer'],
\ 'yaml': ['yamllint'],
\ 'javascript': ["yarn lint", "eslint", "vls"]
\ 'javascript': ['yarn lint', 'eslint', 'vls']
\}
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_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_sign_priority = 99
let g:ale_sign_error = "xx"
let g:ale_sign_warning = ">>"
let g:ale_sign_info = "--"
let g:ale_sign_error = 'xx'
let g:ale_sign_warning = '>>'
let g:ale_sign_info = '--'
"let g:ale_sign_style_error =
"let g:ale_sign_style_warning =
highlight link ALEVirtualTextError ALEError
@ -144,18 +144,15 @@ let g:airline_right_sep = ''
let g:airline_right_alt_sep = ''
let g:airline_symbols.branch = ''
let g:airline_symbols.readonly = ''
" let g:airline_symbols.linenr = '☰'
let g:airline_symbols.colnr = ':'
let g:airline_symbols.linenr = ''
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_x = 'tagbar'
let g:airline#extensions#tagbar#flags = 'p'
let g:airline#extensions#tagbar#enabled = 1
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_symbols.dirty='⚡'
" let g:airline#extensions#branch#vcs_checks = ['untracked', 'dirty']
" These are the default mappings for vim-multi-cursor
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__']
" ultisnips
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<c-j>"
let g:UltiSnipsJumpBackwardTrigger="<c-k>"
let g:UltiSnipsEditSplit="context"
let g:UltiSnipsExpandTrigger='<tab>'
let g:UltiSnipsJumpForwardTrigger='<c-j>'
let g:UltiSnipsJumpBackwardTrigger='<c-k>'
let g:UltiSnipsEditSplit='context'
"" Fzf
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
let g:goyo_width="85%"
" Tagbar
let g:tagbar_left= 1
let g:goyo_width='85%'
let g:goyo_linenr=1

View File

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

View File

@ -1,5 +1,5 @@
"""" Leader shortcuts
let mapleader = ","
let mapleader = ','
" also use space as leader
map <Space> <leader>
@ -122,12 +122,12 @@ nmap <leader>zz :Goyo<CR>
nmap <F8> :TagbarToggle<CR>
""Misc stuff
if g:uname == "Darwin"
if g:uname ==? 'Darwin'
"" Mac specific stuff
elseif g:uname == "Linux"
elseif g:uname ==? 'Linux'
"" Linux specific stuff
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']))
endif
endfunction