From f95311ce4de26cf2c2db14906410f55589fab0a8 Mon Sep 17 00:00:00 2001 From: Cody Hiar Date: Wed, 1 Mar 2017 04:14:06 +0000 Subject: Adding some snippet functionality, reduce typing --- plugin/vim-options.vim | 7 +++++++ snippets/python/cutf8.py | 2 ++ snippets/python/fabfile.py | 33 +++++++++++++++++++++++++++++++++ snippets/python/pudb.py | 1 + snippets/python/pyclass.py | 5 +++++ snippets/python/pydef.py | 12 ++++++++++++ 6 files changed, 60 insertions(+) create mode 100644 snippets/python/cutf8.py create mode 100644 snippets/python/fabfile.py create mode 100644 snippets/python/pudb.py create mode 100644 snippets/python/pyclass.py create mode 100644 snippets/python/pydef.py diff --git a/plugin/vim-options.vim b/plugin/vim-options.vim index f7e0287..e76e377 100644 --- a/plugin/vim-options.vim +++ b/plugin/vim-options.vim @@ -151,6 +151,13 @@ nnoremap dd :diffget nnoremap df :diffput nnoremap _ [c nnoremap = ]c +" Snippets +nnoremap ,date :-1read !date +\%F +nnoremap ,fabfile :-1read $HOME/.config/nvim/plugged/vim-options/snippets/python/fabfile.py +nnoremap ,cutf8 :-1read $HOME/.config/nvim/plugged/vim-options/snippets/python/cutf8.pyjf.i +nnoremap ,pudb :-1read $HOME/.config/nvim/plugged/vim-options/snippets/python/pudb.pyV +nnoremap ,pydef :-1read $HOME/.config/nvim/plugged/vim-options/snippets/python/pydef.py/jumpV11j +nnoremap ,pyclass :-1read $HOME/.config/nvim/plugged/vim-options/snippets/python/pyclass.py/jump "----------------------------------------------------------------------------------------------------------------------- diff --git a/snippets/python/cutf8.py b/snippets/python/cutf8.py new file mode 100644 index 0000000..fa3f8e5 --- /dev/null +++ b/snippets/python/cutf8.py @@ -0,0 +1,2 @@ +# -*- coding: utf-8 -*- +""".""" diff --git a/snippets/python/fabfile.py b/snippets/python/fabfile.py new file mode 100644 index 0000000..c519167 --- /dev/null +++ b/snippets/python/fabfile.py @@ -0,0 +1,33 @@ +"""Fabfile for automating some mundane tasks.""" +from fabric.api import cd, env, prefix, run + +# Use local SSH config +env.use_ssh_config = True + + +def prod(): + """Production host.""" + env.hosts = ['myserver'] + env.virtual_env = 'projname' + env.forward_agent = True + + +def prod_old(): + """Old way of defining.""" + env.user = 'cody' + env.hosts = ['123.123.123.123:1234'] + env.virtual_env = 'projname' + env.forward_agent = True + + +def deploy_virstualenv(): + """Deploy through virtualenv.""" + with prefix('workon {}'.format(env.virtual_env)): + run('deploy') + + +def deploy_git_folder(): + """Deploy the application.""" + with cd('www'): + run('git fetch origin master') + run('git reset --hard origin/master') diff --git a/snippets/python/pudb.py b/snippets/python/pudb.py new file mode 100644 index 0000000..80b65ef --- /dev/null +++ b/snippets/python/pudb.py @@ -0,0 +1 @@ +from pudb import set_trace; set_trace() diff --git a/snippets/python/pyclass.py b/snippets/python/pyclass.py new file mode 100644 index 0000000..07d0493 --- /dev/null +++ b/snippets/python/pyclass.py @@ -0,0 +1,5 @@ + class jump(jump): + """jump + + jump + """ diff --git a/snippets/python/pydef.py b/snippets/python/pydef.py new file mode 100644 index 0000000..a3d8224 --- /dev/null +++ b/snippets/python/pydef.py @@ -0,0 +1,12 @@ +def jump(jump): + """jump. + + jump + + Args: + jump (jump_type): jump_desc + Example: jump + + Return: + jump_type: jump_desc + """ -- cgit v1.2.3