jpalardy / vim-slime

A vim plugin to give you some slime. (Emacs)
http://technotales.wordpress.com/2007/10/03/like-slime-for-vim/
MIT License
1.87k stars 227 forks source link

Is there a way , let slime automatic knew the "language" we use. #351

Closed brucejuz closed 1 year ago

brucejuz commented 1 year ago

I have set the slime automatic start the interpreter as this

let g:slime_target = "vimterminal"
let g:slime_vimterminal_cmd = "scheme"
let g:slime_vimterminal_config = {"term_finish": "close", "vertical": 1}

so each time I send a line, it will automatic open a window, run "scheme" and the line.

Is there a way, slime can know the language I use, so when I use "R", it will open "R", or when I use "Python", it will open "Python", or "C"... automatically.

Thanks a lot! By the way this plugin helps a lot!

jpalardy commented 1 year ago

Hi @brucejuz

You can try the &ft (filetype) variable, which reflects the type of file vim thinks you've got open.

Let me know how that goes 👍

brucejuz commented 1 year ago

I add these line to my vimrc

autocmd Filetype scheme let g:slime_vimterminal_cmd = "scheme"
autocmd Filetype python let g:slime_vimterminal_cmd = "**python3**"

Now, when I open .py, send a line, it will open python automatically; if I open .scm, send a line then it will open scheme. Nice:)

But in python, it must set cmd to "python3"; set cmd to "python" just does not work in vim-slime, even though in my terminal when I input "python", it can open python.

Thanks a lot!

brucejuz commented 1 year ago

I add these line to my vimrc

autocmd Filetype scheme let g:slime_vimterminal_cmd = "scheme"
autocmd Filetype python let g:slime_vimterminal_cmd = "**python3**"

Now, when I open .py, send a line, it will open python automatically; if I open .scm, send a line then it will open scheme. Nice:)

But in python, it must set cmd to "python3"; set cmd to "python" just does not work in vim-slime, even though in my terminal when I input "python", it can open python.

Thanks a lot!

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.