Enviar pesquisa
Carregar
07.using vi
•
Transferir como PPTX, PDF
•
2 gostaram
•
693 visualizações
Minsuk Lee
Seguir
using vi part of Linux (ubuntu) lecture.
Leia menos
Leia mais
Denunciar
Compartilhar
Denunciar
Compartilhar
1 de 18
Baixar agora
Recomendados
09.using shell
09.using shell
Minsuk Lee
Space Foundation Overview
Space Foundation Overview
SpaceFoundation
溪州鄉珍珠芭樂
溪州鄉珍珠芭樂
Minghua Lin
Blackberry
Blackberry
Naveen Sihag
Aart1400 seminar
Aart1400 seminar
jamesdanspicer
Presentation hasil
Presentation hasil
Desfi Rahmadani
Bluetooth 1
Bluetooth 1
Naveen Sihag
A auga e_o_corpo_humano
A auga e_o_corpo_humano
Luisa Dacosta
Recomendados
09.using shell
09.using shell
Minsuk Lee
Space Foundation Overview
Space Foundation Overview
SpaceFoundation
溪州鄉珍珠芭樂
溪州鄉珍珠芭樂
Minghua Lin
Blackberry
Blackberry
Naveen Sihag
Aart1400 seminar
Aart1400 seminar
jamesdanspicer
Presentation hasil
Presentation hasil
Desfi Rahmadani
Bluetooth 1
Bluetooth 1
Naveen Sihag
A auga e_o_corpo_humano
A auga e_o_corpo_humano
Luisa Dacosta
岸角客家文化
岸角客家文化
Minghua Lin
2011 National Space Symposium
2011 National Space Symposium
SpaceFoundation
05.linux basic-operations-1
05.linux basic-operations-1
Minsuk Lee
Portfolio Presentation 2
Portfolio Presentation 2
rutheast
08.file system
08.file system
Minsuk Lee
Future of sharing beyond
Future of sharing beyond
Nick Rappolt
Pp R L S 2011
Pp R L S 2011
Ramo Sakinovic
Eshopping1
Eshopping1
Naveen Sihag
PSPD Newletter Spring 2011
PSPD Newletter Spring 2011
Pratt CMFM
これからの司法書士に求められるIT力強化セミナー
これからの司法書士に求められるIT力強化セミナー
Yukidama
Portfolio Presentation 2
Portfolio Presentation 2
rutheast
IT企業専門パソコン肩こり出張マッサージ「ほぐ神」4月末までの渋谷キャンペーン
IT企業専門パソコン肩こり出張マッサージ「ほぐ神」4月末までの渋谷キャンペーン
Yukidama
The Complete Roadmap Workbook Final Use
The Complete Roadmap Workbook Final Use
paulageorge
Small business and enterprenure
Small business and enterprenure
rounaq
A 12
A 12
Naveen Sihag
Binary search
Binary search
Minsuk Lee
it's software!
it's software!
Minsuk Lee
Module 1 presentation
Module 1 presentation
snorthrop
Intelligent System for Alzheimer's Disease
Intelligent System for Alzheimer's Disease
Brain Dynamics
Open Source Software Day Talk
Open Source Software Day Talk
Minsuk Lee
Coding with Vim
Coding with Vim
Enzo Wang
Rotoscope inthebrowserppt billy
Rotoscope inthebrowserppt billy
nimbleltd
Mais conteúdo relacionado
Destaque
岸角客家文化
岸角客家文化
Minghua Lin
2011 National Space Symposium
2011 National Space Symposium
SpaceFoundation
05.linux basic-operations-1
05.linux basic-operations-1
Minsuk Lee
Portfolio Presentation 2
Portfolio Presentation 2
rutheast
08.file system
08.file system
Minsuk Lee
Future of sharing beyond
Future of sharing beyond
Nick Rappolt
Pp R L S 2011
Pp R L S 2011
Ramo Sakinovic
Eshopping1
Eshopping1
Naveen Sihag
PSPD Newletter Spring 2011
PSPD Newletter Spring 2011
Pratt CMFM
これからの司法書士に求められるIT力強化セミナー
これからの司法書士に求められるIT力強化セミナー
Yukidama
Portfolio Presentation 2
Portfolio Presentation 2
rutheast
IT企業専門パソコン肩こり出張マッサージ「ほぐ神」4月末までの渋谷キャンペーン
IT企業専門パソコン肩こり出張マッサージ「ほぐ神」4月末までの渋谷キャンペーン
Yukidama
The Complete Roadmap Workbook Final Use
The Complete Roadmap Workbook Final Use
paulageorge
Small business and enterprenure
Small business and enterprenure
rounaq
A 12
A 12
Naveen Sihag
Binary search
Binary search
Minsuk Lee
it's software!
it's software!
Minsuk Lee
Module 1 presentation
Module 1 presentation
snorthrop
Intelligent System for Alzheimer's Disease
Intelligent System for Alzheimer's Disease
Brain Dynamics
Open Source Software Day Talk
Open Source Software Day Talk
Minsuk Lee
Destaque
(20)
岸角客家文化
岸角客家文化
2011 National Space Symposium
2011 National Space Symposium
05.linux basic-operations-1
05.linux basic-operations-1
Portfolio Presentation 2
Portfolio Presentation 2
08.file system
08.file system
Future of sharing beyond
Future of sharing beyond
Pp R L S 2011
Pp R L S 2011
Eshopping1
Eshopping1
PSPD Newletter Spring 2011
PSPD Newletter Spring 2011
これからの司法書士に求められるIT力強化セミナー
これからの司法書士に求められるIT力強化セミナー
Portfolio Presentation 2
Portfolio Presentation 2
IT企業専門パソコン肩こり出張マッサージ「ほぐ神」4月末までの渋谷キャンペーン
IT企業専門パソコン肩こり出張マッサージ「ほぐ神」4月末までの渋谷キャンペーン
The Complete Roadmap Workbook Final Use
The Complete Roadmap Workbook Final Use
Small business and enterprenure
Small business and enterprenure
A 12
A 12
Binary search
Binary search
it's software!
it's software!
Module 1 presentation
Module 1 presentation
Intelligent System for Alzheimer's Disease
Intelligent System for Alzheimer's Disease
Open Source Software Day Talk
Open Source Software Day Talk
Semelhante a 07.using vi
Coding with Vim
Coding with Vim
Enzo Wang
Rotoscope inthebrowserppt billy
Rotoscope inthebrowserppt billy
nimbleltd
Vi Editor
Vi Editor
Shiwang Kalkhanda
swl--3 (1).docx
swl--3 (1).docx
HimanshuKimothi
Vim Hacks (OSSF)
Vim Hacks (OSSF)
Lin Yo-An
07 vi text_editor
07 vi text_editor
Shay Cohen
Introduction to Vim
Introduction to Vim
Brandon Liu
Евгений Обрезков "Behind the terminal"
Евгений Обрезков "Behind the terminal"
Fwdays
Augusta Linux User Group - Vim Introduction
Augusta Linux User Group - Vim Introduction
Keith Pickett
Vim - How to Develop Like a Ninja
Vim - How to Develop Like a Ninja
AlexLewin7
Game development with Cocos2d
Game development with Cocos2d
Vinsol
Subversion: A Getting Started Presentation
Subversion: A Getting Started Presentation
Nap Ramirez
Intro_OpenCV.ppt
Intro_OpenCV.ppt
RithikRaj25
Linux programming - Getting self started
Linux programming - Getting self started
Emertxe Information Technologies Pvt Ltd
Xen Debugging
Xen Debugging
The Linux Foundation
Puppet at DemonWare - Ruaidhri Power - Puppetcamp Dublin '12
Puppet at DemonWare - Ruaidhri Power - Puppetcamp Dublin '12
Puppet
Vi editor
Vi editor
ParikshitTaksande1
Project ACRN Yocto Project meta-acrn layer introduction
Project ACRN Yocto Project meta-acrn layer introduction
Project ACRN
Linex
Linex
Annu Bhaskar
[OpenInfra Days Korea 2018] Day 2 - E4 - 딥다이브: immutable Kubernetes architecture
[OpenInfra Days Korea 2018] Day 2 - E4 - 딥다이브: immutable Kubernetes architecture
OpenStack Korea Community
Semelhante a 07.using vi
(20)
Coding with Vim
Coding with Vim
Rotoscope inthebrowserppt billy
Rotoscope inthebrowserppt billy
Vi Editor
Vi Editor
swl--3 (1).docx
swl--3 (1).docx
Vim Hacks (OSSF)
Vim Hacks (OSSF)
07 vi text_editor
07 vi text_editor
Introduction to Vim
Introduction to Vim
Евгений Обрезков "Behind the terminal"
Евгений Обрезков "Behind the terminal"
Augusta Linux User Group - Vim Introduction
Augusta Linux User Group - Vim Introduction
Vim - How to Develop Like a Ninja
Vim - How to Develop Like a Ninja
Game development with Cocos2d
Game development with Cocos2d
Subversion: A Getting Started Presentation
Subversion: A Getting Started Presentation
Intro_OpenCV.ppt
Intro_OpenCV.ppt
Linux programming - Getting self started
Linux programming - Getting self started
Xen Debugging
Xen Debugging
Puppet at DemonWare - Ruaidhri Power - Puppetcamp Dublin '12
Puppet at DemonWare - Ruaidhri Power - Puppetcamp Dublin '12
Vi editor
Vi editor
Project ACRN Yocto Project meta-acrn layer introduction
Project ACRN Yocto Project meta-acrn layer introduction
Linex
Linex
[OpenInfra Days Korea 2018] Day 2 - E4 - 딥다이브: immutable Kubernetes architecture
[OpenInfra Days Korea 2018] Day 2 - E4 - 딥다이브: immutable Kubernetes architecture
Mais de Minsuk Lee
CES 처음 가는 분을 위한 가이드
CES 처음 가는 분을 위한 가이드
Minsuk Lee
NIA-PaaS-TA Pub 키노트
NIA-PaaS-TA Pub 키노트
Minsuk Lee
모두콘, 어떻게 배울 것인가 발제.
모두콘, 어떻게 배울 것인가 발제.
Minsuk Lee
GDG-DevFest, 만들면서 자랑하면서 성장하는 개발자
GDG-DevFest, 만들면서 자랑하면서 성장하는 개발자
Minsuk Lee
개발자, 회사.. 왜 오픈소스를 해야할까?
개발자, 회사.. 왜 오픈소스를 해야할까?
Minsuk Lee
진정한 소프트웨어 융합교육에 대하여
진정한 소프트웨어 융합교육에 대하여
Minsuk Lee
FOSS CON Korea 2018
FOSS CON Korea 2018
Minsuk Lee
소프트웨어 공부하는법
소프트웨어 공부하는법
Minsuk Lee
자기소개서, 이력서 쓰는 법
자기소개서, 이력서 쓰는 법
Minsuk Lee
왜 우리는 개발자에 집중하지 않는가?
왜 우리는 개발자에 집중하지 않는가?
Minsuk Lee
Somul 2017-이민석
Somul 2017-이민석
Minsuk Lee
국민대-컴퓨터프로그래밍-2017-1-오프라인강좌
국민대-컴퓨터프로그래밍-2017-1-오프라인강좌
Minsuk Lee
왜 소프트웨어를 배워야할까?
왜 소프트웨어를 배워야할까?
Minsuk Lee
소프트웨어, 정말 되는 건가?
소프트웨어, 정말 되는 건가?
Minsuk Lee
소프트웨어, 소프트웨어 개발자
소프트웨어, 소프트웨어 개발자
Minsuk Lee
프로그램 기초
프로그램 기초
Minsuk Lee
Software Company, Open Soure Software Company
Software Company, Open Soure Software Company
Minsuk Lee
Open Source 그리고 git과 github, code review
Open Source 그리고 git과 github, code review
Minsuk Lee
Data and Sorting Algoritm
Data and Sorting Algoritm
Minsuk Lee
국민대학교 컴퓨터프로그래밍
국민대학교 컴퓨터프로그래밍
Minsuk Lee
Mais de Minsuk Lee
(20)
CES 처음 가는 분을 위한 가이드
CES 처음 가는 분을 위한 가이드
NIA-PaaS-TA Pub 키노트
NIA-PaaS-TA Pub 키노트
모두콘, 어떻게 배울 것인가 발제.
모두콘, 어떻게 배울 것인가 발제.
GDG-DevFest, 만들면서 자랑하면서 성장하는 개발자
GDG-DevFest, 만들면서 자랑하면서 성장하는 개발자
개발자, 회사.. 왜 오픈소스를 해야할까?
개발자, 회사.. 왜 오픈소스를 해야할까?
진정한 소프트웨어 융합교육에 대하여
진정한 소프트웨어 융합교육에 대하여
FOSS CON Korea 2018
FOSS CON Korea 2018
소프트웨어 공부하는법
소프트웨어 공부하는법
자기소개서, 이력서 쓰는 법
자기소개서, 이력서 쓰는 법
왜 우리는 개발자에 집중하지 않는가?
왜 우리는 개발자에 집중하지 않는가?
Somul 2017-이민석
Somul 2017-이민석
국민대-컴퓨터프로그래밍-2017-1-오프라인강좌
국민대-컴퓨터프로그래밍-2017-1-오프라인강좌
왜 소프트웨어를 배워야할까?
왜 소프트웨어를 배워야할까?
소프트웨어, 정말 되는 건가?
소프트웨어, 정말 되는 건가?
소프트웨어, 소프트웨어 개발자
소프트웨어, 소프트웨어 개발자
프로그램 기초
프로그램 기초
Software Company, Open Soure Software Company
Software Company, Open Soure Software Company
Open Source 그리고 git과 github, code review
Open Source 그리고 git과 github, code review
Data and Sorting Algoritm
Data and Sorting Algoritm
국민대학교 컴퓨터프로그래밍
국민대학교 컴퓨터프로그래밍
07.using vi
1.
Using vi editor
Minsuk Lee Hansung University, Seoul, Korea minsuk@hansung.ac.kr NEAOSS MC2.0 CC-BY 2.0 KR, © Korea OSS Promotion Forum, NIPA
2.
Why vi ?
• vi: Terminal based text editor – vi doesn’t need mouse, Function/Arrow keys • Just regular keyboards • High speed editing – vi works with other source code tools • ctag, … • The original code for vi was written by Bill Joy in 1976, as the visual mode for a line editor called ex that Joy had written with Chuck Haley. [wikipedia ‘vi’]. NEAOSS MC2.0 CC-BY 2.0 KR, © Korea OSS Promotion Forum, NIPA
3.
Vi as a
modal editor • Modes of vi – Command Mode • Cursor movement, delete, … – For cursor movement, You can also use arrow, [HOME],[END],[PgUp],[PgDn] keys – Input Mode • Edit (typing the document) – Ex Mode • Line command (write, cancel, quit, help, and ‘ex’ command) $ vi file ‘i’, ‘a’ ‘:’ Input Command ex Mode Mode Mode [ESC] [ESC] [ENTER] NEAOSS MC2.0 CC-BY 2.0 KR, © Korea OSS Promotion Forum, NIPA
4.
vi
Menu for Gnome-Terminal not for vi vi screen NEAOSS MC2.0 CC-BY 2.0 KR, © Korea OSS Promotion Forum, NIPA
5.
Survival guide of
vi 1. $ vi filename 2. You are in [Command Mode] 3. EDITTING YOUR TEXT – Type ‘i’ to change into [Input Mode] – EDIT [Type whatever you want] – Type ESC to return [Command Mode] – Move cursors using arrow keys or ‘h’, ‘k’, ‘k’, ‘l’, ‘w’, ‘b’ – Delete a character using ‘x’ 4. If done, ‘ZZ’ or ‘:wq’ to save and quit, or ‘:q!’ to just quit 5. $ cat filename NEAOSS MC2.0 CC-BY 2.0 KR, © Korea OSS Promotion Forum, NIPA
6.
If you see
this screen • It’s the result of unwanted stop. (e.g., killed) NEAOSS MC2.0 CC-BY 2.0 KR, © Korea OSS Promotion Forum, NIPA
7.
Recover message Found
a swap file by the name ".myfile.swp" owned by: myuser dated: Sun Aug 28 11:12:41 2011 modified: no While opening file "myfile“ dated: Sun Aug 28 11:46:35 2011 NEWER than swap file! (1) Another program may be editing the same file. … Quit, or continue with caution. (2) An edit session for this file crashed. If this is the case, use ":recover" or "vi -r myfile“ to recover. If you did this already, delete the swap file ".myfile.swp" to avoid this message. NEAOSS MC2.0 CC-BY 2.0 KR, © Korea OSS Promotion Forum, NIPA
8.
vi commands (1)
• Command mode to Input Mode – ‘i’ : from the cursor position – ‘a’ : after the current character – ‘I’ : from the starting column – ‘A’ : after the last character of the line • Cursor movement – ‘gg’ : move to 1st line of the file – ‘G’ : move to the last line of the file – ‘H’ : move to top right corner of the screen – ‘nnG’ or ‘:nn [ENTER]’ : move to nnth line – ‘h’, ’j’, ’k’, ’l’ : move left, down, up, right by one character (nn) – ‘w’, ‘b’ : move to next, previous word (nn) NEAOSS MC2.0 CC-BY 2.0 KR, © Korea OSS Promotion Forum, NIPA
9.
vi commands (2)
• Delete, modify – ‘x’, [DEL] : delete character under cursor (nn) – ‘X’ [BS] : delete the previous character (nn) – ‘dw’ : delete word (nn) UNDO ? – ‘dd’ : delete a line (nn) Try ‘u’ – ‘cw’ : modify to the end of current word (nn) – ‘cc’ : modify whole line (nn) – ‘C’ : modify to the end of current line – ‘r’ : replace one character under cursor (nn) REPEAT ? – ‘R’ : replace characters • Copy and paste Try ‘.’ – ‘yw’ : copy word (nn) – ‘yy’ : copy current line (nn) – ‘p’ : paste copied or deleted item, next (nn) – ‘P’ : paste before (nn) NEAOSS MC2.0 CC-BY 2.0 KR, © Korea OSS Promotion Forum, NIPA
10.
vi commands (3)
• Search – ‘/word ’ : search ‘word ’ forward – ‘n’ find next (nn) – ‘?’ change search direction backword – ‘/’ change search direction forward • Replace – ‘:s/source/destination’ : replace source to destination – ‘:%s/source/destination’ : replace the FIRST occurrence of all lines – ‘:%s/source/destination/g’ : replace the ALL occurrence of all lines – ‘:aa,bbs/source/destination/g’ : replace from line aa to bb NEAOSS MC2.0 CC-BY 2.0 KR, © Korea OSS Promotion Forum, NIPA
11.
vi commands (4)
• File Commands – ‘:w’ : save – ‘:w filename’ : save as filename – ‘:wq’ or ‘ZZ’ : save and quit – ‘:q’ : quit without save, if modified, ‘:q!’ – ‘:e filename’ : read and edit filename – ‘:r filename’ : read and insert filename – ‘:!<command> : run shell command – ‘:n’ : next file without save, ‘:n!’ if modified – ‘:wn’ : write and next NEAOSS MC2.0 CC-BY 2.0 KR, © Korea OSS Promotion Forum, NIPA
12.
Configuration of vi
• ‘:set <command>’ or in configuration file ~/.exrc – set autoindent : auto indentation – set cindent : auto indentation for C language – set autowrite : automatic write when modify – set smartindent : smarter indentation – set textwidth=nn : wrap after nn th column – set wrap : auto wrap Unset ? – set backup : do not make backup :set no<command> – set tabstop=nn : set tab with nn – set shiftwidth=n : set indentation with n – set ignorecase : ignore case when search – set showmode : show current mode in bottom line – set number : show line number NEAOSS MC2.0 CC-BY 2.0 KR, © Korea OSS Promotion Forum, NIPA
13.
And more
• Vi has millions of functions – http://vimdoc.sourceforge.net/htmldoc/help.html#help.txt – http://www.yolinux.com/TUTORIALS/LinuxTutorialAdvanced_vi.h tml – http://wiki.kldp.org/KoreanDoc/html/Vim_Guide- KLDP/Vim_Guide-KLDP.html (KOREAN) – http://weezzle.net/1575 (KOREAN) • Look for ‘vi cheat sheet’ !!! – Single page command lists NEAOSS MC2.0 CC-BY 2.0 KR, © Korea OSS Promotion Forum, NIPA
14.
Vi cheat sheets
<www.viemu.com> <IBM> NEAOSS MC2.0 CC-BY 2.0 KR, © Korea OSS Promotion Forum, NIPA
15.
gedit
• Gnome editor NEAOSS MC2.0 CC-BY 2.0 KR, © Korea OSS Promotion Forum, NIPA
16.
Small tips for
source code editing • Syntax Highlighting (use vim, rather than vi) • Keeps Indentation ! (editor can help) • Do not use tab, but use 4 Spaces (editor can do this) • See man pages for ALL functions you use (some IDE can help) NEAOSS MC2.0 CC-BY 2.0 KR, © Korea OSS Promotion Forum, NIPA
17.
Let’s Practice !
• Write a C program vi, compile & run Open a terminal $ vi hello.c // show line # $ gcc –ohello hello.c // error ? Edit it !! $ ./hello $ ./hello Minsuk $ ./hello Minsuk Lee $ ./hello Minsuk Lee NEAOSS MC2.0 CC-BY 2.0 KR, © Korea OSS Promotion Forum, NIPA
18.
hello.c : Type
as is !!! NEAOSS MC2.0 CC-BY 2.0 KR, © Korea OSS Promotion Forum, NIPA
Baixar agora