📜 ⬆️ ⬇️

Turn Sublime Text 2 into Notepad ++



Now the text editor Sublime Text 2 is gaining huge popularity. In ancient times, I switched to Notepad ++ and for many years used it actively, rejoicing and admiring. And when rumors began to appear that Sublime was crowding Notepad ++, I decided to check and try to switch to it. But, unfortunately, I found out that I don’t see a lot of chips that I liked so much about Notepad ++ (not everyone is going to the original settings), despite the abundance of new and other interesting features. And it was decided to try to customize Sublime so that it could be used as well as Notepad ++ (with plug-ins), having along the way Sublime Text 2 features, which are not in the first editor. And yes, Sublime Text 2 was configured in Windows 7.

Introduction



This article shows which features can be repeated, and which ones are still looking for their solution. It is assumed that the basic settings of Sublime you have already carried out:

So, let's go in order of those features and details that we can alter and customize in Sublime Text 2.

Appearance



The color scheme of Sublime Text 2 by default is unusual for Notepad ++ users, and the font itself is “not that kind” after many years of work.
')


Danny Connell proposed a solution (hereafter, almost literally, his words). Download the Notepad ++. Zip file.

	"font_face": "Courier New",
	"highlight_line": true,
	"line_padding_bottom": 1,
	"line_padding_top": 1

, , . :

{
	"color_scheme": "Packages/Color Scheme - Default/Notepad++.tmTheme",
	"font_face": "Courier New",
	"highlight_line": true,
	"line_padding_bottom": 1,
	"line_padding_top": 1
}

, Sublime :



( ). Preferences → Settings — Default, :

"word_wrap": "auto",

auto true.



Windows , Notepad++:



, Sublime Text 2 :



, .





F9 Ctrl+F9 ( ) — ( Notepad++ TextFX). , , . :

5
1
10

:

1
10
5

Notepad++ NppColumnSort. ? , . Notepad++ TextFX NppColumnSort , Sublime , . ? , .

Tools → New Plugin... . %appdata%/Sublime Text 2/Packages/Default/sort.py. :

import sublime, sublime_plugin
import re

# Uglyness needed until SelectionRegions will happily compare themselves
def srcmp(a, b):
    aa = a.begin();
    ba = b.begin();

    if aa < ba:
        return -1;
    elif aa == ba:
        return cmp(a.end(), b.end())
    else:
        return 1;

def case_insensitive_sort(txt):
#   txt.sort(lambda a, b: cmp(a.lower(), b.lower()))
#   return txt
    convert = lambda text: int(text) if text.isdigit() else text.lower()
    alphanum_key = lambda key: [ convert(c) for c in re.split('([0-9.,]+)', key) ]
    return sorted(txt, key=alphanum_key)

def case_sensitive_sort(txt):
#   txt.sort(lambda a, b: cmp(a, b))
#   return txt
    convert = lambda text: int(text) if text.isdigit() else text
    alphanum_key = lambda key: [ convert(c) for c in re.split('([0-9.,]+)', key) ]
    return sorted(txt, key=alphanum_key)

def shrink_wrap_region( view, region ):
    a, b = region.begin(), region.end()

    for a in xrange(a, b):
        if not view.substr(a).isspace():
            break

    for b in xrange(b-1, a, -1):
        if not view.substr(b).isspace():
            b += 1
            break

    return sublime.Region(a, b)

def shrinkwrap_and_expand_non_empty_selections_to_entire_line(v):
    sw = shrink_wrap_region
    regions = []

    for sel in v.sel():
        if not sel.empty():
            regions.append(v.line(sw(v, v.line(sel))))
            v.sel().subtract(sel)

    for r in regions:
        v.sel().add(r)

def permute_lines(f, v, e):
    shrinkwrap_and_expand_non_empty_selections_to_entire_line(v)

    regions = [s for s in v.sel() if not s.empty()]
    if not regions:
        regions = [sublime.Region(0, v.size())]

    regions.sort(srcmp, reverse=True)

    for r in regions:
        txt = v.substr(r)
        lines = txt.splitlines()
        lines = f(lines)

        v.replace(e, r, u"\n".join(lines))

