vim: linting cleanup

fix-ci
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 | 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
@ -190,10 +190,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 +217,5 @@ 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%" 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