Tech

Ultraedit 사용 Tip

onesixx 2008. 8. 7. 11:18
반응형

Workfile

UltraEdit Wordfile
wordfile.txt에 추가 (C:\Program Files\IDM Computer Solutions\UltraEdit\WORDFILE.TXT)
ftp://www.ultraedit.com/wf/

기본 Setting



도스형태로 변환하시겠습니까?

* 키보드에서 Enter 을 쳤을때 
윈도우(도스)는   제어문자인 케리지리턴(맨앞으로 돌아가는) 문자와 라인피드(아래라인으로내려가는) 문자가 입력되고,
유닉스는  케리지리턴은 없이 라인피드만 입력됨

이런 경고가 귀찮을때는,


영역 선택하기

1. {}, [], ()의 앞이나 뒤에서 ctrl+B를 누르면 {} [] ()로 묶여진 부분만 선택이 됩니다.

2. alt+C를 누르면 column mode로 바뀌면서 column단위로 선택할 수 있습니다.

자동 완성하기

앞에 몇 글자를 치고 ctrl+Space를 누르면 그 글자로 시작되는 문자들의 리스트가 나옵니다. 거기서 원하는 것을 선택하고 enter를 치면 됩니다. Configuration 메뉴에서 autocomplete 파일을 지정해 주면 전역 변수/함수를 쉽게 사용할 수 있음

이 기능이 되지 않는 사람은 ctrl+Space 키가 다른 기능(한영전환 같은..)으로 매핑되어 있을 수 있으니 확인해 보시기 바랍니다.

함수 리스트 보기

소스 코드를 열고 F8을 누르면 그 소스의 함수 리스트를 보여 줍니다. 그 리스트에서 함수를 선택해서 클릭하면 그 함수가 정의된 곳으로 바로 이동합니다.

찾아서 리스트로 보기

찾기 창에서 List Lines Containing String을 체크하고 찾기를 하면 찾을 단어가 포함된 모든 줄의 리스트가 나옵니다. 거기서 원하는 곳을 클릭하면 그 줄로 바로 갑니다.

주석 달기

영역을 선택하고 메뉴에서 Comment Add/Remove 하면 됩니다.

영역 선택을 하지 않고 하면 한 줄만 주석 처리 됩니다.

기본적으로는 단축키가 없기 때문에 단축키를 설정한 후에 사용하시면 편리합니다.

주석이 /* */ 으로 되는 것이 아니고 // 으로 되어 있습니다.

소스 코드 보기 좋게 바꾸기 (indent)

영역을 선택하고 메뉴에서 Format-ReIndent Selection을 선택 하시면 됩니다.

함수나 변수가 선언된 곳으로 바로 가기 (ctags)

ctags 기능은 vi editor에서만 지원 되던 것이 였는데 울트라 에디터에서 이번에 새로 추가된 기능입니다. ctags기능을 사용하려면 우선 tag를 생성해 놓은 다음에 원하는 함수나 변수에서 F11키를 누르면 그 함수나 변수가 선언된 파일을 자동으로 읽어와서 선언된 것으로 이동합니다.

1. 프로그램 복사
ctag.exe파일을 ultraedit 폴더에 복사하고, CTag Options에 경로를 설정해 준다.

2. 프로젝트 생성
똑 같은 함수가 여러 파일에 있을 수 있으므로 프로젝트를 만들어서 파일들을 묶어 준다.
프로젝트에 파일들을 추가해 준다.

3. tag 생성

4. 원하는 곳에서 F11을 누른다.

문장 뒤에오는 space 제거하기

      Trim Trailing Spaces를 실행하면 뒤에오는 space를 지워줌, Configuration 메뉴에서

      Trim Trailing Spaces on Save를 누르면 자동으로 저장될 때 제 거됨

찾기나 바꾸기에서 Wild Character 사용하기

Regular Expressions를 체크하고 * ? 등을 사용해서 찾으면 됨

Unix style wild character를 사용하시고 싶으면 Configuration Find 메뉴에서 Unix style regular expressions를 체크하고 사용하면 됨

