-
Notifications
You must be signed in to change notification settings - Fork 3
/
renamecontroller.vim
32 lines (27 loc) · 941 Bytes
/
renamecontroller.vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
" Synopsis:
" Rename current controller along with corresponding files
function! RenameController()
try
let newcontroller = common#get_input("Controller name: ", "ERROR:: Enter a controller name." )
catch
echo v:exception
return
endtry
" Rename Rails Controller
" Rename controller filename
let path = common#get_controller_path()
let newcontrollerpath = path.common#controller(newcontroller)
let oldcontrollerpath = path.common#controller(split(common#get_file_name(), ".rb")[0])
call common#move(oldcontrollerpath, newcontrollerpath)
" Rename helper filename
let path = common#get_helper_path()
let newhelperpath = path.common#helper(newcontroller)
let oldhelperpath = path.common#helper(split(common#get_file_name(), ".rb")[0])
call common#move(oldcontrollerpath, newcontrollerpath)
"
" Rename views folder
"
" Rename helper Classname
"
" Rename Controller Classname
endfunction