1
0
mirror of https://github.com/gryf/.vim.git synced 2025-12-17 11:30:29 +01:00

Exchange UltiSnips with old snipmate.

I'm not very heavy user of snippets. UltiSnips lately dropped support
for python2, yet I'm using some machines with old OSes, which complain a
lot during boostrapping my vimrc, so I was started to look for a simpler
replacement. Finally decided on a (slightly modified) original snipmate.
This commit is contained in:
2020-02-18 21:15:15 +01:00
parent b50b721562
commit c6560ce397
13 changed files with 87 additions and 370 deletions

View File

@@ -1,31 +0,0 @@
snippet date "Current date"
`!v strftime("%Y-%m-%d")`
endsnippet
snippet datetime "Current datetime"
`!v strftime("%Y-%m-%d %H:%M:%S")`
endsnippet
snippet - "a dash, used for concatenating words"
endsnippet
snippet ~ "shy, used for hyphenation hints"
­
endsnippet
snippet fn "filename"
`!v expand("%")`
endsnippet
snippet fp "full path filename"
`!v expand("%:p")`
endsnippet
snippet uuid "UUID" !b
`!p import uuid
if not snip.c:
snip.rv = str(uuid.uuid4())`
endsnippet
# vim:ft=snippets:

View File

@@ -1,33 +0,0 @@
snippet dbg "put debugger line"
debugger;
endsnippet
snippet ass "console assert abbrv"
console.assert(${1:condition}, ${2:})${3:};
endsnippet
snippet log "console log abbrv"
console.log('${1:text_msg}'${2:, value})${3:};
endsnippet
snippet debug "console debug abbrv"
console.debug('${1:text_msg}'${2:, value})${3:};
endsnippet
snippet info "console info abbrv"
console.info('${1:text_msg}'${2:, value})${3:};
endsnippet
snippet warn "console warn abbrv"
console.warn('${1:text_msg}'${2:, value})${3:};
endsnippet
snippet tbl "console log in table manner"
console.table('${1:text_msg}'${2:, obj})${3:};
endsnippet
snippet str "use strict" !b
"use strict";
endsnippet
# vim:ft=snippets:

View File

@@ -1,57 +0,0 @@
snippet dbg "IPython Debugger abbrv" !b
__import__('pdb').set_trace()
endsnippet
snippet ripdb "Remote ipdb abbrv" !b
__import__('ripdb').set_trace()
endsnippet
snippet ipdb "pdb abbrv" !b
__import__('ipdb').set_trace()
endsnippet
snippet docmodule "Doc module" !b
"""
Project: ${1:pyGTKtalog}
Description: ${2:Tests for DataBase class.}
Type: ${3:test}
Author: ${4:Roman 'gryf' Dobosz, gryf73@gmail.com}
Created: ${5:`strftime("%Y-%m-%d %H:%M:%S")`}
"""
endsnippet docmodule
snippet debug "Logging debug message"
LOG.debug(self.${1:method_name}.__doc__.strip())
endsnippet
snippet pywin "PyWin debugger"
import pywin.debugger; pywin.debugger.set_trace()
endsnippet
snippet rpdb "remote_pdb debbuger"
__import__('remote_pdb').set_trace()
endsnippet
snippet edbg "Eclipse debbuger"
import sys
pydevdPath = r"/home/share/data/IDE/eclipse/plugins/org.python.pydev.debug_1.6.5.2011020317/pysrc"
if not pydevdPath in sys.path:
sys.path.append(pydevdPath)
import pydevd
pydevd.settrace()
endsnippet
snippet msg "Tk graphical message"
from Tkinter import Tk
import ttk
import tkMessageBox
window = Tk()
window.wm_withdraw() # make window invisible. we only want message boxes
ttk.Style().theme_use('clam')
tkMessageBox.showinfo(title="${1:title}", message="${2:msg}", parent=window)
endsnippet
snippet _ "Dunder completion"
__${1:init}__$0
endsnippet
# vim:ft=snippets:

View File