Key word 색깔 바꾸기

BYTE WORD등 새로만든 data type등의 색깔을 바꾸고자 한다면 Configration Syntax Highlighting 메뉴에서 Wordfile.txt를 수정해주면 됨

매크로 사용하기

단순 반복 작업을 할 경우 매크로를 이용하면 유용하다.

Record를 실행시킨 다음 한번 할 작업을 실행한다. 한번의 작업이 끝나면 Stop 하고, Play Again을 누르거나 Play Multiple Times를 누르면 자동으로 기록된 내용이 실행된다.

위치 이동하기

작업을 하다보면 여기 저기로 커서를 옮겨 가면서 하는 경우가 많이 있다. 그런데 그 전에 작업했던 곳으로 가고자 Back/Forard 기능을 이용하면 쉽게 그 전에 작업했던 위치로 갈 수 있다. 이 기능을 이용하면 여러 파일을 동시에 편집할 때 상당히 유용하다.

다른 방법은 Bookmark를 이용하는 방법도 있다. Ctrl+F2를 눌러서 위치를 기억했다가 F2/Alt+F2를 누르면 현재 파일의 북마크 된 곳으로 찾아가 준다.

Ctrl+G 는 직접 특정 라인으로 이동하는 단축 키 이다.

Tornado에서 울트라 에디터 연결해서 사용하기

tools-options-external editor부분을 다음과 같이 세팅해서 사용하시기 바랍니다.

command line 에 아래 줄을 복사해서 넣어주시고, invoke from 을 모두 체크하십시요

C:\Program Files\UltraEdit\Uedit32.exe $filename/$lineno

그리고 사용하면 에디터창으로 울트라 에디터가 뜰 겁니다.

에러가 난 곳에서 클릭하면 바로 에러난 부분으로 찾아 갑니다.

Beyond Compare에서 울트라 에디터 연결해서 사용하기

옵션에서 프로그램 연결을 선택한 후 명령항에 아래와 같이 연결하면 됩니다.

C:\Program Files\UltraEdit\Uedit32.exe  %f/%
-------------------------------------------

정규식이란, 문자열을 검색/치환/추출할 때 사용하는 일종의 '공식'입니다. 원래는 유닉스에서 사용되었지만 이제는 윈도우용 프로그램에서도 널리 쓰입니다.
가령 도스 프롬프트에서의 와일드카드 Wild Card 를 예로 들어보겠습니다.
dir *.txt 라고 입력하면,
123.txt
ABCD.txt
똠방.txt
똠방ABCD각하.txt
등, 모든 .txt 확장자를 가진 파일들의 목록이 한꺼번에 출력됩니다. 여기서 *표는, '임의의 문자들'을 의미하는 와일드 카드입니다. 물론 와일드카드가, 정규식은 아니지만, 정규식도 이것과 비슷합니다. 물론 훨씬 더 강력한 것입니다.

가장 기초적인 예제

/나는/
이라는 정규식이 있다면 "나는"이라는 모든 문자열을 찾습니다.
/^나는/
이것은 "나는"으로 시작되는 "나는"이라는 단어를 찾는 것입니다. "나는"이라는 문자열이 문장의 중간에 있거나 끝에 있다면 찾지 않습니다. 왜냐하면 정규식에서, 캐럿(^) 기호는 "문자열의 맨처음"을 의미하기 때문입니다.
/주소$/
위 의 정규식을, "주소 좀 알려 주소"라는 문장에 적용하면 앞의 "주소"는 매치되지 않고 뒤의 "주소"만 매치됩니다. 정규식에서 $ 는 문자열의 끝을 의미하기 때문입니다. (행갈이 문자를 의미하지는 않고 그냥 단순히 문자열의 끝부분을 의미함)
/^하하하하$/
이 것은 "하하하하"라는 문자열로만 이루어진 행을 매치합니다. 캐럿과 달러 기호가 앞뒤로 있기 때문에, "하하하하"로 시작해야 하고 "하하하하"로 끝나야 합니다. 그런 경우는 그 문장이 "하하하하"로만 이루어진 경우에만 가능하기 때문입니다. "하하하하 ㅎㅎ", "ㅋㅋ 하하하하 안녕" 이런 문장 속의 "하하하하"는 매치되지 않습니다.
이런 식입니다. 그러나 이것은 간단한 예일 뿐이고, 복잡한 정규식은 한없이 복잡합니다.

