aboutsummaryrefslogtreecommitdiff
path: root/stow/vim/.vim
diff options
context:
space:
mode:
authorInigoGutierrez <inigogf.95@gmail.com>2022-06-11 19:24:38 +0200
committerInigoGutierrez <inigogf.95@gmail.com>2022-06-11 19:24:38 +0200
commitc5367645c3e8f51866ca34cfbaa6c14cf8772022 (patch)
tree78791b7100b1f6a96b65c85606cc19224f7e497d /stow/vim/.vim
parent477408015c29db8a61265faa7c3d21d7113dd7bd (diff)
downloadconfigs-c5367645c3e8f51866ca34cfbaa6c14cf8772022.tar.gz
configs-c5367645c3e8f51866ca34cfbaa6c14cf8772022.zip
Meddling with vim for python development settings.
Diffstat (limited to 'stow/vim/.vim')
-rw-r--r--stow/vim/.vim/autoload/plug.vim58
-rw-r--r--stow/vim/.vim/autoload/plug.vim.old32
-rw-r--r--stow/vim/.vim/ftplugin/python/python.vim16
-rw-r--r--stow/vim/.vim/ftplugin/vimwiki/vimwiki.vim2
-rw-r--r--stow/vim/.vim/rc/ale.vim3
-rw-r--r--stow/vim/.vim/rc/maps.vim2
-rw-r--r--stow/vim/.vim/rc/nvim-jdtls.vim3
7 files changed, 83 insertions, 33 deletions
diff --git a/stow/vim/.vim/autoload/plug.vim b/stow/vim/.vim/autoload/plug.vim
index 9c296ac..652caa8 100644
--- a/stow/vim/.vim/autoload/plug.vim
+++ b/stow/vim/.vim/autoload/plug.vim
@@ -116,6 +116,10 @@ let s:TYPE = {
let s:loaded = get(s:, 'loaded', {})
let s:triggers = get(s:, 'triggers', {})
+function! s:is_powershell(shell)
+ return a:shell =~# 'powershell\(\.exe\)\?$' || a:shell =~# 'pwsh\(\.exe\)\?$'
+endfunction
+
function! s:isabsolute(dir) abort
return a:dir =~# '^/' || (has('win32') && a:dir =~? '^\%(\\\|[A-Z]:\)')
endfunction
@@ -238,6 +242,8 @@ function! plug#begin(...)
let home = s:path(s:plug_fnamemodify(s:plug_expand(a:1), ':p'))
elseif exists('g:plug_home')
let home = s:path(g:plug_home)
+ elseif has('nvim')
+ let home = stdpath('data') . '/plugged'
elseif !empty(&rtp)
let home = s:path(split(&rtp, ',')[0]) . '/plugged'
else
@@ -263,7 +269,7 @@ function! s:define_commands()
endif
if has('win32')
\ && &shellslash
- \ && (&shell =~# 'cmd\(\.exe\)\?$' || &shell =~# 'powershell\(\.exe\)\?$')
+ \ && (&shell =~# 'cmd\(\.exe\)\?$' || s:is_powershell(&shell))
return s:err('vim-plug does not support shell, ' . &shell . ', when shellslash is set.')
endif
if !has('nvim')
@@ -346,7 +352,7 @@ function! plug#end()
endif
let lod = { 'ft': {}, 'map': {}, 'cmd': {} }
- if exists('g:did_load_filetypes')
+ if get(g:, 'did_load_filetypes', 0)
filetype off
endif
for name in g:plugs_order
@@ -401,7 +407,7 @@ function! plug#end()
for [map, names] in items(lod.map)
for [mode, map_prefix, key_prefix] in
- \ [['i', '<C-O>', ''], ['n', '', ''], ['v', '', 'gv'], ['o', '', '']]
+ \ [['i', '<C-\><C-O>', ''], ['n', '', ''], ['v', '', 'gv'], ['o', '', '']]
execute printf(
\ '%snoremap <silent> %s %s:<C-U>call <SID>lod_map(%s, %s, %s, "%s")<CR>',
\ mode, map, map_prefix, string(map), string(names), mode != 'i', key_prefix)
@@ -503,7 +509,7 @@ if s:is_win
let batchfile = s:plug_tempname().'.bat'
call writefile(s:wrap_cmds(a:cmd), batchfile)
let cmd = plug#shellescape(batchfile, {'shell': &shell, 'script': 0})
- if &shell =~# 'powershell\(\.exe\)\?$'
+ if s:is_powershell(&shell)
let cmd = '& ' . cmd
endif
return [batchfile, cmd]
@@ -935,7 +941,7 @@ function! s:prepare(...)
call s:new_window()
endif
- nnoremap <silent> <buffer> q :if b:plug_preview==1<bar>pc<bar>endif<bar>bd<cr>
+ nnoremap <silent> <buffer> q :call <SID>close_pane()<cr>
if a:0 == 0
call s:finish_bindings()
endif
@@ -957,6 +963,15 @@ function! s:prepare(...)
endif
endfunction
+function! s:close_pane()
+ if b:plug_preview == 1
+ pc
+ let b:plug_preview = -1
+ else
+ bd
+ endif
+endfunction
+
function! s:assign_name()
" Assign buffer name
let prefix = '[Plugins]'
@@ -975,7 +990,7 @@ function! s:chsh(swap)
set shell=sh
endif
if a:swap
- if &shell =~# 'powershell\(\.exe\)\?$' || &shell =~# 'pwsh$'
+ if s:is_powershell(&shell)
let &shellredir = '2>&1 | Out-File -Encoding UTF8 %s'
elseif &shell =~# 'sh' || &shell =~# 'cmd\(\.exe\)\?$'
set shellredir=>%s\ 2>&1
@@ -1195,7 +1210,8 @@ function! s:update_impl(pull, force, args) abort
normal! 2G
silent! redraw
- let s:clone_opt = []
+ " Set remote name, overriding a possible user git config's clone.defaultRemoteName
+ let s:clone_opt = ['--origin', 'origin']
if get(g:, 'plug_shallow', 1)
call extend(s:clone_opt, ['--depth', '1'])
if s:git_version_requirement(1, 7, 10)
@@ -2216,7 +2232,7 @@ function! plug#shellescape(arg, ...)
let script = get(opts, 'script', 1)
if shell =~# 'cmd\(\.exe\)\?$'
return s:shellesc_cmd(a:arg, script)
- elseif shell =~# 'powershell\(\.exe\)\?$' || shell =~# 'pwsh$'
+ elseif s:is_powershell(shell)
return s:shellesc_ps1(a:arg)
endif
return s:shellesc_sh(a:arg)
@@ -2268,7 +2284,7 @@ function! s:system(cmd, ...)
return system(a:cmd)
endif
let cmd = join(map(copy(a:cmd), 'plug#shellescape(v:val, {"shell": &shell, "script": 0})'))
- if &shell =~# 'powershell\(\.exe\)\?$'
+ if s:is_powershell(&shell)
let cmd = '& ' . cmd
endif
else
@@ -2605,26 +2621,34 @@ function! s:preview_commit()
let sha = matchstr(getline('.'), '^ \X*\zs[0-9a-f]\{7,9}')
if empty(sha)
- return
+ let name = matchstr(getline('.'), '^- \zs[^:]*\ze:$')
+ if empty(name)
+ return
+ endif
+ let title = 'HEAD@{1}..'
+ let command = 'git diff --no-color HEAD@{1}'
+ else
+ let title = sha
+ let command = 'git show --no-color --pretty=medium '.sha
+ let name = s:find_name(line('.'))
endif
- let name = s:find_name(line('.'))
if empty(name) || !has_key(g:plugs, name) || !isdirectory(g:plugs[name].dir)
return
endif
if exists('g:plug_pwindow') && !s:is_preview_window_open()
execute g:plug_pwindow
- execute 'e' sha
+ execute 'e' title
else
- execute 'pedit' sha
+ execute 'pedit' title
wincmd P
endif
- setlocal previewwindow filetype=git buftype=nofile nobuflisted modifiable
+ setlocal previewwindow filetype=git buftype=nofile bufhidden=wipe nobuflisted modifiable
let batchfile = ''
try
let [sh, shellcmdflag, shrd] = s:chsh(1)
- let cmd = 'cd '.plug#shellescape(g:plugs[name].dir).' && git show --no-color --pretty=medium '.sha
+ let cmd = 'cd '.plug#shellescape(g:plugs[name].dir).' && '.command
if s:is_win
let [batchfile, cmd] = s:batchfile(cmd)
endif
@@ -2750,9 +2774,9 @@ function! s:snapshot(force, ...) abort
1
let anchor = line('$') - 3
let names = sort(keys(filter(copy(g:plugs),
- \'has_key(v:val, "uri") && !has_key(v:val, "commit") && isdirectory(v:val.dir)')))
+ \'has_key(v:val, "uri") && isdirectory(v:val.dir)')))
for name in reverse(names)
- let sha = s:git_revision(g:plugs[name].dir)
+ let sha = has_key(g:plugs[name], 'commit') ? g:plugs[name].commit : s:git_revision(g:plugs[name].dir)
if !empty(sha)
call append(anchor, printf("silent! let g:plugs['%s'].commit = '%s'", name, sha))
redraw
diff --git a/stow/vim/.vim/autoload/plug.vim.old b/stow/vim/.vim/autoload/plug.vim.old
index c1657f2..ad95041 100644
--- a/stow/vim/.vim/autoload/plug.vim.old
+++ b/stow/vim/.vim/autoload/plug.vim.old
@@ -116,6 +116,10 @@ let s:TYPE = {
let s:loaded = get(s:, 'loaded', {})
let s:triggers = get(s:, 'triggers', {})
+function! s:is_powershell(shell)
+ return a:shell =~# 'powershell\(\.exe\)\?$' || a:shell =~# 'pwsh\(\.exe\)\?$'
+endfunction
+
function! s:isabsolute(dir) abort
return a:dir =~# '^/' || (has('win32') && a:dir =~? '^\%(\\\|[A-Z]:\)')
endfunction
@@ -263,7 +267,7 @@ function! s:define_commands()
endif
if has('win32')
\ && &shellslash
- \ && (&shell =~# 'cmd\(\.exe\)\?$' || &shell =~# 'powershell\(\.exe\)\?$')
+ \ && (&shell =~# 'cmd\(\.exe\)\?$' || s:is_powershell(&shell))
return s:err('vim-plug does not support shell, ' . &shell . ', when shellslash is set.')
endif
if !has('nvim')
@@ -401,7 +405,7 @@ function! plug#end()
for [map, names] in items(lod.map)
for [mode, map_prefix, key_prefix] in
- \ [['i', '<C-O>', ''], ['n', '', ''], ['v', '', 'gv'], ['o', '', '']]
+ \ [['i', '<C-\><C-O>', ''], ['n', '', ''], ['v', '', 'gv'], ['o', '', '']]
execute printf(
\ '%snoremap <silent> %s %s:<C-U>call <SID>lod_map(%s, %s, %s, "%s")<CR>',
\ mode, map, map_prefix, string(map), string(names), mode != 'i', key_prefix)
@@ -503,7 +507,7 @@ if s:is_win
let batchfile = s:plug_tempname().'.bat'
call writefile(s:wrap_cmds(a:cmd), batchfile)
let cmd = plug#shellescape(batchfile, {'shell': &shell, 'script': 0})
- if &shell =~# 'powershell\(\.exe\)\?$'
+ if s:is_powershell(&shell)
let cmd = '& ' . cmd
endif
return [batchfile, cmd]
@@ -935,7 +939,7 @@ function! s:prepare(...)
call s:new_window()
endif
- nnoremap <silent> <buffer> q :if b:plug_preview==1<bar>pc<bar>endif<bar>bd<cr>
+ nnoremap <silent> <buffer> q :call <SID>close_pane()<cr>
if a:0 == 0
call s:finish_bindings()
endif
@@ -957,6 +961,15 @@ function! s:prepare(...)
endif
endfunction
+function! s:close_pane()
+ if b:plug_preview == 1
+ pc
+ let b:plug_preview = -1
+ else
+ bd
+ endif
+endfunction
+
function! s:assign_name()
" Assign buffer name
let prefix = '[Plugins]'
@@ -975,7 +988,7 @@ function! s:chsh(swap)
set shell=sh
endif
if a:swap
- if &shell =~# 'powershell\(\.exe\)\?$' || &shell =~# 'pwsh$'
+ if s:is_powershell(&shell)
let &shellredir = '2>&1 | Out-File -Encoding UTF8 %s'
elseif &shell =~# 'sh' || &shell =~# 'cmd\(\.exe\)\?$'
set shellredir=>%s\ 2>&1
@@ -1195,7 +1208,8 @@ function! s:update_impl(pull, force, args) abort
normal! 2G
silent! redraw
- let s:clone_opt = []
+ " Set remote name, overriding a possible user git config's clone.defaultRemoteName
+ let s:clone_opt = ['--origin', 'origin']
if get(g:, 'plug_shallow', 1)
call extend(s:clone_opt, ['--depth', '1'])
if s:git_version_requirement(1, 7, 10)
@@ -1532,7 +1546,7 @@ while 1 " Without TCO, Vim stack is bound to explode
let [error, _] = s:git_validate(spec, 0)
if empty(error)
if pull
- let cmd = ['git', 'fetch']
+ let cmd = s:git_version_requirement(2) ? ['git', '-c', 'credential.helper=', 'fetch'] : ['git', 'fetch']
if has_tag && !empty(globpath(spec.dir, '.git/shallow'))
call extend(cmd, ['--depth', '99999999'])
endif
@@ -2216,7 +2230,7 @@ function! plug#shellescape(arg, ...)
let script = get(opts, 'script', 1)
if shell =~# 'cmd\(\.exe\)\?$'
return s:shellesc_cmd(a:arg, script)
- elseif shell =~# 'powershell\(\.exe\)\?$' || shell =~# 'pwsh$'
+ elseif s:is_powershell(shell)
return s:shellesc_ps1(a:arg)
endif
return s:shellesc_sh(a:arg)
@@ -2268,7 +2282,7 @@ function! s:system(cmd, ...)
return system(a:cmd)
endif
let cmd = join(map(copy(a:cmd), 'plug#shellescape(v:val, {"shell": &shell, "script": 0})'))
- if &shell =~# 'powershell\(\.exe\)\?$'
+ if s:is_powershell(&shell)
let cmd = '& ' . cmd
endif
else
diff --git a/stow/vim/.vim/ftplugin/python/python.vim b/stow/vim/.vim/ftplugin/python/python.vim
index b868b10..dd2ff02 100644
--- a/stow/vim/.vim/ftplugin/python/python.vim
+++ b/stow/vim/.vim/ftplugin/python/python.vim
@@ -11,6 +11,7 @@ call matchadd('ColorColumn', '\%91v', 100)
setlocal textwidth=90
let b:ale_python_pylint_options = '-d invalid-name'
+let b:ale_fixers = ['yapf']
" Mappings
@@ -20,11 +21,16 @@ nnoremap <buffer> <leader>C :sp ~/.vim/ftplugin/python/python.vim<CR>
nnoremap <buffer> <leader>x :! ./%
nnoremap <buffer> <leader>X :! ./%<CR>
-nnoremap <buffer> gd :YcmCompleter GoTo<CR>
-nnoremap <buffer> gr :YcmCompleter GoToReferences<CR>
-nnoremap <buffer> gR :YcmCompleter RefactorRename<Space>
-nnoremap <buffer> <leader>gd :YcmCompleter GetDoc<CR>
-nnoremap <buffer> <leader>gT :YcmCompleter GetType<CR>
+"nnoremap <buffer> gd :YcmCompleter GoTo<CR>
+"nnoremap <buffer> gr :YcmCompleter GoToReferences<CR>
+"nnoremap <buffer> gR :YcmCompleter RefactorRename<Space>
+"nnoremap <buffer> <leader>gd :YcmCompleter GetDoc<CR>
+"nnoremap <buffer> <leader>gT :YcmCompleter GetType<CR>
+
+nnoremap gd <Plug>(coc-definition)
+nnoremap gy <Plug>(coc-type-definition)
+nnoremap gi <Plug>(coc-implementation)
+nnoremap gr <Plug>(coc-references)
nnoremap <buffer> <leader>db :!tmux split-window -l '40\%' 'python -m̀ pdb %'
diff --git a/stow/vim/.vim/ftplugin/vimwiki/vimwiki.vim b/stow/vim/.vim/ftplugin/vimwiki/vimwiki.vim
index b6c2e8f..d51844b 100644
--- a/stow/vim/.vim/ftplugin/vimwiki/vimwiki.vim
+++ b/stow/vim/.vim/ftplugin/vimwiki/vimwiki.vim
@@ -20,7 +20,7 @@ highlight Title ctermfg=blue
highlight TitleHash ctermfg=cyan
match TitleHash /^##*/
-setlocal conceallevel=1
+setlocal conceallevel=0
let mapleader = " "
diff --git a/stow/vim/.vim/rc/ale.vim b/stow/vim/.vim/rc/ale.vim
new file mode 100644
index 0000000..303a88e
--- /dev/null
+++ b/stow/vim/.vim/rc/ale.vim
@@ -0,0 +1,3 @@
+let g:ale_completion_enabled = 0
+
+Plug 'dense-analysis/ale'
diff --git a/stow/vim/.vim/rc/maps.vim b/stow/vim/.vim/rc/maps.vim
index cd83cf2..f51e3fa 100644
--- a/stow/vim/.vim/rc/maps.vim
+++ b/stow/vim/.vim/rc/maps.vim
@@ -16,7 +16,7 @@ nnoremap <leader>d "+dd
vnoremap <leader>d "+d
nnoremap <leader>vrc :80vsp ~/.vimrc<CR>
-nnoremap <leader>S :!tmux split-window -l '40\%'<CR><CR>
+nnoremap <leader>s :!tmux split-window -l '40\%'<CR><CR>
" Split navigation
map <C-h> <C-w>h
diff --git a/stow/vim/.vim/rc/nvim-jdtls.vim b/stow/vim/.vim/rc/nvim-jdtls.vim
new file mode 100644
index 0000000..e1f6517
--- /dev/null
+++ b/stow/vim/.vim/rc/nvim-jdtls.vim
@@ -0,0 +1,3 @@
+Plug 'mfussenegger/nvim-jdtls'
+
+