Skip to main content
vim tips


  • how to execute a shell command
    r !command
  • 문자코드 지정 읽기
    vim "+e ++enc=cp932" filename
  • buffer사용




    • open a file as buffer
      :badd f1.txt
    • show list of all the existing buffers
      :buffers
      :ls
      :files
    • go to next buffer
      :bNext
    • back to previous buffer
      :bPrevious
    • delete buffer
      :bdelete f1.txt
      :bdelete 4
  • Folding




    • creating fold or delete




      • zr : create folding
      • zd : delete of folding symbol nearby curosr, e.g., {{{ }}}
      • zE : delete of folding symbol all in a current file
    • open & close folding




      • zo : Open one fold under the cursor
      • zO : Open all folds under the curosr recursively
      • zc : Close one fold under the cursor
      • zC : close all folds under the cursor recursively
      • zR : open all folds
    • Moving over folds
    • [z : move to the start of the cureent open fold
    • ]z : move to the end of the current open fold
    • zj : move downwards to the start of the next fold
    • zk : move upwards to the end of the previous fold
  • Bookmark






    • m{a-zA-Z} : set mark {a-zA-Z} at cursor position
    • ` or `{a-zA-Z} : Jump to the mark
    • :marks : show list all the current marks
  • Move





    • move cursor




      • H : move to top of window
      • M : move to middle of window
      • L : move to bottom of window
    • scrolling relative to cursor




      • z : Redraw, line at top of window
      • zt : similar to z
      • z. : Redraw, line at center of window
      • z- : Refraw, line at bottom of window
    • move




      • [n]H : move, [n] line from top of window
      • [n]L : move, [n] line from bottom of window
      • [n]G : move, [n] line of current file
  • Abbreviate




    :abbreviate ad advertisement
    Howto use: ad
    :ab abb abbreviate // :ab kr Korea
    :ab // print out list of abb
    :unab abb // unable abb
  • 문서중의 전 탭을 스페이스로 변환
  • :set expandtab
  • :%retab


Cscope
cd /usr/ports/devel/cscope/
make & make install





configure

At first we shoudl check the vim configure as following:
vim --version | grep cscope
If it is existed, we can install vim without others.
But if not so, we should install cscope and reconfigure vim makefile.






making cscope

find | grep "\.c$\|\.h$" > cscope.files

or 

# for current directory.

ls | grep "\.c$|\.h$" > cscope.files


cscope -b 
ctag -L cscope.files
;ctag is exuberant-ctags
ctag -n --fields=+ai -L cscop.files

ctags --c-kinds=+p -R /usr/include  or makeing ctags file in /usr/include


