A vim plugin that emulates all of the powerful IDE features of MATLAB in vim so you don't need to run the full GUI.
git clone https://mcol.xyz/code/vimlab
Log | Files | Refs | README | LICENSE

commit 95f463a9a5da636c450287d73af8b0ab2431b383
parent e1babb00b6ca0bd59e1213d31603592fa3d5d729
Author: mcol <mcol@posteo.net>
Date:   Sat, 15 Dec 2018 19:18:58 +0000

removed old vim-slime related code. Corrected a couple TmuxSendKeys to TmuxSendKeysEnter

Diffstat:
Mftplugin/matlab.vim | 51++++++++++-----------------------------------------
1 file changed, 10 insertions(+), 41 deletions(-)

diff --git a/ftplugin/matlab.vim b/ftplugin/matlab.vim @@ -35,16 +35,15 @@ let s:save_cpo = &cpo set cpo-=C -" map hash sign to percentage sign for easier commenting -inoremap <unique> <buffer> # % - +setlocal suffixesadd=.m +setlocal comments=:%>,:% setlocal fo+=croql -" comment format -setlocal comments=:%>,:% +" map hash sign to percentage sign for easier commenting +inoremap <unique> <buffer> # % " define text object for input argument to function -xnoremap <silent> ia :<C-u>normal! ?<space>\|(<CR>v/<space>\|) +"xnoremap <silent> ia :<C-u>normal! ?<space>\|(<CR>v/<space>\|) "------------------------------------------------------------------ @@ -166,6 +165,7 @@ endif if exists("loaded_matchit") let s:conditionalEnd = '\([-+{\*\:(\/]\s*\)\@<!\<end\>\(\s*[-+}\:\*\/)]\)\@!' let b:match_words = '\<classdef\>\|\<methods\>\|\<events\>\|\<properties\>\|\<if\>\|\<while\>\|\<for\>\|\<switch\>\|\<try\>\|\<function\>:' . s:conditionalEnd + unlet s:conditionalEnd endif @@ -216,43 +216,12 @@ endif "------------------------------------------------------------------ " Running code "------------------------------------------------------------------ -" This is mostly vim-slime stuff, but I've tried to use matlab's original key bindings - -" F9 will send paragraph or visual selection -"xmap <unique> <buffer> <silent> <F9> <Plug>SlimeRegionSend -"nmap <unique> <buffer> <silent> <F9> <Plug>SlimeParagraphSend -" -"" F8 will run current line -"nnoremap <unique> <buffer> <silent> <F8> :SlimeSend<CR> -" -"" F7 will run the current word -"nnoremap <unique> <buffer> <silent> <F7> :SlimeSend0(expand('<cword>'))<CR> -" -"" F4 will run the current section -"function! VimlabRunSection() -" try -" foldopen! -" catch -" endtry -" let l:top = search('%%\|\%^?', 'cbnW') -" let l:bottom = search('%%\|\%$', 'nW') -" if l:bottom < l:top -" " in this case, this was run on the last line -" let l:bottom = line('$') -" elseif l:bottom != line('$') -" " in this case, this is to prevent a folded section below from all being run -" let l:bottom = l:bottom - 1 -" endif -" execute l:top . "," . l:bottom . "SlimeSend" -"endfunction -"nnoremap <Plug>VimlabRunSection :call VimlabRunSection()<CR> -"nmap <unique> <buffer> <silent> <F4> <Plug>VimlabRunSection() " F2 will call script by title, so must be on matlab path -nnoremap <unique> <buffer> <silent> <F2> :call TmuxSendKeys(expand("%:r"))<CR> +nnoremap <unique> <buffer> <silent> <F2> :call TmuxSendKeysEnter(expand("%:r"))<CR> " Control-w will list variables in the current workspace -nnoremap <unique> <buffer> <silent> <C-w> :TmuxSendKeys who<CR> +nnoremap <unique> <buffer> <silent> <C-w> :TmuxSendKeysEnter who<CR> @@ -272,8 +241,8 @@ endfunction nnoremap <Plug>VimlabBreakpointAdd :silent! call VimlabBreakpointAdd()<CR> function! VimlabBreakpointRemove() - sign unplace - call TmuxSendKeysEnter('dbclear in ' . expand("%:p") . ' at ' . line(".")) + sign unplace + call TmuxSendKeysEnter('dbclear in ' . expand("%:p") . ' at ' . line(".")) endfunction nnoremap <Plug>VimlabBreakpointRemove :silent! call VimlabBreakpointRemove()<CR>