@@ -1,130 +0,0 @@
snippet author
:Author: ${1:}|${2:file-as}|${3:aut}
endsnippet
snippet creator
:Creator: ${1:}|${2:file-as}|${3:aut}
endsnippet
snippet contributor
:Contributor: ${1:}|${2:file-as}|${3:ill}
endsnippet
snippet organization
:Organization: ${1:}
endsnippet
snippet address
:Address: ${1:}
endsnippet
snippet contact
:Contact: ${1:}
endsnippet
snippet version
:Version: ${1:}
endsnippet
snippet revision
:Revision: ${1:}
endsnippet
snippet status
:Status: ${1:}
endsnippet
snippet copyright
:Copyright: ${1:}
endsnippet
snippet rights "reST tag"
:Rights: ${1:}
endsnippet
snippet type
:Type: ${1:}
endsnippet
snippet language
:Language: ${1:en}
endsnippet
snippet title
:Title: ${1:title}
endsnippet
snippet Description
:Description: ${1:}
endsnippet
snippet publisher
:Publisher: ${1:}
endsnippet
snippet pubdate
:Date: ${1:2001-02-01}
endsnippet
snippet format
:Format: ${1:}
endsnippet
snippet identifier
:Identifier: ${1:}
endsnippet
snippet source
:Source: ${1:}
endsnippet
snippet relation
:Relation: ${1:}
endsnippet
snippet coverage
:Coverage: ${1:}
endsnippet
snippet rights
:Rights: ${1:}
endsnippet
snippet subject
:Subject: ${1:}
endsnippet
snippet code
.. code:: ${1:python}
:cssclass: ${2:wombat}
${3::linenos:} ${4:1}
${5:}
endsnippet
snippet figure
.. figure:: ${1:image.png}
:target: ${1:}
:alt: ${2:description}
:figclass: ${3:custclass}
${2:}
endsnippet
snippet article
:Title: ${1:Blog post title}
:Date: ${2:`!v strftime("%Y-%m-%d %H:%M:%S")`}
:Modified: ${3:}
:Tags: ${4:blogtag1, blogtag2}
${5:}
.. more
endsnippet
snippet raw
.. raw:: html
${1:}
endsnippet

View File

