From 4096ea1373b31fffc81523a361e555d11d7251fd Mon Sep 17 00:00:00 2001 From: Urbain Vaes Date: Tue, 7 Apr 2020 12:19:33 +0200 Subject: Move function to plugin --- vim/.vimrc | 64 ++++++++++++-------------------------------------------------- 1 file changed, 12 insertions(+), 52 deletions(-) (limited to 'vim') diff --git a/vim/.vimrc b/vim/.vimrc index f4751a3..443a14d 100644 --- a/vim/.vimrc +++ b/vim/.vimrc @@ -579,56 +579,16 @@ nnoremap i lua vim.lsp.buf.implementation() nnoremap s lua vim.lsp.buf.signature_help() nnoremap t lua vim.lsp.buf.type_definition() -" inoremap :call remembrall#remind('i', '') -" nnoremap Remembrall('') -" nnoremap h :call lsp#text_document_hover() -" nnoremap a :call lsp#text_document_declaration() -" nnoremap d :call lsp#text_document_definition() -" nnoremap i :call lsp#text_document_implementation() -" nnoremap s :call lsp#text_document_signature_help() -" nnoremap t :call lsp#text_document_type_definition() - -" https://stackoverflow.com/questions/1533565/how-to-get-visually-selected-text-in-vimscript -function! GetSelection(m1, m2) - let lines = getline(line_start, line_end) - " if len(lines) == 0 - " return '' - " endif - " echom len(lines) - " echom line_start column_start line_end column_end - " echom lines[-1] - return join(lines, "\n") -endfunction - -function! Send_motion_or_selection(...) - let is_visual = (a:1 == "v" || a:1 == "V") - let char_wise = (a:1 == "char" || a:1 == "v") - let m1 = is_visual ? "'<" : "'[" - let m2 = is_visual ? "'>" : "']" - - let [line_start, column_start] = getpos(l:m1)[1:2] - let [line_end, column_end] = getpos(l:m2)[1:2] - let lines = getline(line_start, line_end) - if char_wise - let lines[0] = lines[0][column_start - 1:] - let offset = (&selection == 'inclusive' ? 1 : 2) - let lines[-1] = lines[-1][:column_end - offset] - endif - - noautocmd buffer term - norm G$ - set paste - let open_bracketed_paste = "\[200~" - let close_bracketed_paste = "\[201~" - let newline = "\" - put =open_bracketed_paste - let code = join(lines, "\n") - put =code - put =close_bracketed_paste - put =newline - set nopaste - buffer # -endfunction -nnoremap yr :set opfunc=Send_motion_or_selectiong@ -xnoremap R :call Send_motion_or_selection(visualmode()) +" function! Autocomplete() +" let [l, c] = [getline("."), col(".")] +" if l[c-5:c-2] == "cite" || l[c-4:c-2] == "ref" +" return "{\\" +" endif +" return "{" +" endfunction + +" augroup autocompletion +" autocmd! +" autocmd FileType tex inoremap { Autocomplete() +" augroup END -- cgit v1.2.3