EllisLab text mark
Advanced Search
1 of 2
1
   
Notepad++ Snippets
Posted: 20 November 2007 04:58 AM   [ Ignore ]
Avatar
Joined: 2007-07-30
2144 posts

I’ve recently become acquainted with Snippets thanks to giving eTextEditor and InType a try. Although the snippet functionality within these applications is much more powerful than the QuickText plugin provided with Notepad++ - those application just didn’t “feel” right.

So, I took some time out tonight to create a snippet file for myself. This doesn’t include every library within CodeIgniter - just the ones I use quite often.

If you would like to use these Snippets, copy-paste the text below at the top C:\Program Files\Notepad++\QuickText.ini file:

[1]
a
=<?anchor('$''$'); ?>
cfgitem
=\$this->config->item('$')
cfgset=\$this->config->set_item('$''$')
ci_c=class $ extends Controller {\n\n    function __construct() {\n        parent::Controller();\n    }\n\n    function index() {\n        $\n    }\n\n}
ci_m
=class $_m extends Model {\n\n    function __construct() {\n        parent::Model();\n    }\n\n    $\n\n}
dbcount
=\$this->db->count_all('$');
dbdelete=\$this->db->delete('$', array($));
dbfrom=\$this->db->from('$');
dbget=\$this->db->get('$');
dbgetwhere=\$this->db->getwhere('$', array($));
dbgroup=\$this->db->groupby(array($));
dbhaving=\$this->db->having(array($));
dbinsert=\$insert = array($);\n\n\$this->db->insert('$'\$insert);
dbjoin=\$this->db->join('$''$');
dblike=\$this->db->like(array($));
dblimit=\$this->db->limit($);
dborder=\$this->db->orderby('$');
dborlike=\$this->db->orlike(array($));
dborwhere=\$this->db->orwhere(array($));
dbselect=\$this->db->select('$');
dbset=\$this->db->set(array($));
dbupdate=\$update = array($);\n\n\$this->db->update('$'\$update);
dbwhere=\$this->db->where('$', array($));
e=echo '$';
email=\$msg = $;\n\n\$this->email->from('$''$');\n\$this->email->to('$');\n\$this->email->subject('$');\n\$this->email->message(\$msg);\n\$this->email->send();
f=function $($) {\n    $\n}
f_
=function _$($) {\n    $\n}
for=for ($, $, $) {\n    $\n}
foreach=foreach ($ as $) {\n    $\n}
form
=<?form_open('$'); ?>\n    $\n<?form_close(); ?>
formm
=<?form_open_multipart('$'); ?>\n    $\n<?form_close(); ?>
if=if ($) {\n    $\n}
ifelse
=if ($) {\n    $\n} else {\n    $\n}
ifelseif
=if ($) {\n    $\n} elseif ($) {\n    $\n} else {\n    $\n}
loadconfig
=\$this->load->config('$');
loadhelper=\$this->load->helper('$');
loadlang=\$this->load->lang('$');
loadlib=\$this->load->library('$');
loadplugin=\$this->load->plugin('$');
loadview=\$this->load->view('$');
md5=\$this->security->dohash('$''md5');
p?=<?= $; ?>
php
=<?php if (!defined('BASEPATH')) exit('No direct script access allowed');\n\n$\n\n?>
post
=\$this->input->post('$');
r=redirect('$');
sdata=\$this->input->session('$');
sha1=\$this->security->dohash('$');
ssetdata=\$this->session->set_userdata(array($));
switch=switch ($) 
{\n    case '$':\n        $\n    default:\n        $\n}
upload
=\$config['upload_path''$';\n\$config['allowed_types''$';\n\$this->load->library('upload''\$config');\n\nif ($this->upload->do_upload()) {\n    $\n} else {\n    $\n}
val
=if (\$this->validation->run()) {\n    $\n} else {\n    $\n}
valfield
=\$fields['$''$';
valrule=\$rules['$''$';
valsetfields=\$this->validation->set_fields(\$fields);
valsetrule=\$this->validation->set_rules(\$rules);
while=while ($) 
{\n    $\n} 


I was going to write out documentation for each of the shortcuts but it will take forever. Basically, review the text above - everything on the far left of the equal sign is the keyword, everything on the right is what will replace that keyword when you use the ctrl+enter combination.

I will be creating a PDF that can be printed out as a cheat sheet for these snippets. Once we have that and you spend some time with them and learn them, this should speed up your development significantly.

 Signature 

Follow me on twitter here.
MichaelWales.com | MichaelWales.info

 
Posted: 20 November 2007 05:23 AM   [ Ignore ]   [ # 1 ]   [ Rating: 0 ]
Joined: 2006-07-14
4237 posts

Maybe you can add the html doctype too wink

 
Posted: 20 November 2007 05:39 AM   [ Ignore ]   [ # 2 ]   [ Rating: 0 ]
Avatar
Joined: 2007-06-07
690 posts

haha I was working on the same exact thing for vim two days ago, you’ve got quite a few more though, thanks for sharing.

 Signature 

jtaby.com

 
Posted: 20 November 2007 05:39 AM   [ Ignore ]   [ # 3 ]   [ Rating: 0 ]
Avatar
Joined: 2007-07-30
2144 posts

Haha - I so thought of making an HTML snippet. I guess I’ve been in a lazy mood lately and trying to minimize my typing as much as possible :(

 Signature 

Follow me on twitter here.
MichaelWales.com | MichaelWales.info

 
Posted: 20 November 2007 05:57 AM   [ Ignore ]   [ # 4 ]   [ Rating: 0 ]
Joined: 2006-07-14
4237 posts

Typing is the least fun part of the job. Maybe you should buy a speech-to-text application so you get rid of the typing all together.

 
Posted: 14 December 2007 01:36 AM   [ Ignore ]   [ # 5 ]   [ Rating: 0 ]
Joined: 2007-12-09
1 posts

Hi!

I don’t know why, but I can’t use snippet with underscore.
When I try to use ci_c, there’s the message: Only alphanumerical characters.

Do you know how to resolve this?

Thanks!

 
Posted: 14 December 2007 02:40 AM   [ Ignore ]   [ # 6 ]   [ Rating: 0 ]
Avatar
Joined: 2007-07-30
2144 posts

Yeah - it happens sometimes with me as well. I intend to change those snippets to remove the underscore.

It’s kind of hit-or-miss, doesn’t happen all the time.

 Signature 

Follow me on twitter here.
MichaelWales.com | MichaelWales.info

 
Posted: 18 December 2007 02:55 PM   [ Ignore ]   [ # 7 ]   [ Rating: 0 ]
Avatar
Joined: 2007-11-06
38 posts

Yeah!! It’s working, thank you for make it

But I did eliminated underscores in ci_c and ci_m.
I have working well cic and cim

p.d. sorry for my bad english :$

 Signature 

http://k001operator.info | http://tucancunix.net | http://infapen.com

 
Posted: 01 October 2009 05:46 AM   [ Ignore ]   [ # 8 ]   [ Rating: 0 ]
Joined: 2009-02-13
47 posts

Thanks a lot. That’s a real time saver.

 
Posted: 01 October 2009 09:22 AM   [ Ignore ]   [ # 9 ]   [ Rating: 0 ]
Avatar
Joined: 2009-08-15
12 posts

Thanks a lot. That’s a real time saver. (2)

 Signature 

.(JavaScript must be enabled to view this email address)

 
Posted: 01 October 2009 09:39 AM   [ Ignore ]   [ # 10 ]   [ Rating: 0 ]
Avatar
Joined: 2009-05-23
133 posts

Quicktext always breaks my npp so that when I double click a variable name it no longer selects just the variable but all non white space touching it, essentially turning npp into notepad.

Otherwise I was using these great snippets!

 Signature 

thomashunter.name | Big (>10k LOC) Open Source CI Project: NeoInvoice

 
Posted: 01 October 2009 11:16 AM   [ Ignore ]   [ # 11 ]   [ Rating: 0 ]
Joined: 2009-02-13
47 posts

I’m using the latest version of Notepad++ and the unicode version of the plugin. It works perfectly on my Windows XP-powered machine.

Get latest version of Notepad++ -> http://sourceforge.net/projects/notepad-plus/
Get latest version of QuickText Notepad++ plugin -> http://sourceforge.net/projects/quicktext/ (beware there are two versions included, an ANSI and a UNI)

 
Posted: 02 October 2009 11:50 AM   [ Ignore ]   [ # 12 ]   [ Rating: 0 ]
Avatar
Joined: 2009-05-23
133 posts
benoa - 01 October 2009 03:16 PM

I’m using the latest version of Notepad++ and the unicode version of the plugin. It works perfectly on my Windows XP-powered machine.

Get latest version of Notepad++ -> http://sourceforge.net/projects/notepad-plus/
Get latest version of QuickText Notepad++ plugin -> http://sourceforge.net/projects/quicktext/ (beware there are two versions included, an ANSI and a UNI)

I’ve got the latest unicode version of both, might be a vista issue who knows!

 Signature 

thomashunter.name | Big (>10k LOC) Open Source CI Project: NeoInvoice

 
Posted: 02 October 2009 02:50 PM   [ Ignore ]   [ # 13 ]   [ Rating: 0 ]
Joined: 2009-02-13
47 posts

It sucks for you man, that’s such a great feature! Maybe you should post the bug on QuickText’s SourceForge profile…

 
Posted: 02 October 2009 03:02 PM   [ Ignore ]   [ # 14 ]   [ Rating: 0 ]
Avatar
Joined: 2008-07-16
664 posts

Quicktext plugin also “breaks” the normal behaviour when you select multiple lines and press tab. Normally it would move selected lines tab ahead, but when quicktext plugin is installed it only “tabs” the first selected line which is annoying. Also if you choose multiple lines and first line consists of replaceable word eg.

php
is
cool

If you choose those 3 lines and press tab, it will replace the first line’s word php with php tags. IMO it would be nice if it only works when cursor is at the end of replaceable word.

If someone has a cure for this, please tell me smile

 
Posted: 02 October 2009 03:05 PM   [ Ignore ]   [ # 15 ]   [ Rating: 0 ]
Joined: 2009-02-13
47 posts

You enlightened me about that. Didn’t know where that bug came from.

+1 cure needed smile

 
1 of 2
1