class SortLinesNumericCommand(sublime_plugin.TextCommand):
    def run(self, edit, case_sensitive=False,
                        reverse=False,
                        remove_duplicates=False):
        view = self.view

        if case_sensitive:
            permute_lines(case_sensitive_sort, view, edit)
        else:
            permute_lines(case_insensitive_sort, view, edit)

        if reverse:
            permute_lines(reverse_list, view, edit)

        if remove_duplicates:
            permute_lines(uniquealise_list, view, edit)

, case_insensitive_sort case_sensitive_sort ( ). , :

class SortLinesNumericCommand(sublime_plugin.TextCommand):

Sublime. SortLinesCommand SortLinesNumericCommand ( Command). Sublime? ( Sublime?), , . , SortLinesNumericCommand, Command, , , , , . Sublime sort_lines_numeric.

%appdata%/Sublime Text 2/Packages/, , SortLinesNumeric.py. Sublime, .

. , , - , , , , : Sublime . Sublime.

, . sort_lines_numeric . %appdata%/Sublime Text 2/Packages/Default/Default (Windows).sublime-keymap ( ). :

{ "keys": ["ctrl+f9"], "command": "sort_lines", "args": {"case_sensitive": true} },

:

{ "keys": ["ctrl+shift+f9"], "command": "sort_lines_numeric", "args": {"case_sensitive": true} },

ctrl + shift + f9 , .

%appdata%/Sublime Text 2/Packages/Default/Context.sublime-menu. . ( , ):

[
    { "command": "copy" },
    { "command": "cut" },
    { "command": "paste" },
    { "caption": "-", "id": "selection" },
    { "command": "select_all" },
    { "caption": "-", "id": "file" },
    { "command": "open_in_browser", "caption": "Open in Browser" },
    { "command": "open_dir", "args": {"dir": "$file_path", "file": "$file_name"}, "caption": "Open Containing Folder…" },
    { "command": "copy_path", "caption": "Copy File Path" },
    { "command": "reveal_in_side_bar", "caption": "Reveal in Side Bar" },
    { "caption": "-", "id": "usercommand" },
    { "command": "sort_lines_numeric", "caption": "   " },
    { "caption": "-", "id": "end" }
]

. .



:



5
50
 
1
10
10005
7

:

1
5
7
10
50
10005
 





Notepad++ Aspell, . , . Sublime , . Comphobby.ru.

http://extensions.services.openoffice.org/en/dictionaries. - . ( +). Russian spellcheck dict (ieyo). Based on works of AOT.ru.

zip, zip.

: dict_ru_RU-AOT-0.2.7-ieyo.

.aff .dic. russian-aot-ieyo.aff russian-aot-ieyo.dic. %appdata%/Sublime Text 2/Packages/.

Sublime. , , , . c .aff :

SET KOI8-R

, KOI8-R. UTF-8.

File → Reopen with Encoding → Cyrillic (KOI8-R). . File → Save with Encoding → UTF-8 Ctrl+S.

c .aff :

SET UTF-8

View → Dictionary → [ ] F6:



:


http://habrahabr.ru/post/158441/ Firefox : russian_english.

.aff .dic . . . - .



- — .

: ( Notepad++). — . , Notepad++ , , Sublime Text 2 , .



Sublime Text 2 , . Notepad++: . , Sublime . , .

https://github.com/stylishmedia/SublimeText-Tabright.

Tabright.py %appdata%/Sublime Text 2/Packages. .



: Sublime . . , .

, dev . — .



Notepad++ Clipboard History: → :



Sublime Text 2 Clipboard History. https://github.com/kemayo/sublime-text-2-clipboard-history.

%appdata%/Sublime Text 2/Packages. Ctrl + Alt + V :



Notepad++ . : , Sublime. Notepad++ , . Sublime Notepad++, , . ?

(Bookmarks)



Notepad++ :



Sublime Text 2 Ctrl + F2 ( ). - . ( !).



%appdata%/Sublime Text 2/Packages/Default/Context.sublime-menu :

{ "command": "toggle_bookmark", "caption": " " },

.

