Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fast Switch between CoffeeScript and JavaScript Files in VIM

sadly I´m new to Vimscript and failed to write a function which switches from a .coffee file to the corresponding .js file.

I wonder if anyone already has done this?

I know there is the function :CoffeeCompile watch of the vim-coffee-script plugin but the file you see there is not the real you’ve stored locally.

It would be cool to have a function like this (if you store your .coffee and .js files in the same directory):

function! GoToJS()
  " get current file path in a string variable
  " change the .coffee extention to a .js extention
  " open the .js file
endfunction

Something like this would be really cool-

like image 324
Jakob Avatar asked Jul 22 '26 05:07

Jakob


1 Answers

Try the vim plugin a.vim. It's configurable. Add those to .vimrc:

let g:alternateExtensions_coffee = 'js'
let g:alternateExtensions_js = 'coffee'
like image 103
kev Avatar answered Jul 24 '26 04:07

kev



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!