Commits

ont committed 0678e2c Merge

(><) merging with on-work .vimrc

  • Participants
  • Parent commits 09712b4, d15e792

Comments (0)

Files changed (1)

 nmap <C-l> gt
 nmap tn :tabe
 
-imap <F9> <Esc>:wa<CR>:!waf<CR>
-nmap <F9> :wa<CR>:!waf<CR>
+"imap <F9> <Esc>:wa<CR>:!waf<CR>
+"nmap <F9> :wa<CR>:!waf<CR>
+imap <F9> <Esc>:wa<CR>:!python2 %<CR>
+nmap <F9> :wa<CR>:!python2 %<CR>
 
 nmap <Leader>g :vimgrep<Space><C-r><C-w><Space>*.*\|:copen<CR>
 
 autocmd Filetype php :UltiSnipsAddFiletypes html
 
 
+" For security audit
+" TODO: it is easier to setup q-macroses
+"""""""""""""""""""""""""""""""""""""""""""
+python << PYTHON
+def modX_escape():
+    import vim
+    srow, scol = vim.current.buffer.mark('<')
+    erow, ecol = vim.current.buffer.mark('>')
+
+    cb = vim.current.buffer
+    srow -= 1
+    erow -= 1
+    ecol += 1
+
+    prefix = '$modx->db->escape('
+    suffix = ')'
+    if erow > srow:
+        ## take before and after start of selection
+        b,a =  cb[ srow ][ :scol ], cb[ srow ][ scol: ]
+        cb[ srow ] = b + prefix + a
+
+        ## take before and after end of selection
+        b,a =  cb[ erow ][ :ecol ], cb[ erow ][ ecol: ]
+        cb[ erow ] = b + suffix + a
+    else:
+        ## take before, inner and after
+        b,i,a =  cb[ srow ][ :scol ], cb[ srow ][ scol:ecol ], cb[ erow ][ ecol: ]
+        cb[ srow ] = b + prefix + i + suffix + a
+PYTHON
 
 "  FireFpx remote reloader
 """""""""""""""""""""""""""""