summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--autoload/plug.vim30
-rw-r--r--colors/bramwombat.vim6
-rw-r--r--dotvimrc93
3 files changed, 100 insertions, 29 deletions
diff --git a/autoload/plug.vim b/autoload/plug.vim
index c1657f2..b6e4cbf 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]
@@ -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/colors/bramwombat.vim b/colors/bramwombat.vim
index a5882a9..c56e6d7 100644
--- a/colors/bramwombat.vim
+++ b/colors/bramwombat.vim
@@ -1,5 +1,5 @@
" Maintainer: Matthias P. Braendli
-" Last Change: Wed 7 Jan 10:32:28 CET 2015
+" Last Change: 2021-11-24
set background=dark
@@ -58,6 +58,10 @@ hi Special guifg=#e7f6da gui=none
hi GlobalVariable guifg=#f6f3e8 gui=none
hi LocalVariable guifg=#f6f3e8 gui=none
+hi LspDiagnosticsDefaultError guifg=#7d5d5d gui=none
+hi LspDiagnosticsDefaultWarning guifg=#4d4d4d gui=none
+hi LspDiagnosticsDefaultHint guifg=#4d4d4d gui=none
+
hi DiffAdd gui=none guibg=#000087
hi DiffChange gui=none guibg=#5f5f00
hi DiffDelete gui=none guibg=#5f0000 guifg=#5f5f00
diff --git a/dotvimrc b/dotvimrc
index 389f41b..1c32a3a 100644
--- a/dotvimrc
+++ b/dotvimrc
@@ -1,6 +1,9 @@
set nocompatible
syn on
+set maxmempattern=32000
+" because https://github.com/vim/vim/issues/6777#issuecomment-684776825
+
" Because Konsole font size
" https://github.com/neovim/neovim/issues/6798
set guicursor=
@@ -17,6 +20,7 @@ set pastetoggle=<F10>
set textwidth=120
set backspace=eol,indent,start
set number
+set signcolumn=yes
"set mouse=a "Disabled
"set grepprg=grep\ -nH\ $*
set grepprg=rg\ --vimgrep\ $*
@@ -40,6 +44,7 @@ set guioptions-=T
" remove menu
set guioptions-=m
+
set formatoptions+=j " Delete comment character when joining commented lines
set history=1000
@@ -60,29 +65,78 @@ Plug 'scrooloose/nerdtree'
Plug 'majutsushi/tagbar'
Plug 'vim-scripts/taglist.vim'
Plug 'tpope/vim-fugitive'
-call plug#end()
+Plug 'https://gitlab.com/Nate_B/vim-adif'
-"Plug 'CoatiSoftware/vim-sourcetrail'
-"nnoremap <leader>sr :SourcetrailRefresh<CR>
-"nnoremap <leader>sa :SourcetrailActivateToken<CR>
-
-set runtimepath+=~/.vim/LanguageClient-neovim
-" Required for operations modifying multiple buffers like rename.
+if has("nvim")
+ Plug 'neovim/nvim-lspconfig'
+endif
-let g:LanguageClient_serverCommands = {
- \ 'rust': ['rust-analyzer'],
- \ 'python': ['pyls'],
- \ 'cpp': ['clangd'],
- \ 'c': ['clangd'] }
+"Plug 'neoclide/coc.nvim', {'branch': 'release'}
+call plug#end()
-let g:LanguageClient_useVirtualText = "No"
-let g:LanguageClient_autoStart = 0
+" dotnet tool install -g csharp-ls
-nnoremap <F8> :call LanguageClient_contextMenu()<CR>
-nnoremap <silent> gd :call LanguageClient#textDocument_definition()<CR>
-nnoremap <silent> <F2> :call LanguageClient#textDocument_rename()<CR>
+if has("nvim")
+ lua << EOF
+ local nvim_lsp = require('lspconfig')
+
+ -- For debugging, use :LspInfo
+ --vim.lsp.set_log_level("debug")
+ -- Retrieve logs using :lua vim.cmd('e'..vim.lsp.get_log_path())
+
+ vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
+ vim.lsp.diagnostic.on_publish_diagnostics, {
+ signs = false,
+ }
+ )
+
+ -- Use an on_attach function to only map the following keys
+ -- after the language server attaches to the current buffer
+ local on_attach = function(client, bufnr)
+ local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
+ local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
+
+ -- Enable completion triggered by <c-x><c-o>
+ buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
+
+ -- Mappings.
+ local opts = { noremap=true, silent=true }
+
+ -- See `:help vim.lsp.*` for documentation on any of the below functions
+ buf_set_keymap('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts)
+ buf_set_keymap('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts)
+ --buf_set_keymap('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts)
+ buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
+ --buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
+ --buf_set_keymap('n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
+ --buf_set_keymap('n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
+ --buf_set_keymap('n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
+ --buf_set_keymap('n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
+ buf_set_keymap('n', '<space>r', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
+ buf_set_keymap('n', '<space>c', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
+ buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
+ buf_set_keymap('n', '<space>e', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>', opts)
+ buf_set_keymap('n', '[d', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts)
+ buf_set_keymap('n', ']d', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts)
+ buf_set_keymap('n', '<space>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts)
+ buf_set_keymap('n', '<space>F', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts)
+
+ end
+
+ -- Use a loop to conveniently call 'setup' on multiple servers and
+ -- map buffer local keybindings when the language server attaches
+ local servers = { 'clangd', 'rust_analyzer', 'pylsp', 'csharp_ls', 'tsserver' }
+ for _, lsp in ipairs(servers) do
+ nvim_lsp[lsp].setup {
+ on_attach = on_attach,
+ flags = {
+ debounce_text_changes = 150,
+ }
+ }
+ end
+EOF
+endif
-set completefunc=LanguageClient#complete
if executable('rg')
let g:ackprg = "rg -ui --vimgrep"
@@ -240,7 +294,6 @@ endpython
endfun
noremap <F4> :call MPB_Flip_Ext()<CR>
-noremap <Leader>f :call MPB_Flip_Ext()<CR>
" Added for QSO logging
function! MPB_Prepend_Time()
@@ -312,7 +365,7 @@ noremap ]h :GitGutterNextHunk<CR>
"GIT stuff
noremap <Leader>gt :call TimeLapse()<cr>
-noremap <Leader>gb :Gblame<cr>
+noremap <Leader>gb :Git blame<cr>
noremap <Leader>e :NERDTreeToggle<CR>