From e5c171ed29b44cc80a9ef0825dbd5c5f78abc561 Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Fri, 2 Jul 2021 20:22:51 +0100 Subject: nvim 0.5.0; etc --- README.md | 7 +++++-- autoload/plug.vim | 14 +++++++++----- vimrc | 14 ++++++++++---- 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 2003352..34a86ff 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,8 @@ # My ~/.vim -Managed by [vim-plug](https://github.com/junegunn/vim-plug) and compatible with -Neovim. +Managed by [vim-plug](https://github.com/junegunn/vim-plug). + +A few things require nvim 0.5.0 or later, but won't load if not possible. For further information on installed plugins: @@ -17,6 +18,8 @@ If you're not using vim 8; create a `.vimrc` with: runtime vimrc +And you may need to comment out some plugins that require nvim > 0.5.0. + This can be also be used to customise your local vim configuration without having uncommitted changes in your repository. diff --git a/autoload/plug.vim b/autoload/plug.vim index 2b89b5a..6a958cb 100644 --- a/autoload/plug.vim +++ b/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 @@ -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') @@ -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] @@ -984,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 @@ -2225,7 +2229,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) @@ -2277,7 +2281,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/vimrc b/vimrc index 8059d2e..f8b8eb5 100644 --- a/vimrc +++ b/vimrc @@ -49,7 +49,6 @@ Plug 'wincent/terminus' " life improvements Plug 'gruvbox-community/gruvbox' Plug 'scrooloose/nerdtree' -Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } Plug 'qpkorr/vim-bufkill' Plug 'Chiel92/vim-autoformat' Plug 'jsfaint/gen_tags.vim' @@ -59,13 +58,20 @@ Plug 'plasticboy/vim-markdown' Plug 'vimwiki/vimwiki' " language support -Plug 'natebosch/vim-lsc', { 'tag': 'v0.4.0' } +Plug 'natebosch/vim-lsc' Plug 'samsaga2/vim-z80' Plug 'tomtom/tcomment_vim' Plug 'https://tildegit.org/sloum/gemini-vim-syntax.git' Plug 'hrsh7th/vim-vsnip' Plug 'hrsh7th/vim-vsnip-integ' +" nvim 0.5.0 or later +if has('nvim-0.5') + Plug 'nvim-lua/popup.nvim' + Plug 'nvim-lua/plenary.nvim' + Plug 'nvim-telescope/telescope.nvim' +end + call plug#end() " crystaline conf @@ -138,8 +144,8 @@ au BufEnter,CursorHold,CursorHoldI * silent! checktime map n :NERDTreeToggle let NERDTreeQuitOnOpen=1 -" make easier to use FZF -map f :FZF +" make easier to use telescope +nnoremap f Telescope find_files "" gen_tags.vim (reguires GNU global, aka gtags) " disable ctags completely, use it through gtags plugin -- cgit v1.2.3