Part of the EllisLab Network
   
1 of 2
1
Notepad++ Snippets
Posted: 20 November 2007 02:58 AM   [ Ignore ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  2245
Joined  07-30-2007

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 

Become a fan of the CodeIgniter Cookbook (estimated: Fall 2010).

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

Profile
 
 
Posted: 20 November 2007 03:23 AM   [ Ignore ]   [ # 1 ]  
Sr. Research Associate
RankRankRankRankRank
Total Posts:  4785
Joined  07-14-2006

Maybe you can add the html doctype too wink

Profile
 
 
Posted: 20 November 2007 03:39 AM   [ Ignore ]   [ # 2 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  708
Joined  06-07-2007

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 

CodeExtinguisher
Download: codex2_rc14.2.zip - 219 KiloBytes of Gloriousness!
Demo: Public preview - login with preview:preview
Temporary Docs: PBWiki

Profile
 
 
Posted: 20 November 2007 03:39 AM   [ Ignore ]   [ # 3 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  2245
Joined  07-30-2007

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 

Become a fan of the CodeIgniter Cookbook (estimated: Fall 2010).

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

Profile
 
 
Posted: 20 November 2007 03:57 AM   [ Ignore ]   [ # 4 ]  
Sr. Research Associate
RankRankRankRankRank
Total Posts:  4785
Joined  07-14-2006

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.

Profile
 
 
Posted: 13 December 2007 11:36 PM   [ Ignore ]   [ # 5 ]  
Summer Student
Total Posts:  1
Joined  12-09-2007

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!

Profile
 
 
Posted: 14 December 2007 12:40 AM   [ Ignore ]   [ # 6 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  2245
Joined  07-30-2007

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 

Become a fan of the CodeIgniter Cookbook (estimated: Fall 2010).

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

Profile
 
 
Posted: 18 December 2007 12:55 PM   [ Ignore ]   [ # 7 ]  
Grad Student
Avatar
Rank
Total Posts:  38
Joined  11-06-2007

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

Profile
 
 
Posted: 01 October 2009 03:46 AM   [ Ignore ]   [ # 8 ]  
Grad Student
Rank
Total Posts:  46
Joined  02-13-2009

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

Profile
 
 
Posted: 01 October 2009 07:22 AM   [ Ignore ]   [ # 9 ]  
Summer Student
Avatar
Total Posts:  13
Joined  08-15-2009

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

 Signature 

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

Profile
 
 
Posted: 01 October 2009 07:39 AM   [ Ignore ]   [ # 10 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  140
Joined  05-23-2009

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 

Renowned Media: Website | Blog | Twitter | CodeVault

Our Products: RenownedStats | Royalty Free Music

Profile
 
 
   
1 of 2
1
 
‹‹ xHTML Helper      Compressed Asset Provider ››
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 819, on March 11, 2010 11:15 AM
Total Registered Members: 149018 Total Logged-in Users: 19
Total Topics: 103295 Total Anonymous Users: 5
Total Replies: 516930 Total Guests: 334
Total Posts: 620225    
Members ( View Memberlist )