1
0
mirror of https://github.com/amix/vimrc synced 2025-07-07 00:15:00 +08:00

Add support for Elixir.

This commit is contained in:
Kurtis Moxley
2022-05-19 01:31:41 +08:00
parent 9e29fd54b4
commit d26bc75459
89 changed files with 6799 additions and 0 deletions

View File

@ -0,0 +1,24 @@
function! elixir#util#get_filename(word) abort
let word = a:word
" get first thing that starts uppercase, until the first space or end of line
let word = substitute(word,'^\s*\(\u[^ ]\+\).*$','\1','g')
" remove any trailing characters that don't look like a nested module
let word = substitute(word,'\.\U.*$','','g')
" replace module dots with slash
let word = substitute(word,'\.','/','g')
" remove any special chars
let word = substitute(word,'[^A-z0-9-_/]','','g')
" convert to snake_case
let word = substitute(word,'\(\u\+\)\(\u\l\)','\1_\2','g')
let word = substitute(word,'\(\u\+\)\(\u\l\)','\1_\2','g')
let word = substitute(word,'\(\l\|\d\)\(\u\)','\1_\2','g')
let word = substitute(word,'-','_','g')
let word = tolower(word)
return word
endfunction