I need to do python and js program at the same time.
And also, I have some language specific seetings located at the ~/.vim/after/ftplugin/ directory
Here I'll show you the content of these files:
In python.vim
set tabstop=4
set shiftwidth=4
set expandtab
set softtabstop=4
nnoremap Y :Autoformat<CR>
In my javascript.vim
nnoremap Y :call JsBeautify()<CR>
Imagine this scenery:
- Open a python file using vim
- Then open a js file in a new windown using
:split
- Now whenever I press Y
- Vim will call
JsBeautify
even if I'm editing the python file
That's not what I want
Now I'm wondering if there is a way to make vim work like this:
- Judge the filetype of the current window
- And source the specific *.vim file in accordance with the filetype from the ~/.vim/after/ftplugin/ directory
- Then in the above-mentioned scenery
- It will call
Autoformat
when I am editing the python file andJsBeautify()
when I am editing the js file
~