aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCody Hiar <codyfh@gmail.com>2017-03-01 04:14:06 +0000
committerCody Hiar <codyfh@gmail.com>2017-03-01 04:14:06 +0000
commitf95311ce4de26cf2c2db14906410f55589fab0a8 (patch)
tree1b7ace85a73b6a2f9a9b920311a660c5b6537252
parent5fcd5c3ab60bde0d43367e4243512450a2f83091 (diff)
Adding some snippet functionality, reduce typing
-rw-r--r--plugin/vim-options.vim7
-rw-r--r--snippets/python/cutf8.py2
-rw-r--r--snippets/python/fabfile.py33
-rw-r--r--snippets/python/pudb.py1
-rw-r--r--snippets/python/pyclass.py5
-rw-r--r--snippets/python/pydef.py12
6 files changed, 60 insertions, 0 deletions
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 <leader>dd :diffget<CR>
nnoremap <leader>df :diffput<CR>
nnoremap _ [c
nnoremap = ]c
+" Snippets
+nnoremap <leader>,date :-1read !date +\%F<CR>
+nnoremap <leader>,fabfile :-1read $HOME/.config/nvim/plugged/vim-options/snippets/python/fabfile.py<CR>
+nnoremap <leader>,cutf8 :-1read $HOME/.config/nvim/plugged/vim-options/snippets/python/cutf8.py<CR>jf.i
+nnoremap <leader>,pudb :-1read $HOME/.config/nvim/plugged/vim-options/snippets/python/pudb.py<CR>V
+nnoremap <leader>,pydef :-1read $HOME/.config/nvim/plugged/vim-options/snippets/python/pydef.py<CR>/jump<CR>V11j
+nnoremap <leader>,pyclass :-1read $HOME/.config/nvim/plugged/vim-options/snippets/python/pyclass.py<CR>/jump<CR>
"-----------------------------------------------------------------------------------------------------------------------
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
+ """