Compare commits

..

2 commits

5 changed files with 87 additions and 96 deletions

2
vim/lua/config/coq.lua Normal file
View file

@ -0,0 +1,2 @@
require("coq")
vim.api.nvim_command("command COQ COQnow --shut-up")

View file

@ -1,6 +0,0 @@
xpcall(function()
require("coq")
vim.api.nvim_command("command COQ COQnow --shut-up")
end, function()
vim.api.nvim_command("command COQ echoerr 'COQ not loaded.'")
end)

View file

@ -41,7 +41,7 @@ use {
};
'folke/twilight.nvim';
'leafo/moonscript-vim';
'ms-jpq/coq_nvim';
{'ms-jpq/coq_nvim', config = require 'config.coq'};
'ms-jpq/coq.artifacts';
'ms-jpq/coq.thirdparty';
'neovim/nvim-lspconfig';

View file

@ -160,85 +160,6 @@ endfunction
command! -bar RangerChooser call RangeChooser()
" --- AUTO CLOSE ---
function! s:autoClose_HelperOpen(open, close)
let next_c = getline(".")[col(".")-1]
if match(next_c, "\s")
return a:open.a:close."\<Left>"
else
return a:open
end
endfunc
function! s:autoClose_HelperClose(open, close)
if getline(".")[col(".")-1] ==# a:close
return "\<Right>"
elseif getline(line(".")+1)
if match(getline(line(".")+1), "\M^\s*".escape(a:close, "\\"))
return "\<Down>\<Home>\<C-o>f".a:close."\<Right>"
end
else
return a:close
end
endfunc
function! s:autoClose_HelperDouble(open)
if getline(".")[col(".")-1] ==# a:open " Step over
return "\<Right>"
else
return a:open.a:open."\<left>"
end
endfunc
function! s:autoClose_HelperEnter()
if exists("b:autoClose_Pairs")
let next_c = getline(".")[col(".")-1]
let prev_c = getline(".")[col(".")-2]
if (next_c !=# "") && (prev_c !=# "")
if exists("b:autoClose_Pairs[prev_c]")
if (next_c ==# b:autoClose_Pairs[prev_c])
return "\<C-o>m'\<enter>\<C-o>`'\<enter>"
end
end
end
end
return "\<enter>"
endfunc
function! s:autoClose_HelperSpace()
if exists("b:autoClose_Pairs")
let next_c = getline(".")[col(".")-1]
let prev_c = getline(".")[col(".")-2]
if (next_c !=# "") && (prev_c !=# "")
if exists("b:autoClose_Pairs[prev_c]")
if (next_c ==# b:autoClose_Pairs[prev_c])
return "\<space>\<C-o>h\<space>"
end
end
end
end
return "\<space>"
endfunc
function! s:autoClose_AddPair(open, close)
if !exists("b:autoClose_Pairs")
let b:autoClose_Pairs = {}
end
let b:autoClose_Pairs[a:open] = a:close
if a:open!=#a:close
exe "inoremap <buffer> <expr> ".a:open." <SID>autoClose_HelperOpen('".a:open."', '".a:close."')"
exe "inoremap <buffer> <expr> ".a:close." <SID>autoClose_HelperClose('".a:open."', '".a:close."')"
else
exe "inoremap <buffer> <expr> ".a:open." <SID>autoClose_HelperDouble('".a:open."')"
end
inoremap <buffer> <expr> <enter> <SID>autoClose_HelperEnter()
inoremap <buffer> <expr> <space> <SID>autoClose_HelperSpace()
endfunc
function! MatchingLines(pattern)
let list = []
let pattern = a:pattern
@ -667,16 +588,6 @@ endif
" === FILETYPE SPECIFIC STUFF ===
" --- GENERIC STUFF ---
au BufNewFile,BufRead * :call <sid>init_generic_file()
function! s:init_generic_file()
call s:autoClose_AddPair("[", "]")
call s:autoClose_AddPair("(", ")")
call s:autoClose_AddPair("{", "}")
call s:autoClose_AddPair('"', '"')
endfunc
" --- VIMSCRIPT STUFF ---
au BufNewFile,BufRead *.vim,*vimrc :call <sid>init_vim_file()

84
vim/plugin/surround.vim Normal file
View file

@ -0,0 +1,84 @@
" ┌──────────┐
" │ Funtions │
" └──────────┘
function! s:vsurround(left, right)
if visualmode() ==# "v"
let l:type="char"
elseif visualmode() ==# "V"
let l:type="line"
elseif visualmode() ==# ""
let l:type="block"
end
call <SID>surround(l:type, a:left, a:right)
endf
function! s:surround(type, left, right)
if a:type ==? 'char'
exec 'normal! `>a'.a:right.'`<i'.a:left
elseif a:type ==? 'line'
exec 'normal! `<`>$A'.a:right.'`<`>I'.a:left
elseif a:type ==? 'block'
exec 'normal! `<`>A'.a:right.'`<`>I'.a:left
end
endf
" ┌──────────┐
" │ Mappings │
" └──────────┘
function! s:dquote_op(type)
normal `[m<`]m>
call <SID>surround(a:type, '"', '"')
endf
nnoremap <leader>" :<C-U>set operatorfunc=<SID>dquote_op<CR>g@
vnoremap <leader>" :<C-U>call <SID>vsurround('"', '"')<CR>
function! s:squote_op(type)
normal `[m<`]m>
call <SID>surround(a:type, "'", "'")
endf
nnoremap <leader>' :<C-U>set operatorfunc=<SID>squote_op<CR>g@
vnoremap <leader>' :<C-U>call <SID>vsurround("'", "'")<CR>
function! s:paren_op(type)
normal `[m<`]m>
call <SID>surround(a:type, "(", ")")
endf
nnoremap <leader>( :<C-U>set operatorfunc=<SID>paren_op<CR>g@
vnoremap <leader>( :<C-U>call <SID>vsurround("(", ")")<CR>
function! s:pracket_op(type)
normal `[m<`]m>
call <SID>surround(a:type, "[", "]")
endf
nnoremap <leader>[ :<C-U>set operatorfunc=<SID>bracket_op<CR>g@
vnoremap <leader>[ :<C-U>call <SID>vsurround("[", "]")<CR>
function! s:brace_op(type)
normal `[m<`]m>
call <SID>surround(a:type, "{", "}")
endf
nnoremap <leader>{ :<C-U>set operatorfunc=<SID>brace_op<CR>g@
vnoremap <leader>{ :<C-U>call <SID>vsurround("{", "}")<CR>
function! s:angle_op(type)
normal `[m<`]m>
call <SID>surround(a:type, "<", ">")
endf
nnoremap <leader>< :<C-U>set operatorfunc=<SID>angle_op<CR>g@
vnoremap <leader>< :<C-U>call <SID>vsurround("<", ">")<CR>
function! s:backtick_op(type)
normal `[m<`]m>
call <SID>surround(a:type, "`", "`")
endf
nnoremap <leader>` :<C-U>set operatorfunc=<SID>backtick_op<CR>g@
vnoremap <leader>` :<C-U>call <SID>vsurround("`", "`")<CR>
function! s:asterisk_op(type)
normal `[m<`]m>
call <SID>surround(a:type, "*", "*")
endf
nnoremap <leader>* :<C-U>set operatorfunc=<SID>asterisk_op<CR>g@
vnoremap <leader>* :<C-U>call <SID>vsurround("*", "*")<CR>