neovim

Personal neovim configuration files
git clone git://gtms.dev:neovim
Log | Files | Refs

utils.lua (699B)


      1 function create_list_of_strings(input)
      2   local str = ''
      3   local function wrap_quotes(x) return '\'' .. x .. '\'' end
      4   for item, _ in input:gmatch('([%s%w%.%_]+),') do
      5     local str_end = (' '):rep(vim.bo.shiftwidth) .. wrap_quotes(item)
      6     if str == '' then
      7       str = str .. str_end
      8     else
      9       str = str .. ',' .. str_end
     10     end
     11   end
     12 
     13   return str
     14 end
     15 
     16 function camel_case(s)
     17   local upper = true
     18   local output = {}
     19   for c in string.gmatch(s, '.') do
     20     if c == '_' then
     21       upper = true
     22     else
     23       if upper then
     24         table.insert(output, c:upper())
     25         upper = false
     26       else
     27         table.insert(output, c)
     28       end
     29     end
     30   end
     31   return table.concat(output, '')
     32 end