@@ -1,88 +0,0 @@
snippet #!
#!/usr/bin/python
snippet imp
import ${1:module}
# Module Docstring
snippet docs
'''
File: ${1:`Filename('$1.py', 'foo.py')`}
Author: ${2:`g:snips_author`}
Description: ${3}
'''
snippet wh
while ${1:condition}:
${2:# code...}
snippet for
for ${1:needle} in ${2:haystack}:
${3:# code...}
# New Class
snippet cl
class ${1:ClassName}(${2:object}):
"""${3:docstring for $1}"""
def __init__(self, ${4:arg}):
${5:super($1, self).__init__()}
self.$4 = $4
${6}
# New Function
snippet def
def ${1:fname}(${2:`indent('.') ? 'self' : ''`}):
"""${3:docstring for $1}"""
${4:pass}
snippet deff
def ${1:fname}(${2:`indent('.') ? 'self' : ''`}):
${3}
# New Method
snippet defs
def ${1:mname}(self, ${2:arg}):
${3:pass}
# New Property
snippet property
def ${1:foo}():
doc = "${2:The $1 property.}"
def fget(self):
${3:return self._$1}
def fset(self, value):
${4:self._$1 = value}
# Lambda
snippet ld
${1:var} = lambda ${2:vars} : ${3:action}
snippet .
self.
snippet try Try/Except
try:
${1:pass}
except ${2:Exception}, ${3:e}:
${4:raise $3}
snippet try Try/Except/Else
try:
${1:pass}
except ${2:Exception}, ${3:e}:
${4:raise $3}
else:
${5:pass}
snippet try Try/Except/Finally
try:
${1:pass}
except ${2:Exception}, ${3:e}:
${4:raise $3}
finally:
${5:pass}
snippet try Try/Except/Else/Finally
try:
${1:pass}
except ${2:Exception}, ${3:e}:
${4:raise $3}
else:
${5:pass}
finally:
${6:pass}
# if __name__ == '__main__':
snippet ifmain
if __name__ == '__main__':
${1:main()}
# __magic__
snippet _
__${1:init}__${2}
snippet dbg
import pywin.debugger; pywin.debugger.set_trace()

View File

@@ -1,29 +0,0 @@
snippet li "Item in itemize list"
\item ${VISUAL}$0
endsnippet
snippet lst "Code Listing for listings package" !b
\begin{lstlisting}
${VISUAL}$0
\end{lstlisting}
endsnippet
snippet hrefoot "Make hyper ref with footnote"
\href{$2}{${VISUAL}${1:name}}\footnote{\url{${2:url}}}.$0
endsnippet
snippet href "Make hyperlink"
\href{$2}{${VISUAL}${1:name}}.$0
endsnippet
snippet subsec "Subsection" !b
\subsection{${VISUAL}${1:name}}$0
endsnippet
snippet sss "Sub subsection" !b
\subsubsection{${VISUAL}${1:name}}$0
endsnippet
snippet tt "Make text monospaced"
\texttt{${VISUAL}}$0
endsnippet

14
snippets/_.snippets Normal file
View File

@@ -0,0 +1,14 @@
snippet date Current date
`strftime("%Y-%m-%d")`
snippet datetime Current datetime
`strftime("%Y-%m-%d %H:%M:%S")`
snippet - a dash, used for concatenating words
snippet ~ shy, used for hyphenation hints
­
snippet fn filename
`expand("%")`
snippet fp full path
`expand("%:p")`
snippet uuid
`system("python -c 'import uuid; print(uuid.uuid4())'")`

View File

@@ -10,4 +10,3 @@ snippet xhtml
${2:end} ${2:end}
</body> </body>
</head> </head>
endsnippet

View File

@@ -0,0 +1,2 @@
snippet dbg
debugger;

35
snippets/python.snippets Normal file
View File

@@ -0,0 +1,35 @@
snippet #!
#!/usr/bin/env python
snippet #!2
#!/usr/bin/env python2
# coding: utf-8
snippet utf
# coding: utf-8
snippet #!3
#!/usr/bin/env python3
snippet dbg Python Debugger abbrv
__import__('pdb').set_trace()
snippet ipdb ipdb abbrv
__import__('ipdb').set_trace()
snippet rpdb remote_pdb debbuger
__import__('remote_pdb').set_trace()
snippet msg Tk graphical message
from Tkinter import Tk
import ttk
import tkMessageBox
window = Tk()
window.wm_withdraw() # make window invisible. we only want message boxes
ttk.Style().theme_use('clam')
tkMessageBox.showinfo(title="${1:title}",
message="${2:msg}",
parent=window)
snippet _ Dunder completion
__${1:init}__$0

33
snippets/rst.snippets Normal file
View File

@@ -0,0 +1,33 @@
snippet dbg
debugger;
snippet code
.. code:: ${1:python}
:cssclass: ${2:wombat}
${3::linenos:} ${4:1}
${5:}
snippet figure
.. figure:: ${1:image.png}
:target: ${1:}
:alt: ${2:description}
:figclass: ${3:custclass}
${2:}
snippet article
:Title: ${1:Blog post title}
:Date: ${2:`!v strftime("%Y-%m-%d %H:%M:%S")`}
:Modified: ${3:}
:Tags: ${4:blogtag1, blogtag2}
${5:}
.. more
snippet raw
.. raw:: html
${1:}

2
snippets/tex.snippet Normal file
View File

@@ -0,0 +1,2 @@
snippet hrefoot
\href{$2}{${1:name}}\footnote{\url{${2:url}}}

2
vimrc
View File

@@ -11,7 +11,6 @@ endif
call plug#begin('~/.vim/bundle') call plug#begin('~/.vim/bundle')
Plug 'SirVer/ultisnips'
Plug 'Valloric/MatchTagAlways' Plug 'Valloric/MatchTagAlways'
Plug 'andymass/vim-matchup' Plug 'andymass/vim-matchup'
Plug 'ayuanx/vim-mark-standalone' Plug 'ayuanx/vim-mark-standalone'
@@ -26,6 +25,7 @@ Plug 'gryf/pylint-vim', { 'for': 'python' }
Plug 'gryf/python-syntax', { 'for': 'python' } Plug 'gryf/python-syntax', { 'for': 'python' }
Plug 'gryf/python.vim', { 'for': 'python' } Plug 'gryf/python.vim', { 'for': 'python' }
Plug 'gryf/pythonhelper', { 'for': 'python' } Plug 'gryf/pythonhelper', { 'for': 'python' }
Plug 'gryf/snipmate.vim'
Plug 'gryf/vim-latex-compiler' Plug 'gryf/vim-latex-compiler'
Plug 'gryf/wombat256grf' Plug 'gryf/wombat256grf'
Plug 'gryf/zoom.vim' Plug 'gryf/zoom.vim'