Snippets plugin: Difference between revisions

From Bluefish Wiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 15: Line 15:
Snippets are organized in branches. The first time you open Bluefish 2 you have no snippets. You have to create them, or import a set of snippets.  
Snippets are organized in branches. The first time you open Bluefish 2 you have no snippets. You have to create them, or import a set of snippets.  
;Bluefish 1.3 users:
;Bluefish 1.3 users:
: you can copy your olds snippets to Bluefish 2<br /><tt>'''$''' cp ~/.bluefish-unstable/snippets  ~/.bluefish/</tt>
: you can copy your old snippets to Bluefish 2<br /><tt>'''$''' cp ~/.bluefish-unstable/snippets  ~/.bluefish/</tt>
;Bluefish 1.0 users:
;Bluefish 1.0 users:
: to import your Bluefish 1 Custom menu in snippets you can use Olivier's python script [[convert_custom_menu_to_snippets.py]].
: to import your Bluefish 1 Custom menu in snippets you can use Olivier's python script [[convert_custom_menu_to_snippets.py]].
Line 27: Line 27:


== Import snippets ==
== Import snippets ==
 
The first time you open Bluefish 2 you have no snippets. You have to create them, or import a set of snippets. Right click in the snippets area open the snippets menu.
{|
{|
|valign="bottom" align="center"|[[File:Man2 import snippets.png|none|frame|lorem ipsum]]
|valign="bottom" align="center"|[[File:Man2 import snippets.png|none|frame|import item in snippets menu]]
|valign="bottom" align="center"|[[File:Man2 import snippets2.png|none|frame|lorem ipsum]]
|valign="bottom" align="center"|[[File:Man2 import snippets2.png|none|frame|import a xml snippets file]]
|}
|}


{|
{|
|valign="bottom" align="center"|[[File:Man2 import snippets3.png|none|frame|lorem ipsum]]
|valign="bottom" align="center"|[[File:Man2 import snippets3.png|none|frame|mediawiki(en) snippets are imported]]
|valign="bottom" align="center"|[[File:Man2 import snippets4.png|none|frame|lorem ipsum]]
|valign="bottom" align="center"|[[File:Man2 import snippets4.png|none|frame|click on the arrow of the branch title to expand it.]]
|valign="bottom"|{{note|text=see [[#Snippets usage|Snippets usage]] to learn how to use snippets.}}
|}
|}


[[:Category:Snippets repository]]
{{tip|text=You can find snippets to import in the [[:Category:Snippets repository]]}}


=== Snippets usage ===
[[File:Man2_snippet_tooltip.png|none|frame|snippet tooltip]]
[[File:Man2_snippet_insert_dialog.png|none|frame|snippet insert dialog]]
[[File:Man2_snippet_insert_result.png|none|frame|snippet insert result]]
=== Export snippets ===
=== Export snippets ===



Revision as of 13:59, 8 January 2010


 

The snippets plugin allows you to record reusable pieces of code. There are two categories of snippets:

  • insert strings
  • search and replace patterns

Snippets are organized in branches. The first time you open Bluefish 2 you have no snippets. You have to create them, or import a set of snippets.

Bluefish 1.3 users
you can copy your old snippets to Bluefish 2
$ cp ~/.bluefish-unstable/snippets ~/.bluefish/
Bluefish 1.0 users
to import your Bluefish 1 Custom menu in snippets you can use Olivier's python script convert_custom_menu_to_snippets.py.
  • put convert_custom_menu_to_snippets.py in ~/.bluefish/ directory
  • make the script executable: $ chmod a+x convert_custom_menu_to_snippets.py
  • run the script: $ ./convert_custom_menu_to_snippets.py > mysnippets.xml
  • import mysnippets.xml in your snippets plugin.
You also can find useful snippets in Snippets repository



Import snippets

The first time you open Bluefish 2 you have no snippets. You have to create them, or import a set of snippets. Right click in the snippets area open the snippets menu.

import item in snippets menu
import a xml snippets file
mediawiki(en) snippets are imported
click on the arrow of the branch title to expand it.
Man2 note.gif see Snippets usage to learn how to use snippets.
Man2 tip.gif You can find snippets to import in the Category:Snippets repository

Snippets usage

snippet tooltip
snippet insert dialog
snippet insert result

Export snippets

Create snippets

Branch

Insert strings

lorem ipsum
lorem ipsum
lorem ipsum
lorem ipsum

lorem ipsum

Search and replace patterns

lorem ipsum
lorem ipsum

lorem ipsum

Edit snippets

Reorder snippets

lorem ipsum

lorem ipsum

Set snippet accelerator

Delete branch/snippet

Show as menu