Showing posts with label vim. Show all posts
Showing posts with label vim. Show all posts

Thursday, September 13, 2012

How to navigate in Terminal command line and in VIM on Mac OSX

TERMINAL commands in MAC OSX 
Ctrl + a (takes you to the beginning of the line)
Ctrl + e (takes you to the end of the line)
Alt or Option + (left arrow) or (right arrow) move back by 1 word (the alternative is Esc + b or Esc + f --  I have to retype Esc + b *each time*)

Ctrl + L Clears the Screen, similar to the clear command
Ctrl + U Clears the line before the cursor position. If you are at the end of the line, clears the entire line.
Ctrl + H Same as backspace
Ctrl + R Let’s you search through previously used commands
Ctrl + C Kill whatever you are running
Ctrl + D Exit the current shell
Ctrl + Z Puts whatever you are running into a suspended background process. fg restores it.
Ctrl + K Clear the line after the cursor
Ctrl + T Swap the last two characters before the cursor
Esc + T Swap the last two words before the cursor
Alt + F Move cursor forward one word on the current line
Alt + B Move cursor backward one word on the current line
Tab Auto-complete files and folder names

VIM commands in MAC OSX 
ctrl-FMove forward one screen.
ctrl-BMove backward one screen.
$Move cursor to end of line.
^Move cursor to beginning of line.
:1Move to first line of file
:$Move to last line of file
/Search for a character string.
?Reverse search for a character string.
xDelete the character at the cursor position.
ddDelete the current line.
pPaste data that was cut with x or dd commands.
uUndo.

Entering Input Mode
aAdd text after the cursor.
iInsert text before the cursor.
RReplace text starting at the cursor.
oInsert a new line after the current one.
Entering Command Mode
escSwitch from Input mode to Command mode.
Exiting or Saving Your File
:wWrite file to disk, without exiting editor.
ZZSave the file and exit.
:q!Quit without saving.

Tuesday, February 21, 2012

Indent tool for the HTML

If you look for a tool that will check indents and etc of your HTML use HTML TIDY 

Online version: http://infohound.net/tidy/

In VIM you can use the command gg=G in order to correct your indention.

Thursday, September 22, 2011

Where profile located on your Mac OSX

If you want to view/edit profile settings on your Mac try do this:
Open Terminal and execute this command:
vi ~/.profile

Tuesday, May 10, 2011

VIM on Mac

When someone first trying VIM editor he will wondering how to finish VIM :) Here is how to do it.

HOW to save and close VIM on Mac:
Type only two characters: ZZ


Check this link for further instruction about commands of VIM.

Thursday, January 27, 2011

Linux commands to be reminded

LINUX
su - зайти под другим пользователем (пример: su devvm)
cat - создать новый файл с содержанием
touch - создать пустой файл
rm -rf - удалить (-r рекурисвно, -f принудительно)
vi /etc/inittab Что бы загрузиться в графическом интерфейсе надо поменять id:3:init:default: на id:5:init:default: цифра 5 указывает на уровень загрузки в графической оболочке X11


ps -x | grep safari Вывод процесса программы Safari (kill safari - посылает команду на завершение)
chmod +x netbeans-6.9.1-ml-linux.sh Установка инсталера для NetBeans (шаг 1)
./netbeans-6.9.1-ml-linux.sh Установка NetBeans (шаг 2)

vi editor
a - перейти в режим редактирования
esc - возвращает в режим просмотра

:wq - сохранить (записать) и выйти из vim (visudo)
:q! - выйти без изменений
Остальные подсказки по этому текстовому редактору смотреть ЗДЕСЬ.

настройка NS сервера
vi /etc/resolve.conf (nameserver присваивается DHCP. Если IP static, можно менять).
service network restart
system-config-network
sudo ifconfig eth0
vi /etc/hosts
nslookup google.com.ua
chattr +i /etc/resolv.conf делает содержание файла immutable
chattr -i /etc/resolv.conf отменяет команды immutable
Остальные подсказки (видео) по настройке NS сервера ЗДЕСЬ.

SVN
svn list http://domain/WW/Trinity/ проверяет содержание директорий
svn co http://domain/WW/Trinity/ делает чекаут (checkout/co) директорий
svn commit дает команду на обновление измененных файлов


svn copy http://www-site-com/WW/Trinity/trunk
         http://www-site-com/WW/Trinity/branches/TRT-322 \
         -m "TRT-322 Creating a private branch of trunk"


svn delete http://www-site-com/WW/Trinity/branches/TRT-322
         -m "TRT-322 Removing obsolete branch from the repository"



A Short SVN Tutorial ЗДЕСЬ и ЗДЕСЬ.

CAT
ctrl + D выйти из CAT (курсор должен быть на пустой строке)
Остальные подсказки по CAT ЗДЕСЬ.

PING
ping -c 4 paniov.com Если не указать в параметре команды Ping количество пингов (в данном примере я поставил -c 4 (-c от слова count)), она будет продолжать пинговать пока ей не дадут команду стоп.
ctrl + c (или delete) Эта команда останавливает в консоле процесс ping.