|
@@ -5,7 +5,6 @@ if empty(glob('~/.vim/autoload/plug.vim'))
|
|
|
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
|
|
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
|
|
|
endif
|
|
endif
|
|
|
|
|
|
|
|
-
|
|
|
|
|
" Plugins
|
|
" Plugins
|
|
|
call plug#begin('~/.vim/plugged')
|
|
call plug#begin('~/.vim/plugged')
|
|
|
Plug 'preservim/nerdtree'
|
|
Plug 'preservim/nerdtree'
|
|
@@ -15,7 +14,8 @@ Plug 'junegunn/vim-peekaboo'
|
|
|
Plug 'itchyny/lightline.vim'
|
|
Plug 'itchyny/lightline.vim'
|
|
|
Plug 'dikiaap/minimalist'
|
|
Plug 'dikiaap/minimalist'
|
|
|
Plug 'kaicataldo/material.vim'
|
|
Plug 'kaicataldo/material.vim'
|
|
|
-Plug 'dense-analysis/ale'
|
|
|
|
|
|
|
+" Plug 'dense-analysis/ale'
|
|
|
|
|
+Plug 'ssh://git@gogs.viktorgrahn.com:2022/viktor/ale.git'
|
|
|
Plug 'maximbaz/lightline-ale'
|
|
Plug 'maximbaz/lightline-ale'
|
|
|
Plug 'preservim/tagbar'
|
|
Plug 'preservim/tagbar'
|
|
|
Plug 'vim-php/tagbar-phpctags.vim'
|
|
Plug 'vim-php/tagbar-phpctags.vim'
|
|
@@ -26,6 +26,7 @@ Plug 'mxw/vim-jsx'
|
|
|
Plug 'pangloss/vim-javascript'
|
|
Plug 'pangloss/vim-javascript'
|
|
|
Plug 'natebosch/vim-lsc'
|
|
Plug 'natebosch/vim-lsc'
|
|
|
Plug 'tpope/vim-surround'
|
|
Plug 'tpope/vim-surround'
|
|
|
|
|
+Plug 'ap/vim-css-color', { 'for': [ 'css', 'scss' ] }
|
|
|
call plug#end()
|
|
call plug#end()
|
|
|
|
|
|
|
|
filetype plugin indent on
|
|
filetype plugin indent on
|
|
@@ -65,6 +66,7 @@ set undodir=~/.vim/undo
|
|
|
" Colorscheme
|
|
" Colorscheme
|
|
|
colorscheme minimalist
|
|
colorscheme minimalist
|
|
|
highlight Comment cterm=italic
|
|
highlight Comment cterm=italic
|
|
|
|
|
+highlight Pmenu ctermbg=233
|
|
|
|
|
|
|
|
" Lightline
|
|
" Lightline
|
|
|
set laststatus=2
|
|
set laststatus=2
|
|
@@ -149,27 +151,59 @@ endfunction
|
|
|
" NERDTREE Toggle NERDTree on <space>-o
|
|
" NERDTREE Toggle NERDTree on <space>-o
|
|
|
map <Space>o :call NERDTreeToggleCustom()<CR>
|
|
map <Space>o :call NERDTreeToggleCustom()<CR>
|
|
|
|
|
|
|
|
|
|
+" NERDTree fix for menu bug
|
|
|
|
|
+let g:NERDTreeMinimalMenu=1
|
|
|
|
|
+
|
|
|
" ALE Configuration
|
|
" ALE Configuration
|
|
|
let g:ale_completion_enabled = 0
|
|
let g:ale_completion_enabled = 0
|
|
|
let g:ale_sign_column_always = 1
|
|
let g:ale_sign_column_always = 1
|
|
|
let g:ale_set_signs = 1
|
|
let g:ale_set_signs = 1
|
|
|
let g:ale_set_highlights = 0
|
|
let g:ale_set_highlights = 0
|
|
|
-let g:ale_disable_lsp = 1
|
|
|
|
|
|
|
+
|
|
|
|
|
+" QD for intelephense stubs
|
|
|
|
|
+let s:intelephense_config = {
|
|
|
|
|
+\ 'stubs': [ 'apache', 'bcmath', 'bz2', 'calendar', 'com_dotnet', 'Core', 'ctype', 'curl', 'date', 'dba', 'dom', 'enchant', 'exif', 'FFI', 'fileinfo', 'filter', 'fpm', 'ftp', 'gd', 'gettext', 'gmp', 'hash', 'iconv', 'imap', 'intl', 'json', 'ldap', 'libxml', 'mbstring', 'meta', 'mongodb', 'mysqli', 'oci8', 'odbc', 'openssl', 'pcntl', 'pcre', 'PDO', 'pdo_ibm', 'pdo_mysql', 'pdo_pgsql', 'pdo_sqlite', 'pgsql', 'Phar', 'posix', 'pspell', 'readline', 'Reflection', 'session', 'shmop', 'SimpleXML', 'snmp', 'soap', 'sockets', 'sodium', 'SPL', 'sqlite3', 'standard', 'superglobals', 'sysvmsg', 'sysvsem', 'sysvshm', 'tidy', 'tokenizer', 'xml', 'xmlreader', 'xmlrpc', 'xmlwriter', 'xsl', 'ZendOPcache', 'zip', 'zlib' ],
|
|
|
|
|
+\ 'files': {
|
|
|
|
|
+\ 'maxSize': 2000000
|
|
|
|
|
+\ },
|
|
|
|
|
+\}
|
|
|
|
|
+
|
|
|
|
|
+if &rtp =~ 'ale\(\.git\)\?'
|
|
|
|
|
+" Custom intelephense
|
|
|
|
|
+ call ale#linter#Define('php', {
|
|
|
|
|
+ \ 'name': 'intelephense-debug',
|
|
|
|
|
+ \ 'lsp': 'stdio',
|
|
|
|
|
+ \ 'initialization_options': function('ale_linters#php#intelephense#GetInitializationOptions'),
|
|
|
|
|
+ \ 'executable': {b -> ale#path#FindExecutable(b, 'php_intelephense', [])},
|
|
|
|
|
+ \ 'command': '%e --stdio',
|
|
|
|
|
+ \ 'project_root': function('ale_linters#php#intelephense#GetProjectRoot'),
|
|
|
|
|
+ \ 'lsp_config': s:intelephense_config,
|
|
|
|
|
+ \})
|
|
|
|
|
+endif
|
|
|
|
|
|
|
|
" ALE linters
|
|
" ALE linters
|
|
|
let g:ale_use_global_executables = 1
|
|
let g:ale_use_global_executables = 1
|
|
|
let g:ale_linters_explicit = 1
|
|
let g:ale_linters_explicit = 1
|
|
|
let g:ale_linters = {}
|
|
let g:ale_linters = {}
|
|
|
let g:ale_linters.javascript = [ 'eslint' ]
|
|
let g:ale_linters.javascript = [ 'eslint' ]
|
|
|
-let g:ale_linters.php = [ 'intelephense', 'phpcs' ]
|
|
|
|
|
|
|
+let g:ale_linters.php = [ 'intelephense-debug', 'phpcs', 'phpmd' ]
|
|
|
let g:ale_linters.go = [ 'gopls', 'gofmt', 'gobuild' ]
|
|
let g:ale_linters.go = [ 'gopls', 'gofmt', 'gobuild' ]
|
|
|
|
|
+let g:ale_linters.json = [ 'jsonlint', 'jq' ]
|
|
|
|
|
+let g:ale_history_log_output = 1
|
|
|
|
|
+let g:ale_virtualtext_cursor = 'current'
|
|
|
|
|
|
|
|
let g:ale_phpcs_standard = "PSR2"
|
|
let g:ale_phpcs_standard = "PSR2"
|
|
|
|
|
|
|
|
|
|
+let g:ale_php_phpmd_ruleset = 'cleancode'
|
|
|
|
|
+let g:ale_php_intelephense_executable = 'debugIntelephense.sh'
|
|
|
|
|
+
|
|
|
|
|
+let g:ale_php_intelephense_config = { 'storagePath': '/tmp/intelephense-ale' }
|
|
|
|
|
+
|
|
|
" ALE fixers
|
|
" ALE fixers
|
|
|
let g:ale_fixers = { '*': [ 'remove_trailing_lines', 'trim_whitespace' ] }
|
|
let g:ale_fixers = { '*': [ 'remove_trailing_lines', 'trim_whitespace' ] }
|
|
|
let g:ale_fixers.javascript = [ 'prettier', 'eslint' ]
|
|
let g:ale_fixers.javascript = [ 'prettier', 'eslint' ]
|
|
|
-let g:ale_fixers.go = [ 'gofmt' ]
|
|
|
|
|
|
|
+let g:ale_fixers.json = [ 'prettier' ]
|
|
|
|
|
+let g:ale_fixers.go = [ 'gofmt', 'goimports' ]
|
|
|
|
|
|
|
|
" ALE message should include responsible linter
|
|
" ALE message should include responsible linter
|
|
|
let g:ale_echo_msg_format = '[%linter%] %s'
|
|
let g:ale_echo_msg_format = '[%linter%] %s'
|
|
@@ -178,6 +212,9 @@ let g:ale_echo_msg_format = '[%linter%] %s'
|
|
|
nnoremap <C-a>l :ALELint<CR>
|
|
nnoremap <C-a>l :ALELint<CR>
|
|
|
nnoremap <C-a>f :ALEFix<CR>
|
|
nnoremap <C-a>f :ALEFix<CR>
|
|
|
nnoremap <C-a>i :ALEInfo<CR>
|
|
nnoremap <C-a>i :ALEInfo<CR>
|
|
|
|
|
+nnoremap <C-a>n :ALENext<CR>
|
|
|
|
|
+nnoremap <C-a>p :ALEPrevious<CR>
|
|
|
|
|
+
|
|
|
|
|
|
|
|
" ALE styling
|
|
" ALE styling
|
|
|
highlight ALEErrorSign ctermbg=237 ctermfg=167
|
|
highlight ALEErrorSign ctermbg=237 ctermfg=167
|
|
@@ -255,13 +292,14 @@ function! Toggle_git_blame()
|
|
|
endfunction
|
|
endfunction
|
|
|
nnoremap <Space>b :call Toggle_git_blame()<CR>
|
|
nnoremap <Space>b :call Toggle_git_blame()<CR>
|
|
|
|
|
|
|
|
|
|
+" Git gutter
|
|
|
|
|
+nmap <C-g>n :GitGutterNextHunk<CR>
|
|
|
|
|
+nmap <C-g>p :GitGutterPrevHunk<CR>
|
|
|
|
|
+
|
|
|
" Fuzzy search
|
|
" Fuzzy search
|
|
|
nmap <Space>f :Files<CR>
|
|
nmap <Space>f :Files<CR>
|
|
|
nmap <Space>s :Rg<CR>
|
|
nmap <Space>s :Rg<CR>
|
|
|
-
|
|
|
|
|
-" Git gutter
|
|
|
|
|
-nmap <Space>n :GitGutterNextHunk<CR>
|
|
|
|
|
-nmap <Space>p :GitGutterPrevHunk<CR>
|
|
|
|
|
|
|
+nmap <Space>w :Windows<CR>
|
|
|
|
|
|
|
|
" Setting title to enable better tmux titling
|
|
" Setting title to enable better tmux titling
|
|
|
if exists('$TMUX')
|
|
if exists('$TMUX')
|
|
@@ -270,8 +308,11 @@ if exists('$TMUX')
|
|
|
endif
|
|
endif
|
|
|
|
|
|
|
|
function UpdateTmuxWindow()
|
|
function UpdateTmuxWindow()
|
|
|
- let title = @% == "" ? "vim" : "vim | " . expand("%:t")
|
|
|
|
|
- call system("tmux rename-window '" . title . "'")
|
|
|
|
|
|
|
+ let excludedFiletypes = [ 'help', 'qf', 'nerdtree' ]
|
|
|
|
|
+ if index(excludedFiletypes, &filetype) < 0
|
|
|
|
|
+ let title = @% == "" ? "vim" : "vim (" . expand("%:t") . ")"
|
|
|
|
|
+ call system("tmux rename-window '" . title . "'")
|
|
|
|
|
+ endif
|
|
|
endfunction
|
|
endfunction
|
|
|
|
|
|
|
|
" Format XML pretty
|
|
" Format XML pretty
|
|
@@ -289,6 +330,15 @@ endfunction
|
|
|
nmap <Space>x :call PrettyXML()<CR>
|
|
nmap <Space>x :call PrettyXML()<CR>
|
|
|
nmap <Space>j :call PrettyJSON()<CR>
|
|
nmap <Space>j :call PrettyJSON()<CR>
|
|
|
|
|
|
|
|
|
|
+" Diff since save
|
|
|
|
|
+nmap <Space>d :w !diff -y --suppress-common-lines --color % -<CR>
|
|
|
|
|
+
|
|
|
|
|
+" Navigation keymaps
|
|
|
|
|
+inoremap <C-h> <Left>
|
|
|
|
|
+inoremap <C-l> <Right>
|
|
|
|
|
+inoremap <C-j> <Down>
|
|
|
|
|
+inoremap <C-k> <Up>
|
|
|
|
|
+
|
|
|
" Disable bad default keybindings
|
|
" Disable bad default keybindings
|
|
|
inoremap <C-w> <Nop>
|
|
inoremap <C-w> <Nop>
|
|
|
|
|
|
|
@@ -303,17 +353,29 @@ nnoremap <C-l>f :LSClientFindReferences<CR>
|
|
|
nnoremap <C-l>g :tab LSClientGoToDefinitionSplit<CR>
|
|
nnoremap <C-l>g :tab LSClientGoToDefinitionSplit<CR>
|
|
|
nnoremap <C-l>G :LSClientGoToDefinition<CR>
|
|
nnoremap <C-l>G :LSClientGoToDefinition<CR>
|
|
|
nnoremap <C-l>h :LSClientShowHover<CR>
|
|
nnoremap <C-l>h :LSClientShowHover<CR>
|
|
|
|
|
+nnoremap <C-l>c :LSClientSignatureHelp<CR>
|
|
|
|
|
|
|
|
" LSP servers
|
|
" LSP servers
|
|
|
let g:lsc_server_commands = {}
|
|
let g:lsc_server_commands = {}
|
|
|
let g:lsc_server_commands = {
|
|
let g:lsc_server_commands = {
|
|
|
\ 'javascript': { 'command': 'typescript-language-server --stdio', 'log_level': -1, 'suppress_stderr': v:true },
|
|
\ 'javascript': { 'command': 'typescript-language-server --stdio', 'log_level': -1, 'suppress_stderr': v:true },
|
|
|
\ 'javascript.jsx': { 'command': 'typescript-language-server --stdio', 'log_level': -1, 'suppress_stderr': v:true },
|
|
\ 'javascript.jsx': { 'command': 'typescript-language-server --stdio', 'log_level': -1, 'suppress_stderr': v:true },
|
|
|
|
|
+ \ 'php': { 'command': 'intelephense --stdio', 'message_hooks': {'initialize': { 'initializationOptions': {'storagePath': '/tmp/intelephense'} } }, 'workspace_config': { 'intelephense': s:intelephense_config } },
|
|
|
\ 'go': { 'command': 'gopls serve', 'log_level': -1, 'suppress_stderr': v:true },
|
|
\ 'go': { 'command': 'gopls serve', 'log_level': -1, 'suppress_stderr': v:true },
|
|
|
- \ 'php': { 'command': 'intelephense --stdio', 'message_hooks': {'initialize': { 'initializationOptions': {'storagePath': '/tmp/intelephense'} } } },
|
|
|
|
|
\}
|
|
\}
|
|
|
|
|
|
|
|
" LSP close preview after selecting completion
|
|
" LSP close preview after selecting completion
|
|
|
autocmd CompleteDone * silent! pclose
|
|
autocmd CompleteDone * silent! pclose
|
|
|
" LSP close quickfix list after selection
|
|
" LSP close quickfix list after selection
|
|
|
autocmd BufLeave * cclose
|
|
autocmd BufLeave * cclose
|
|
|
|
|
+
|
|
|
|
|
+" Auto expand
|
|
|
|
|
+inoremap (; (<CR>);<C-c>O
|
|
|
|
|
+inoremap (, (<CR>),<C-c>O
|
|
|
|
|
+inoremap (<CR> (<CR>)<C-c>O
|
|
|
|
|
+inoremap {; {<CR>};<C-c>O
|
|
|
|
|
+inoremap {, {<CR>},<C-c>O
|
|
|
|
|
+inoremap {<CR> {<CR>}<C-c>O
|
|
|
|
|
+inoremap [; [<CR>];<C-c>O
|
|
|
|
|
+inoremap [, [<CR>],<C-c>O
|
|
|
|
|
+inoremap [<CR> [<CR>]<C-c>O
|