# for php
ctags --php-kinds=+cidfv -R . ../php/PEAR
# --{lag}-kindsは、ctags --list-kindsで詳細がわかる




  1. Ctrl-\ c : find the callers of a routine.
  2. Ctrl-\ s : find the uses of a symbol
  3. Ctrl-[ Ctrl-[ s : vertical split find the uses of a symbol
  4. To update a cscope database without closing vim :!cscope -b, then :cs reset


Clewn

vim + gdb
What I also needed was the libncurses5 and libncurses5-dev packages.
4.1 Default mappings:

List of default key mappings:
CTRL-Z  send an interrupt to GDB and the program it is running
       B       info breakpoints
       L       info locals
       A       info args
       S       step
       I       stepi
       CTRL-N  next: next source line, skipping all function calls
       X       nexti
       F       finish
       R       run
       Q       quit
       C       continue
       W       where
       CTRL-U  up: go up one frame
       CTRL-D  down: go down one frame
cursor position: 
CTRL-B  set a breakpoint on the line where the cursor is located
       CTRL-E  clear all breakpoints on the line where the cursor is located
mouse pointer position: 
CTRL-P  print the value of the variable defined by the mouse pointer
               position
       CTRL-X  print the value that is referenced by the address whose
               value is that of the variable defined by the mouse pointer
               position
       CTRL-K  set a breakpoint at assembly address shown by mouse position
       CTRL-H  clear a breakpoint at assembly address shown by mouse position
       CTRL-J  add the selected variable at mouse position to the watched
               variables window
Note: You can tune Vim behavior when using netBeans keys with the mouse
pointer position, by setting Vim balloondelay to a smaller value than its
default. The following setting has been reported to give better results:
:set balloondelay=100 ~
Note: After browsing your code, you can always return rapidly to the line of
code where GDB is currently stopped, by using CTRL-U and CTRL-D.




  • 윈도우 이동
    • ctl + Wt 제일 위 윈도우에 이동
    • ctl + Wb 제일 밑 윈도우에 이동
    • ctl + Wp 현 윈도우에 이동하기 전의 윈도우에 이동
    • ctl + Wr 전 윈도우를 아래방향으로 회전
    • ctl + WR 전 윈도우를 윗방향으로 회전
    • ctl + Wx 현 윈도우를 다음 윈도우로 교체


    • :split 파일명 창을 분활해서 파일을 염
    • :sview 파일명 창을 분활해서 파일을 염 - readonly

    • [수]ctl - W+ 윈도우를 수만큰 크게
    • [수]ctl - W- 윈도우를 수만큼 작게
    • Ctl - W= 전 윈도우를 같은 크기로

Comments

Popular posts from this blog

사자성어(가)

奇想天外(기상천외) 보통 사람이 쉽게 짐작할 수 없을 정도로 엉뚱하고 기발한 생각 技成眼昏(기성안혼) 재주를 다 배우니 눈이 어두워짐. 늙어서 재주가 쓸모 없게 됨 起承轉結(기승전결) 한시의 詩 作에서, 절구체의 전형적인 구성법을 지칭 제1구를 기구, 제2구를 승구, 제3구를 절구, 제4구를 결구 문장 구성에 있어서의 4단계, 서론, 설명, 증명, 결론 寄與補裨(기여보비) 이바지하여 돕고 부족함을 보태어 줌. 杞人之優(기인지우) 杞나라 사람의 군걱정이란 뜻. 곧 쓸데없는 걱정이나 무익한 근심을 말함.(=杞憂) 旣張之舞(기장지무) 이미 벌린 춤. 이미 시작한 일을 중간에서 그만 둘 수 없다 騎虎難下(기호난하) 이미 시작된 일을 중도에서 그만 둘 수 없음을 비유한 말 騎虎之勢(기호지세) = 기호난하 奇貨可居(기화가거) 진기한 물건을 사 두었다가 때를 기다리면 큰 이익을 볼 수 있다 吉祥善事(길상선사) 매우 기쁘고 좋은 일 吉凶禍福(길흉화복) 길한 일, 흉한 일, 언짢은 일, 복된 일 寄與補裨(기여보비) 이바지하여 돕고 부족함을 보태어 줌. 杞人之優(기인지우) 杞나라 사람의 군걱정이란 뜻. 곧 쓸데없는 걱정이나 무익한 근심을 말함.(=杞憂)  B A B A B A B A B A B A B A

SDN(OpenFlow) 개요

OpenFlow는 SDN(Software Defined Network)의 하나의 콤포넌트이다. 아래는 2013/3/13 오픈프로우 코리아 주최로 열린 한국 SDN Interest Group 4번째 정기세미나의 내용이다. 다음에는 꼭 모임에 참석하고 싶다. SDN Architecture including OpenFlow 위 그림에서와 같이, Control Layer부분과 Application Layer부분이 최근 활발히 연구개발되고 있다. 그 중 Control Layer부분은 Controller가 많은 비중을 차지 하는데, 다음 절에서와 같이 이미 많은 벤더들이 많은 OpenFlow 기반의 Controller를 제공하고 있다. 그외 소규모 벤더들은 Controller가 아닌 Application Layer에서 보안, 로드벨런싱, 홈네트워크 등의 서비스가 지원되는 제품 개발에 힘쓰고 있다. SDN에서는 Router라는 명칭 대신, Switch라는 명칭을 사용하는데, 이는 Router보다 더 단순한 기능을 수행하고, 기존 레거시와 차별화를 위해 명명된 것으로 보인다. 또한, Switch를 반드시 벤더로부터 구매할 필요가 없다. 상황에 따라 리눅스 등의 운영체제를 기반으로 자체 개발이 가능하다. Controllers의 종류 SDN의 Controller 가운데 Open Source로 운영되는 것은 다음과 같다. 대부분 Java언어로 구현되어 있다. 따라서 플랫폼 또는 인프라 개발자라면 Java에 능숙해야 한다. NOX C++/Python Beacon Java Floodlight Java Maestro Java RouteFlow NOX, Quagga 보안을 위한 Open Source FortNOX Java 기반의 SE-FloodLight  공격 감지  인증  스위치의 Flow 처리 성능 고려 FRESCO OpenFlow Contro...

SAStruts란

SAStruts 개요 Struts는 Spring Framework 다음으로 많이 사용되고 있는 FrameWork이다. Struts는 프레임워크로 강력한 기능을 제공한다. 하지만, 개발 과정에서 부수적인 설정 작업이 개발자들을 힘들게 했다. 이 문제를 해결하기 위해, 일본 개발자 커뮤니티 Seasar(일본 오키나와의 전설 동물, 우리나라의 해태와 비슷^^) 에서 개발한 프레임워크가 SAStruts(Super Agile Struts)이다. 아래 아키텍처 그림과 같이, SAStruts의 모태는 Struts이다. 다만, 상기한 복잡하고 까다로운 설정 작업을 그림2와 같이 SAStruts가 개발자 대신 내부적으로 처리해 준다. 예를 들어, Struts는 항상 struts-config.xml을 읽고 Action 클래스를 호출한다. 이 때문에, 개발자는 소스 코드를 수정한 후, 늘 struts-c onfig.xml 파일을 검토 또는 수정해야 한다. 또한, 대형 프로젝트일 경우는, 이 struts-config.xml 파일이 경합을 자주 일으킨다. 이는 실로 개발자의 스트레스 치수를 높이는 원인이다. 반면, SAStruts는 이 번거로운 작업을 알아서 처리해 준다. 아리가또~~~ 입니다. 그림1 Struts 아키텍처 그림2 SAStruts 아키텍처 그럼, 이 번거로운 작업을 SAStruts는 어떻게 처리하는 것인지 궁금할 것이다. 그것은 Java의 annotation기술을 이용한 점이다. 예를 들어, @Execute, @ActionForm, @Resource 등 Seasar 커뮤니티에서 제공하는 Dolteng 플러그인을 사용하면, SAStruts 개발이 더욱 효율적이다. SAStruts 프로젝트는 다음과 같은 패키지 구조로 형성된다. [root package].action Action 클래스 [root package].condition 데이터베이스에 엑세스하는 조건 설정 [root p...