정규식을 사용할 수 있는 프로그램

* 각종 텍스트 에디터에서, 복잡한 문자열을 찾고 치환할 때 정규식을 사용합니다. 울트라에디터는 물론이고 거의 모든 텍스트에디터에서 정규식을 지원하지만, 제가 보기로 정규식을 가장 깔끔하게, 그리고 한글도 완벽하게 지원하는 에디터는 이엠에디터(EmEditor)였습니다.
* 프로그래밍 언어에서 문자열을 검색/치환할 때 사용됩니다. C/C++를 제외한, 사실상 모든 언어에서 정규식을 공식적으로 지원하는데, 역시 최고봉은 펄(Perl)입니다. (C++도, Boost C++ Libraries 를 사용하면 정규식을 쓸 수 있습니다.)

장점

문자열을 다루기 위해서 굳이 수십 수백 줄의 프로그래밍을 하지 않아도, 정규식 1~2줄만 있으면 대부분의 문자열 작업을 해낼 수 있습니다.

단점

* 프로그램마다 정규식 문법에 약간씩 차이가 있어, 호환이 안될 때가 많습니다. 표준 정규식도 있는 것으로 알고 있는데 기능이 미약하여, 현재 사실상의 표준은 펄(Perl)의 정규식입니다. 펄의 그것이 가장 강력합니다.

-------------------------------------------------

Regular Expressions (Legacy)

Regular expressions allow more complex search and replace functions to be performed in a single operation.

There are two possible sets of legacy syntax that may be used.  The first table below shows the original UltraEdit syntax used in earlier versions of UltraEdit.  The second table shows the optional "Unix" style regular expressions.  This may be enabled from the Configuration Section.

Regular Expressions (UltraEdit Syntax):

Symbol

Function

%

Matches the start of line - Indicates the search string must be at the beginning of a line but does not include any line terminator characters in the resulting string selected.

$

Matches the end of line - Indicates the search string must be at the end of line but does not include any line terminator characters in the resulting string selected.

?

Matches any single character except newline.

*

Matches any number of occurrences of any character except newline.

+

Matches one or more of the preceding character/expression.  At least one occurrence of the character must be found.  Does not match repeated newlines.

++

Matches the preceding character/expression zero or more times.  Does not match repeated newlines.

^b

Matches a page break.

^p

Matches a newline (CR/LF) (paragraph) (DOS Files)

^r

Matches a newline (CR Only) (paragraph) (MAC Files)

^n

Matches a newline (LF Only) (paragraph) (UNIX Files)

^t

Matches a tab character

[xyz]

A character set.  Matches any characters between brackets.

[~xyz]

A negative character set.  Matches any characters NOT between brackets including newline characters.

^{A^}^{B^}

Matches expression A OR B

^

Overrides the following regular expression character

^(…^) 

Brackets or tags an expression to use in the replace command.  A regular expression may have up to 9 tagged expressions, numbered according to their order in the regular expression.
The corresponding replacement expression is ^x, for x in the range 1-9.  Example: If ^(h*o^) ^(f*s^) matches "hello folks", ^2 ^1 would replace it with "folks hello".

Note - ^ refers to the character '^' NOT Control Key + value.

Examples:

m?n matches "man", "men", "min" but not "moon".

t*t matches "test", "tonight" and "tea time" (the "tea t" portion) but not "tea

time" (newline between "tea " and "time").

Te+st matches "test", "teest", "teeeest" etc. but does not match "tst".

[aeiou] matches every lowercase vowel

[,.?] matches a literal ",", "." or "?".

[0-9a-z] matches any digit, or lowercase letter

