hanschen / vim-ipython-cell

Seamlessly run Python code in IPython from Vim
GNU General Public License v3.0
335 stars 18 forks source link

Lovely plugin! :) #17

Closed f1se4 closed 3 years ago

f1se4 commented 3 years ago

If you find interesting.. I have added this to my .vimrc

When I open any python file automatically my current work directory is changed to the opened file path, with this path, I could open ipython console in cwd. This helps me to read .csv path files, etc... without issues.

" Change automatically current directory to open file directory
autocmd BufEnter * silent! lcd %:p:h

" map to start ipython in current file directory
nnoremap st :execute 'SlimeSend1 cd 'fnameescape(expand('%:p:h')):execute 'SlimeSend1 clear':SlimeSend1 ipython3

hopes it helps to improve a llitle more :)

hanschen commented 3 years ago

Hey, thanks for the tip and nice words. :)

I've added your tip to the newly created wiki. Feel free to add more tips here!