, Notepad++, F2 (Shift + F2 ).



Sublime «» Ctrl + P, , ( ?) — «» . ( Sublime ).

, , Ctrl + F.

. - Sublime? Ctrl + F , . , Esc . , — .

.



, . — , , . , .

: « ».

Notepad++ :



Sublime Ctrl + Shift + F. :



Find Find. , Where . :



. . Notepad++ . Shift + Alt + 8 ( ) . . .



, , .

.

: «».

Ctrl + H — :



, . ! «» , ! Notepad — .

: « ».

Notepad++ :



Sublime Find All, . , - Notepad++, , Where , . ? . , ( ), .

: «».

Notepad++ :



, Sublime. , :



: « ».

Notepad++ :



Sublime Ctrl + Shift + F ... .



, Sublime. . Notepad++ , .



Notepad++ :



Sublime :



BracketHighlighter. Package Control. Preferences → Package Control, Install Packages:



:



. Sublime , :



- , BracketHighlighter , ? , ?



Notepad++ , :



Sublime? copy_path , . . , %appdata%/Sublime Text 2/Packages/Default/copy_path.py ( , ):

import sublime, sublime_plugin
import os.path

class CopyPathCommand(sublime_plugin.TextCommand):
    def run(self, edit):
        if len(self.view.file_name()) > 0:
            sublime.set_clipboard(self.view.file_name())
            sublime.status_message("Copied full file path")

    def is_enabled(self):
        return self.view.file_name() and len(self.view.file_name()) > 0

class CopyFileNameCommand(sublime_plugin.TextCommand):
    def run(self, edit):
    	full_name = self.view.file_name()
    	folder_name, file_name = os.path.split(full_name)
        if len(self.view.file_name()) > 0:
            sublime.set_clipboard(file_name)

            sublime.status_message("Copied file name")

class CopyPathOfFileCommand(sublime_plugin.TextCommand):
    def run(self, edit):
    	full_name = self.view.file_name()
    	folder_name, file_name = os.path.split(full_name)
        if len(self.view.file_name()) > 0:
            sublime.set_clipboard(folder_name)

            sublime.status_message("Copied path of file")


copy_file_name copy_path_of_file. %appdata%/Sublime Text 2/Packages/Default/Tab Context.sublime-menu ( ), :

	{ "command": "copy_path", "caption": "   " },
	{ "command": "copy_file_name", "caption": " " },
	{ "command": "copy_path_of_file", "caption": "   " }

, :





Notepad++ ( ). — . Sublime. ? . , , . . . , CTRL + Shift + P, Install package, Print to HTML :



File :



Web . , .



html . .



. , . Notepad++ Compare:



Sublime FileDiffs. , CTRL + Shift + P, Install package, FileDiffs .

. :



Diff with Tab. :



+ — . , Notepad++, -.

, . , .



Notepad++ ( ):





Sublime? .



, Sublime. . Notepad++ :



Sublime? - ?



Sublime Text 2. , . , . ! - . , div . Notepad++ . .







, , Notepad++ Sublime Text 2, :

.

.

.


.


.


.


.


.


( ).




( , ). , - , - , . , , , .

177 ( , ). Notepad++ 3 , Sublime Text 2 90 . Notepad++ , Sublime . , - 42000 . Notepad++ 10 , Sublime — 22, .

1136 20. Sublime 50 , Notepad++ 45 . . «table». Notepad++ 3 , Sublime ? .

.



. , .



Sublime ,

, , .

Sublime Text 2 , , . , .

Sublime, , , , Sublime, Notepad++.

P.S. «» (, ). Sublime Text 2 , « » ( , ). , , , . Notepad++ « » , , . ( ).

P.P.S. . -, . . . , , . . , , . . .

P.P.P.S. Sublime Text 2 . Notepad++: , , ( ), .

Upd. jekakmail, leventov, WAYS .

Upd. , : « ? », .

. ?

1. . — .
2. . ? Sublime (, ), . .
3. , .
!

? Windows, Linux, Mac — ?

Notepad++, . - , Notepad++. , , Notepad++, .

Source: https://habr.com/ru/post/166971/


All Articles