[~0-9] matches any character except a digit (~ means NOT the following)

You may search for an expression A or B as follows:

"^{John^}^{Tom^}”

This will search for an occurrence of John or Tom.  There should be nothing between the two expressions.

You may combine A or B and C or D in the same search as follows:

"^{John^}^{Tom^} ^{Smith^}^{Jones^}"

This will search for John or Tom followed by Smith or Jones.

The table below shows the syntax for the "Unix" style regular expressions.

Regular Expressions (Unix Syntax):

Symbol

Function

\

Indicates the next character has a special meaning.  "n" on it’s own matches the character "n".  "\n" matches a linefeed or newline character.  See examples below (\d, \f, \n etc).

^

Matches/anchors the beginning of line.

$

Matches/anchors the end of line.

*

Matches the preceding character zero or more times.

+

Matches the preceding character one or more times.  Does not match repeated newlines.

.

Matches any single character except a newline character.  Does not match repeated newlines.

(expression)

Brackets or tags an expression to use in the replace command.  A regular expression may have up to 9 tagged expressions, numbered according to their order in the regular expression.
The corresponding replacement expression is \x, for x in the range 1-9.  Example: If (h.*o) (f.*s) matches "hello folks", \2 \1 would replace it with "folks hello".

[xyz]

A character set.  Matches any characters between brackets.

[^xyz]

A negative character set.  Matches any characters NOT between brackets including newline characters.

\d

Matches a digit character.  Equivalent to [0-9].

\D

Matches a nondigit character.  Equivalent to [^0-9].

\f

Matches a form-feed character.

\n

Matches a linefeed character.

\r

Matches a carriage return character.

\s

Matches any whitespace including space, tab, form-feed, etc but not newline.

\S

Matches any non-whitespace character but not newline.

\t

Matches a tab character.

\v

Matches a vertical tab character.

\w

Matches any word character including underscore.

\W

Matches any nonword character.

\p

Matches CR/LF (same as \r\n) to match a DOS line terminator.

Note - ^ refers to the character '^' NOT Control Key + value.

Examples:

m.n matches "man", "men", "min" but not "moon".

Te+st matches "test", "teest", "teeeest" etc. BUT NOT "tst".

Te*st matches "test", "teest", "teeeest" etc. AND "tst".

[aeiou] matches every lowercase vowel

[,.?] matches a literal ",", "." or "?".

[0-9a-z] matches any digit, or lowercase letter

[^0-9] matches any character except a digit (^ means NOT the following)

You may search for an expression A or B as follows:

"(John|Tom)"

This will search for an occurrence of John or Tom.  There should be nothing between the two expressions.

You may combine A or B and C or D in the same search as follows:

"(John|Tom) (Smith|Jones)"

This will search for John or Tom followed by Smith or Jones.

If Regular Expressions is not selected (i.e. no usage of Regular Expressions is active) for a find/replace the following special characters are also valid in the Find and Replace fields:

Symbol

Function

^^

Matches a "^" character

^s

Is substituted with the selected (highlighted) text of the active file window.

^c

Is substituted with the contents of the clipboard.

^b

Matches a page break

^p

Matches a newline (CR/LF) (paragraph) (DOS Files)

^r

Matches a newline (CR Only) (paragraph) (MAC Files)

^n

Matches a newline (LF Only) (paragraph) (UNIX Files)

^t

Matches a tab character

Note - ^ refers to the character '^' NOT Control Key + value.

For information regarding Perl Compatible Regular Expressions please click here.

<참조>
http://www.idmcomp.com/
http://www.ultraedit.com/support/tutorials_power_tips/ultraedit
http://blog.empas.com/hangjun2/29839578

반응형

'Tech' 카테고리의 다른 글

FixIEDef  (0) 2008.08.26
MKV (Matroska Video)  (0) 2008.08.16
ASP 설치  (0) 2008.08.07
Dot Net  (0) 2008.08.07
터미널 끊고 들어가기  (0) 2008.08.06
Program List  (0) 2008.08.05