neovim

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

init.lua (1259B)


      1 local snip = require('snippets')
      2 local U = require('snippets.utils')
      3 
      4 require('tms.p.snippets.utils')
      5 
      6 local M = {}
      7 
      8 M.setup = function()
      9   snip.use_suggested_mappings()
     10   snip.set_ux(require 'snippets.inserters.vim_input')
     11 
     12   snip.snippets = {
     13     _global = {
     14       date = os.date('%d.%m.%Y'),
     15       todo = U.force_comment [[TODO(${=io.popen("id -un"):read("*l")}) ${=os.date('%d.%m.%Y')}: ]],
     16       note = U.force_comment [[NOTE(${=io.popen("id -un"):read("*l")}): ]],
     17       bang = [[#!/usr/bin/env ${1}]],
     18       copyright = U.force_comment [[Copyright (C) Tomáš Němec ${=os.date("%Y")}]],
     19     },
     20     go = {bang = [[//usr/bin/go run \$0 \$@; exit \$?]]},
     21     dart = require('tms.p.snippets.dart'),
     22     html = require('tms.p.snippets.html'),
     23     lua = {
     24       req = [[local ${2:${1|S.v:match"([^.()]+)[()]*$"}} = require('$1')]],
     25       func = [[function${1|vim.trim(S.v):gsub("^%S"," %0")}(${2|vim.trim(S.v)})$0 end]],
     26       ['loc'] = [[local ${2:${1|S.v:match"([^.()]+)[()]*$"}} = ${1}]],
     27       ['for'] = U.match_indentation [[
     28 for ${1:i}, ${2:v} in ipairs(${3:t}) do
     29   $0
     30 end]],
     31       sl = [[{${2|create_list_of_strings(S.v)}}]],
     32       key = [[['${1}'] = $0]],
     33     },
     34     scss = {['v'] = [[var(--${1})]], ['ngif'] = [[*ngIf="${1}"]]},
     35   }
     36 end
     37 
     38 return M