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

vim: linting cleanup

This commit is contained in:
bretello 2023-01-19 17:33:11 +01:00
parent 3f89412fcc
commit 2066baee05
Signed by: brethil
GPG Key ID: 876AAC6290170FE7
4 changed files with 43 additions and 44 deletions

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_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
@ -190,10 +190,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 +217,5 @@ autocmd FileType fzf set laststatus=0 noshowmode noruler
\| autocmd BufLeave <buffer> set laststatus=2 showmode ruler
let g:goyo_width="85%"
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