aboutsummaryrefslogtreecommitdiffstats
path: root/nvim
diff options
context:
space:
mode:
authorPeter Son Struschka <me@peter-struschka.com>2020-08-30 20:56:36 +0800
committerPeter Son Struschka <me@peter-struschka.com>2020-08-30 20:58:04 +0800
commit37dd411698bd6eae8365260dde39b8ae9c7cbd36 (patch)
tree978dd6ea3e72a86e4a3e0314b86d5137fc394785 /nvim
parenta1d6fc2f3e6ab041cc51cb085ac59a646a126d25 (diff)
downloaddotfiles-37dd411698bd6eae8365260dde39b8ae9c7cbd36.tar.gz
dotfiles-37dd411698bd6eae8365260dde39b8ae9c7cbd36.tar.bz2
dotfiles-37dd411698bd6eae8365260dde39b8ae9c7cbd36.tar.lz
dotfiles-37dd411698bd6eae8365260dde39b8ae9c7cbd36.tar.xz
dotfiles-37dd411698bd6eae8365260dde39b8ae9c7cbd36.tar.zst
dotfiles-37dd411698bd6eae8365260dde39b8ae9c7cbd36.zip
all: overhaul, move dotfile specifics to .local/share/dotfiles and more
Diffstat (limited to 'nvim')
-rw-r--r--nvim/.config/nvim/autoload/plug.vim60
-rw-r--r--nvim/.config/nvim/init.vim17
l---------nvim/.local/share/dotfiles/edit-config.d/nvim1
3 files changed, 64 insertions, 14 deletions
diff --git a/nvim/.config/nvim/autoload/plug.vim b/nvim/.config/nvim/autoload/plug.vim
index 25be27f..7914bfe 100644
--- a/nvim/.config/nvim/autoload/plug.vim
+++ b/nvim/.config/nvim/autoload/plug.vim
@@ -179,7 +179,7 @@ function! s:define_commands()
endif
if has('win32')
\ && &shellslash
- \ && (&shell =~# 'cmd\.exe' || &shell =~# 'powershell\.exe')
+ \ && (&shell =~# 'cmd\(\.exe\)\?$' || &shell =~# 'powershell\(\.exe\)\?$')
return s:err('vim-plug does not support shell, ' . &shell . ', when shellslash is set.')
endif
if !has('nvim')
@@ -419,7 +419,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 &shell =~# 'powershell\(\.exe\)\?$'
let cmd = '& ' . cmd
endif
return [batchfile, cmd]
@@ -632,17 +632,39 @@ function! plug#(repo, ...)
let g:plugs[name] = spec
let s:loaded[name] = get(s:loaded, name, 0)
catch
- return s:err(v:exception)
+ return s:err(repo . ' ' . v:exception)
endtry
endfunction
function! s:parse_options(arg)
let opts = copy(s:base_spec)
let type = type(a:arg)
+ let opt_errfmt = 'Invalid argument for "%s" option of :Plug (expected: %s)'
if type == s:TYPE.string
+ if empty(a:arg)
+ throw printf(opt_errfmt, 'tag', 'string')
+ endif
let opts.tag = a:arg
elseif type == s:TYPE.dict
call extend(opts, a:arg)
+ for opt in ['branch', 'tag', 'commit', 'rtp', 'dir', 'as']
+ if has_key(opts, opt)
+ \ && (type(opts[opt]) != s:TYPE.string || empty(opts[opt]))
+ throw printf(opt_errfmt, opt, 'string')
+ endif
+ endfor
+ for opt in ['on', 'for']
+ if has_key(opts, opt)
+ \ && type(opts[opt]) != s:TYPE.list
+ \ && (type(opts[opt]) != s:TYPE.string || empty(opts[opt]))
+ throw printf(opt_errfmt, opt, 'string or list')
+ endif
+ endfor
+ if has_key(opts, 'do')
+ \ && type(opts.do) != s:TYPE.funcref
+ \ && (type(opts.do) != s:TYPE.string || empty(opts.do))
+ throw printf(opt_errfmt, 'do', 'string or funcref')
+ endif
if has_key(opts, 'dir')
let opts.dir = s:dirpath(s:plug_expand(opts.dir))
endif
@@ -868,9 +890,9 @@ function! s:chsh(swap)
set shell=sh
endif
if a:swap
- if &shell =~# 'powershell\.exe' || &shell =~# 'pwsh$'
+ if &shell =~# 'powershell\(\.exe\)\?$' || &shell =~# 'pwsh$'
let &shellredir = '2>&1 | Out-File -Encoding UTF8 %s'
- elseif &shell =~# 'sh' || &shell =~# 'cmd\.exe'
+ elseif &shell =~# 'sh' || &shell =~# 'cmd\(\.exe\)\?$'
set shellredir=>%s\ 2>&1
endif
endif
@@ -2106,9 +2128,9 @@ function! plug#shellescape(arg, ...)
let opts = a:0 > 0 && type(a:1) == s:TYPE.dict ? a:1 : {}
let shell = get(opts, 'shell', s:is_win ? 'cmd.exe' : 'sh')
let script = get(opts, 'script', 1)
- if shell =~# 'cmd\.exe'
+ if shell =~# 'cmd\(\.exe\)\?$'
return s:shellesc_cmd(a:arg, script)
- elseif shell =~# 'powershell\.exe' || shell =~# 'pwsh$'
+ elseif shell =~# 'powershell\(\.exe\)\?$' || shell =~# 'pwsh$'
return s:shellesc_ps1(a:arg)
endif
return s:shellesc_sh(a:arg)
@@ -2160,7 +2182,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 &shell =~# 'powershell\(\.exe\)\?$'
let cmd = '& ' . cmd
endif
else
@@ -2249,7 +2271,7 @@ endfunction
function! s:rm_rf(dir)
if isdirectory(a:dir)
- call s:system(s:is_win
+ return s:system(s:is_win
\ ? 'rmdir /S /Q '.plug#shellescape(a:dir)
\ : ['rm', '-rf', a:dir])
endif
@@ -2333,6 +2355,7 @@ endfunction
function! s:delete(range, force)
let [l1, l2] = a:range
let force = a:force
+ let err_count = 0
while l1 <= l2
let line = getline(l1)
if line =~ '^- ' && isdirectory(line[2:])
@@ -2341,11 +2364,22 @@ function! s:delete(range, force)
let answer = force ? 1 : s:ask('Delete '.line[2:].'?', 1)
let force = force || answer > 1
if answer
- call s:rm_rf(line[2:])
+ let err = s:rm_rf(line[2:])
setlocal modifiable
- call setline(l1, '~'.line[1:])
- let s:clean_count += 1
- call setline(4, printf('Removed %d directories.', s:clean_count))
+ if empty(err)
+ call setline(l1, '~'.line[1:])
+ let s:clean_count += 1
+ else
+ delete _
+ call append(l1 - 1, s:format_message('x', line[1:], err))
+ let l2 += len(s:lines(err))
+ let err_count += 1
+ endif
+ let msg = printf('Removed %d directories.', s:clean_count)
+ if err_count > 0
+ let msg .= printf(' Failed to remove %d directories.', err_count)
+ endif
+ call setline(4, msg)
setlocal nomodifiable
endif
endif
diff --git a/nvim/.config/nvim/init.vim b/nvim/.config/nvim/init.vim
index bdf1e4c..7f66a49 100644
--- a/nvim/.config/nvim/init.vim
+++ b/nvim/.config/nvim/init.vim
@@ -22,7 +22,7 @@ Plug 'mileszs/ack.vim'
Plug 'terryma/vim-multiple-cursors'
-Plug 'w0rp/ale'
+Plug 'dense-analysis/ale'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'lyuts/vim-rtags'
@@ -62,6 +62,9 @@ let g:gruvbox_undercurl=1
let g:gruvbox_contrast_dark="soft"
colorscheme gruvbox
+" transparent bg
+highlight Normal ctermbg=none
+
"esc
imap jk <Esc>
@@ -90,6 +93,18 @@ set timeoutlen=500
map <leader>ff :Files<CR>
map <leader>fp :CtrlP<CR>
+" Disable Arrow keys in Normal mode
+map <up> <nop>
+map <down> <nop>
+map <left> <nop>
+map <right> <nop>
+
+" Disable Arrow keys in Insert mode
+imap <up> <nop>
+imap <down> <nop>
+imap <left> <nop>
+imap <right> <nop>
+
map <leader>wh :wincmd h<CR>
map <leader>wj :wincmd j<CR>
map <leader>wk :wincmd k<CR>
diff --git a/nvim/.local/share/dotfiles/edit-config.d/nvim b/nvim/.local/share/dotfiles/edit-config.d/nvim
new file mode 120000
index 0000000..e59f7d2
--- /dev/null
+++ b/nvim/.local/share/dotfiles/edit-config.d/nvim
@@ -0,0 +1 @@
+../../../../.config/nvim/init.vim \ No newline at end of file