Thursday, February 10, 2011
KDE 3.5.5 on openSUSE 10.2 for VMware Player
VMware released a VMware Player for free with which you can run pre-built virtual machines. Here you can download a virtual machine to experience a polished KDE 3.5.5 desktop on openSUSE 10.2.
An easy and non-risky way to explore the new features of KDE 3.5 and discover openSUSE 10.2 without the need to burn a CD-ROM and reboot your machine.
Content
The image contains a standard and fully working KDE desktop installation of openSUSE 10.2 with KDE 3.5.5 including whole KOffice 1.6 excluding non-KDE applications.Requirements
- VMware Player for either Microsoft Windows or Linux
- 3 GB HDD space for archive download, uncompressing and running
- 512 MB memory for running host OS, VM Player and virtual machine
Download
- KDE_3.5.5_on_openSUSE_10.2.tar.bz2 (710 MB, md5)
- KDE_3.5.5_on_openSUSE_10.2.zip (789 MB, md5)
Usage
Decompress the archive and open the .vmx file with VMware Player. The virtual machine will start to boot and as user "guest" with password "guest" you can log into the KDE desktop.Advanced Usage
The password for the "root" administrator user is "toor". The VMware tools are installed.As "root" you can start the "YaST" system configuration and add users and install more applications of KDE and openSUSE 10.2. Installation sources are preconfigured. And many more installation sources are available.
Source: http://developer.kde.org/~binner/vmware/
Monday, January 24, 2011
Wednesday, January 19, 2011
Updating the HOSTS file in Windows Vista requires special instructions
Due to the restrictions imposed by UAC (Users Access Control) users are prohibited from running any batch files, so the included installer "mvps.bat" does not work unless you turn off or modify UAC (not recommended).
However I have come up with a fairly simple solution ... using the power of SendTo.
[or] You can Update the HOSTS file via "Elevated" Command Prompt [or] You can use one of the Related Utilities specifically designed for this purpose ... [or] You can right-click on the included "mvps.bat" and select "Run as Administrator" ... more info here |
Updating the HOSTS file via the SendTo method
The first step is to create a new shortcut in your SendTo folder. Open Windows Explorer to:
\Users\\AppData\Roaming\Microsoft\Windows\SendTo
\Users\
Note: where "" is your login name
[or]
Start | Run (type) shell:sendto (click Ok)
[or]
Start | Run (type) shell:sendto (click Ok)
Next: Right-click in the right pane and select: New > shortcut [screenshot]
In the next dialog box click Browse and navigate to: Windows\System32\drivers\etc
Click Ok and in the next dialog box name the shortcut (example) Update Hosts
In the next dialog box click Browse and navigate to: Windows\System32\drivers\etc
Click Ok and in the next dialog box name the shortcut (example) Update Hosts
In the future when you wish to update the HOSTS file, download the "hosts.zip", extract the included files and right-click on the included updated HOSTS file and select: SendTo > Update Hosts
Note: UAC will prompt for permission for this action, click Ok and proceed ...
Next you will see the below prompt, click Continue and proceed.
Next you will see the below prompt, click Continue and proceed.
Finally you will see a prompt to Copy and Replace the existing file, click Copy and Replace.
Note: this will overwrite (delete) the existing file, so if you have any custom entries in the file I would suggest copying these prior to updating the file. Then open the HOSTS file and paste your custom entries. Alternately you can use the below method that does create a backup of your HOSTS file.
Editors Note: I know this is not a perfect solution, but given the restrictions of the new Windows version it is a workable solution until something is found that offers a better method.
|
Updating the HOSTS file via "Elevated" Command Prompt
You can add a right-click Folder menu option "Open Command Window Here (Administrator)",
Download cmd-admin.reg then right-click and select: Merge (Ok the prompt) ... no need to reboot.
Download cmd-admin.reg then right-click and select: Merge (Ok the prompt) ... no need to reboot.
Next extract the "hosts.zip" Right-click on the newly created "hosts" folder Select the option: Open Command Window Here (Administrator) Next: (type) mvps.bat (press Enter) You should see the updated message ...
Thanks to Ramesh Srinivasan, Microsoft MVP
for the suggestion |
Modify Users Access Control (Administrators only)
Control Panel > Administrative Tools
Select: Local Security Policy (when prompted, click Continue)
In the left pane, expand Local Policies and click Security Options.
In the right pane, scroll down to User Account Control:
Double-click on: "Behavior Of The Elevation Prompt For Administrators In Admin Approval Mode"
In the drop-down box on the Local Security Settings tab
Select Elevate Without Prompting, Click Apply/OK.
Control Panel > Administrative Tools
Select: Local Security Policy (when prompted, click Continue)
In the left pane, expand Local Policies and click Security Options.
In the right pane, scroll down to User Account Control:
Double-click on: "Behavior Of The Elevation Prompt For Administrators In Admin Approval Mode"
In the drop-down box on the Local Security Settings tab
Select Elevate Without Prompting, Click Apply/OK.
Run as Administrator
Once you unzip (extract) the included files in the "hosts.zip" ... right-click on "mvps.bat" and select: Run as Administrator ...
Next: double-click on "mvps.bat" and let the file back-up your existing and then update your HOSTS file ...
Thanks to Thomas H. for providing help on this method ...
Note: do NOT run Windows Vista/7 with UAC turned off as this also turns off the "Protected Mode" in Internet Explorer.
Related Utilities
By modifying the UAC I was able to get HostsMan to work and update the HOSTS file in Vista.
You can also use HostsXpert to update the HOSTS file in Vista ...
In the event you need to edit the HOSTS file > click here
Tuesday, January 11, 2011
PERL Functions
Definition and Usage
If EXPR is numeric, then it demands that the script requires the specified version of Perl in order to continue. If EXPR or $_ are not numeric, it assumes that the name is the name of a library file to be included. You cannot include the same file with this function twice. The included file must return a true value as the last statement.
This differs from use in that included files effectively become additional text for the current script. Functions, variables, and other objects are not imported into the current name space, so if the specified file includes a package definition, then objects will require fully qualified names.
The specified module is searched for in the directories defined in @INC, looking for a file with the specified name and an extension of .pm.
Return Value
- Nothing
Example
Try out following example:
#!/usr/bin/perl -w # require to demand a particular perl version. require 5.003; # require to include amodule. require Module; |
Tags: perl, functions
Source: http://www.tutorialspoint.com/perl/perl_require.htm
Wednesday, December 22, 2010
Commands in CMD.EXE
- appwiz.cpl – Dùng để mở cửa sổ Add/Remove Programs.
- calc – Sử dụng máy tính.
- charmap – Bảng các ký tự font chữ.
- chkdsk – Kiểm tra hệ thống và chỉnh sửa các file lỗi.
- cleanmgr – Dọn dẹp ổ đĩa.
- clipbrd – Hiển thị Clipboard của Windows.
- cmd – Lời gọi DOS.
- control mouse – Hiển thị bảng điều chỉnh thuộc tính chuột.
- control – Hiển thị Control Panel.
- debug – Tiện ích dùng cho lập trình viên hợp ngữ ( Assembly )
- defrag – Tiện ích chống phân mảnh ổ đĩa.
- drwatson – Lưu lại thông tin các chương trình lỗi.
- dxdiag – Hiển thị cấu hình hệ thống.
- explorer – Hiển thị Windows Explorer.
- fsmgmt.msc – Dùng để mở Share Folders (Folder trực thuộc My Documents )
- firewall.cpl – Dùng để thiết lập Firewall cho Windows.
- hdwwiz.cpl – Dùng để chạy chương trình thiết lập Hardware.
- Ipconfig – Hiển thị IP được thiết lập cho các kết nối.
- logoff – Dùng để logoff máy tính.
- MMC – Microft Management Cosole – Hiển thị bảng quản ly điều khiển.
- msconfig – Thiết lập để chỉnh sửa file khởi động cùng hệ thống.
- mstsc – Dùng để quản ly’ điều khiển máy tính trong hệ thống.
- msinfo32 – Hiển thị thông tin hệ thống.
- netstat – Hiển thị tất cả các tình trạng kết nối.
- osk – Hiển thị bàn phím ảo.
- perfmon.msc – Dùng để thiết lập hiệu suất màn hình.
- ping – Nhận thông tin từ host/IP được chỉ rõ.
- powercfg.cpl – Thiết lập tùy chọn tắt mở máy.
- regedit – Chỉnh sửa các Registry.
- sfc /scannow – Kiểm tra file hệ thống.
- sndrec32 - Ghi âm.
- shutdown – Dùng để shutdown Windows.
- spider – Dùng để mở game Solitaire ( có sẵn trong máy )
- sndvol32 – Điều chỉnh âm lượng.
- sysedit – Chỉnh sửa khởi động hệ thống.
- taskmgr – Mở cửa sổ Task Manager.
- telephon.cpl – Dùng để thiết lập tùy chọn modem.
- telnet – Mở cửa sổ Telnet.
-tracert – Hiển thị các kết nối đến với một host.
- winchat – Dùng để chat với Microsoft.
- wmplayer – Dùng để chạy chương trình Windows Media Player.
- wab – Dùng để mở sở địa chỉ của Windows.
- winword – Mở Microsoft Word.
- winver – Dùng để kiểm tra phiên bản của Windows.
- wupdmgr – Kiểm tra quá trình nâng cấp Windows (dành cho các máy sử dụng Win có bản quyền)
- write – Dùng để mở wordpad.
Wednesday, October 27, 2010
Useful web links and tools
loads.in
HelloChao
http://wikitravel.org/en/Australia
Tet holiday: maphuong.com, http://licham.vn/
DD-WRT is a Linux based alternative OpenSource firmware suitable for a great variety of WLAN routers and embedded systems.
http://www.dd-wrt.com/
SEO tools, search engine tools and webmaster tools
notes for later www.notesforlater.com/
Simple real-time sharing Drop.io
Bubbl.us is a simple and free web application that lets you brainstorm online
Access, backup and share
online photo editor
Store logins to all online accounts
PrintWhatYouLike is a free online editor that lets you format any web page for printing in seconds!
System Spec- Portable System Information Utility
http://pdfmyurl.com/
http://lmgtfy.com/ Let me Google that for you
http://www.giveawayoftheday.com/
Password Management
www.shortcutworld.com
Label: Tet, holiday, Lunar new yeat
Friday, September 10, 2010
10 Linux distros
Ubuntu
Fedora
Mint
openSUSE
PCLinuxOS
Debian
Mandriva
Sabayon/Gentoo (Live CD)
Arch Linux (Slackware)
Puppy Linux
Labels: Ubuntu, Fedora, Mint, openSUSE, PCLinuxOS, Debian, Mandriva, Sabayon Gentoo Live CD, Arch Linux, Slackware, Puppy Linux
label:
Arch Linux,
Debian,
Fedora,
Mandriva,
Mint,
openSUSE,
PCLinuxOS,
Puppy Linux,
Sabayon Gentoo Live CD,
Slackware,
Ubuntu
Tuesday, May 18, 2010
Wednesday, May 12, 2010
Colorize unix shell prompt
Color Prompts
BASH shell:
alias ll='/opt/sfw/bin/ls -althp --color=auto'
PATH=$PATH:/usr/local/new/aps2/MSC_R-14-1_U/bin:$HOME/workspace/doPERL:$HOME/bin
alias toolbox='toolbox-MSC_R-14 &'
alias goplex='cd /home/xviengu/workspace/doPLEX/'
alias goperl='cd /home/xviengu/workspace/doPERL/'
alias gos37='ssh xviengu@seasx037.rnd.as.sw.ericsson.se'
alias gos74='ssh xviengu@seasx074.rnd.as.sw.ericsson.se'
alias pm='pm.pl'
alias pb='pb.pl'
alias csrv='csrv.pl'
alias cpf='cpf.pl'
#alias ana='ana.pl'
#alias gen='gen.pl'
#alias com='com.pl'
#alias pb='pb.pl'
if [ $CLEARCASE_ROOT ]; then
export PS1='\e[0;31m[\u@\e[1;32m\h \e[0;36m`basename $CLEARCASE_ROOT` \e[0;35m${PWD#${PWD%/*/*/*}/}]\\$ \e[m';
else
export PS1='\e[0;31m[\u@\e[1;32m\h \e[0;35m${PWD#${PWD%/*/*/*}/}]\\$ \e[m';
fi
VIMRUNTIME=$HOME/.vim;
export VIMRUNTIME
alias vim='/home/xviengu/bin/vim'
alias ctags='/home/xviengu/bin/ctags'
alias cscope='/home/xviengu/bin/cscope'
CSCOPE_EDITOR=$HOME/bin/vim;
export CSCOPE_EDITOR
CSCOPE_DB=$HOME/cscope/cscope.out;
export CSCOPE_DB
VPATH=$HOME/cscope:$HOME:.
export VPATH
Tuesday, May 11, 2010
Monday, May 10, 2010
Autologin with ssh key
Login auto
./instkey.bash dekt1 xviengu
ssh dekt1
SSH Without a Password
The following steps can be used to ssh from one system to another without specifying a password.Notes:
- The system from which the ssh session is started via the ssh command is the client.
- The system that the ssh session connects to is the server.
- These steps seem to work on systems running OpenSSH.
- The steps assume that a DSA key is being used. To use a RSA key substitute 'rsa' for 'dsa'.
- The steps assume that you are using a Bourne-like shell (sh, ksh or bash)
- Some of this information came from:
http://www.der-keiler.de/Mailing-Lists/securityfocus/Secure_Shell/2002-12/0083.html
Steps:
- On the client run the following commands:
$ mkdir -p $HOME/.ssh $ chmod 0700 $HOME/.ssh $ ssh-keygen -t dsa -f $HOME/.ssh/id_dsa -P ''
This should result in two files, $HOME/.ssh/id_dsa (private key) and $HOME/.ssh/id_dsa.pub (public key). - Copy $HOME/.ssh/id_dsa.pub to the server.
- On the server run the following commands:
$ cat id_dsa.pub >> $HOME/.ssh/authorized_keys2 $ chmod 0600 $HOME/.ssh/authorized_keys2
Depending on the version of OpenSSH the following commands may also be required:$ cat id_dsa.pub >> $HOME/.ssh/authorized_keys $ chmod 0600 $HOME/.ssh/authorized_keys
An alternative is to create a link from authorized_keys2 to authorized_keys:$ cd $HOME/.ssh && ln -s authorized_keys2 authorized_keys
- On the client test the results by ssh'ing to the server:
$ ssh -i $HOME/.ssh/id_dsa server
- (Optional) Add the following $HOME/.ssh/config on the client:
Host server IdentityFile ~/.ssh/id_dsa
This allows ssh access to the server without having to specify the path to the id_dsa file as an argument to ssh each time.
Friday, May 7, 2010
vim with ctags
========================vimrc===========================
Folding
augroup vimrc au BufReadPre * setlocal foldmethod=indent au BufWinEnter * if &fdm == 'indent' | setlocal foldmethod=manual | endif augroup END
Color scheme
:colorscheme koehler
" An example for a vimrc file.
"
" Maintainer: Bram Moolenaar
" Last change: 2008 Jul 02
"
" To use it, copy it to
" for Unix and OS/2: ~/.vimrc
" for Amiga: s:.vimrc
" for MS-DOS and Win32: $VIM\_vimrc
" for OpenVMS: sys$login:.vimrc
:set wrap " Text wrapping
:set number " Line numbering
:set mouse=a " Mouse active
:set tabstop=3 " Tab as 4 spaces
:set expandtab " All tabs are spaces
":set autoindent " automatically indenting your code in structures like loops and procedures.
:set shiftwidth=4 " select a block of code and change its indentation level
:set shiftround " indent/outdent to nearest tabstops
syntax on
set noswapfile
set nobackup
:set noai
:setlocal noautoindent
:setlocal nocindent
:setlocal nosmartindent
filetype plugin on
let Tlist_Ctags_Cmd = "/home/xviengu/bin/ctags"
let Tlist_WinWidth = 50
map
:nnoremap
":set tags=~/vobs/HW/Project/tags
:set tags=./tags,tags,~/vobs/HW/Project/tags
" show matching brackets
autocmd FileType perl set showmatch
let perl_fold=1
let perl_fold_blocks=1
" Note, perl automatically sets foldmethod in the syntax file
autocmd Syntax c,cpp,cxx,vim,xml,html,xhtml setlocal foldmethod=syntax
autocmd Syntax c,cpp,cxx,vim,xml,html,xhtml,perl normal zR
" When started as "evim", evim.vim will already have done these settings.
if v:progname =~? "evim"
finish
endif
" Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
if has("vms")
set nobackup " do not keep a backup file, use versions instead
else
set backup " keep a backup file
endif
set history=50 " keep 50 lines of command line history
set ruler " show the cursor position all the time
set showcmd " display incomplete commands
set incsearch " do incremental searching
" For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries
" let &guioptions = substitute(&guioptions, "t", "", "g")
" Don't use Ex mode, use Q for formatting
map Q gq
" CTRL-U in insert mode deletes a lot. Use CTRL-G u to first break undo,
" so that you can undo CTRL-U after inserting a line break.
inoremap
" In many terminal emulators the mouse works just fine, thus enable it.
if has('mouse')
set mouse=a
endif
" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
syntax on
set hlsearch
endif
" Only do this part when compiled with support for autocommands.
if has("autocmd")
" Enable file type detection.
" Use the default filetype settings, so that mail gets 'tw' set to 72,
" 'cindent' is on in C files, etc.
" Also load indent files, to automatically do language-dependent indenting.
filetype plugin indent on
" Put these in an autocmd group, so that we can delete them easily.
augroup vimrcEx
au!
" For all text files set 'textwidth' to 78 characters.
autocmd FileType text setlocal textwidth=78
" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid or when inside an event handler
" (happens when dropping a file on gvim).
" Also don't do it when the mark is in the first line, that is the default
" position when opening a file.
autocmd BufReadPost *
\ if line("'\"") > 1 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
augroup END
else
set autoindent " always set autoindenting on
endif " has("autocmd")
" Convenient command to see the difference between the current buffer and the
" file it was loaded from, thus the changes you made.
" Only define it when not defined already.
if !exists(":DiffOrig")
command DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis
\ | wincmd p | diffthis
endif
======================================================
ctags -R *
ctrl ] ===> jump from function call to function definition
ctrl t ===> go back
ctrl i and ctrl o ===> travel to forward and backward of the check points
refers the curses.h which is located at /usr/include/ by using symbolic link
ln -s /usr/include/curses.h curses.h
and run ctags -R * again
ref more, more (perl tag, sh tag)
ref vim, ctags more
How should I set up tag files for a multi-level directory hierarchy?
Taglist: Source Code Browser
Vim cmd: ctags, tags file, Moving through a program...
Thursday, May 6, 2010
Bash shell configuration
alias ll='/opt/sfw/bin/ls -alt --color=auto'
export PS1='\e[0;31m[\u@\e[0;34m\h \e[0;36m`basename $CLEARCASE_ROOT` \e[0;35m${PWD#${PWD%/*/*/*}/}]\\$ \e[m';
more PS1
more http://vietzone.blogspot.com/2010/05/colorize-unix-shell-prompt.html
Wednesday, May 5, 2010
Vim for developers
set nobackup #no backup files
set nowritebackup #only in case you don't want a backup file while editing
set noswapfile #no swap files
good for ref:: http://www.danielmiessler.com/study/vim/
To turn off autoindent when you paste code, there's a special "paste" mode.
Type
:set paste
Then paste your code. Note that the text in the tooltip now says
-- INSERT (paste) --
.
After you pasted your code, turn off the paste-mode, so that auto-indenting when you type works correctly again.
:set nopaste
Put the following in your vimrc (change to whatever key you want):
set pastetoggle=
Using VIM which terminal type is dtterm
syntax enable
"colorscheme darkblue
"colorscheme morning
colorscheme desert <<<<< good
Make sure ~/.vim/colors has desert.vim
show full path: press 1 then Ctrl + g
OR
set title
set laststatus=2
"""""""set statusline+=%F
set statusline+=%f
http://www.cs.rit.edu/~cslab/vi.html
http://www.lagmonster.org/docs/vi2.html
General Startup To use vi: vi filename To exit vi and save changes: ZZ or :wq To exit vi without saving changes: :q! To enter vi command mode: [esc] Counts A number preceding any vi command tells vi to repeat that command that many times. Cursor Movement h move left (backspace) j move down k move up l move right (spacebar) [return] move to the beginning of the next line $ last column on the current line 0 move cursor to the first column on the current line ^ move cursor to first nonblank column on the current line w move to the beginning of the next word or punctuation mark W move past the next space b move to the beginning of the previous word or punctuation mark B move to the beginning of the previous word, ignores punctuation e end of next word or punctuation mark E end of next word, ignoring punctuation H move cursor to the top of the screen M move cursor to the middle of the screen L move cursor to the bottom of the screen Screen Movement G move to the last line in the file xG move to line x z+ move current line to top of screen z move current line to the middle of screen z- move current line to the bottom of screen ^F move forward one screen ^B move backward one line ^D move forward one half screen ^U move backward one half screen ^R redraw screen ( does not work with VT100 type terminals ) ^L redraw screen ( does not work with Televideo terminals ) Inserting r replace character under cursor with next character typed R keep replacing character until [esc] is hit i insert before cursor a append after cursor A append at end of line O open line above cursor and enter append mode Deleting x delete character under cursor dd delete line under cursor dw delete word under cursor db delete word before cursor Copying Code yy (yank)'copies' line which may then be put by the p(put) command. Precede with a count for multiple lines. Put Command brings back previous deletion or yank of lines, words, or characters P bring back before cursor p bring back after cursor Find Commands ? finds a word going backwards / finds a word going forwards f finds a character on the line under the cursor going forward F finds a character on the line under the cursor going backwards t find a character on the current line going forward and stop one character before it T find a character on the current line going backward and stop one character before it ; repeat last f, F, t, T Miscellaneous Commands . repeat last command u undoes last command issued U undoes all commands on one line xp deletes first character and inserts after second (swap) J join current line with the next line ^G display current line number % if at one parenthesis, will jump to its mate mx mark current line with character x 'x find line marked with character x NOTE: Marks are internal and not written to the file. Line Editor Mode Any commands form the line editor ex can be issued upon entering line mode. To enter: type ':' To exit: press[return] or [esc] ex Commands For a complete list consult the UNIX Programmer's Manual READING FILES copies (reads) filename after cursor in file currently editing :r filename WRITE FILE :w saves the current file without quitting MOVING :# move to line # :$ move to last line of file SHELL ESCAPE executes 'cmd' as a shell command. :!'cmd'
Vim for Perl developers
Vim tutorial
1 "set cursorline
2
3 nnoremap QQ :q!
4 nnoremap
5 set pastetoggle=F3
6 set showmode
7
8 " enable the plugin for Vim editor.
9 filetype plugin on
1 " Sets how many lines of history VIM has to remember
2 set history=1700
3
4 " line number
5 set number
6
7 " Set to auto read when a file is changed from the outside
8 set autoread
9
10 "Always show current position
11 set ruler
12
13 " Configure backspace so it acts as it should act
14 set backspace=eol,start,indent
15 set whichwrap+=<,>,h,l
16
17 " Highlight search results
18 set hlsearch
19
20 " Makes search act like search in modern browsers
21 set incsearch
22
23 " Show matching brackets when text indicator is over them
24 set showmatch
25 " How many tenths of a second to blink when matching brackets
26 set mat=2
27
28 " Enable syntax highlighting
29 syntax enable
30
31 " Turn backup off, since most stuff is in SVN, git et.c anyway...
32 set nobackup
33 set nowb
34 set noswapfile
35
36 " Use spaces instead of tabs
37 set expandtab
38
39 " Be smart when using tabs ;)
40 set smarttab
41
42 " 1 tab == 3 spaces
43 set shiftwidth=3
44 set tabstop=3
45
46 " Always show the status line
47 set laststatus=2
46 " Always show the status line
47 set laststatus=2
48
49 " Format the status line
50 " set statusline=\ %{HasPaste()}%F%m%r%h\ %w\ \ CWD:\ %r%{getcwd()}%h\ \ \ Line:\ %1
51
52
61 " Taglist variables
62 " Display function name in status bar:
63 let g:ctags_statusline=1
64 " Automatically start script
65 let generate_tags=1
66 " Displays taglist results in a vertical window:
67 let Tlist_Use_Horiz_Window=0
68 " Shorter commands to toggle Taglist display
69 nnoremap TT :TlistToggle
70 map
71 " Various Taglist diplay config:
72 let Tlist_Use_Right_Window = 0
73 let Tlist_Compact_Format = 1
74 let Tlist_Exit_OnlyWindow = 1
75 let Tlist_GainFocus_On_ToggleOpen = 1
76 let Tlist_File_Fold_Auto_Close = 1
Sample .vimrc:
:set wrap " Text wrapping
:set number " Line numbering
:set mouse=a " Mouse active
:set tabstop=4 " Tab as 4 spaces
:set expandtab " All tabs are spaces
:set autoindent " automatically indenting your code in structures like loops and procedures.
:set shiftwidth=4 " select a block of code and change it’s indentation level
:set shiftround " indent/outdent to nearest tabstops
syntax on
hi LineNr ctermfg=darkcyan
hi LineNr ctermfg=darkred
set noswapfile
set nobackup
" show matching brackets
autocmd FileType perl set showmatch
"set foldmethod=marker
"nmap
let perl_fold=1
let perl_fold_blocks=1
Example .vimrc
.vimrc
A collection of .vimrc files
Update VIM plugin
cscope for vim:
cscope for large project: Using Cscope on large projects
Cursor movement
- h - move left
- j - move down
- k - move up
- l - move right
- w - jump by start of words (punctuation considered words)
- W - jump by words (spaces separate words)
- e - jump to end of words (punctuation considered words)
- E - jump to end of words (no punctuation)
- b - jump backward by words (punctuation considered words)
- B - jump backward by words (no punctuation)
- 0 - (zero) start of line
- ^ - first non-blank character of line
- $ - end of line
- G - Go To command (prefix with number - 5G goes to line 5)
From http://www.worldtimzone.com/res/vi.html
Insert Mode - Inserting/Appending text
- i - start insert mode at cursor
- I - insert at the beginning of the line
- a - append after the cursor
- A - append at the end of the line
- o - open (append) blank line below current line (no need to press return)
- O - open blank line above current line
- ea - append at end of word
- Esc - exit insert mode
Editing
- r - replace a single character (does not use insert mode)
- J - join line below to the current one
- cc - change (replace) an entire line
- cw - change (replace) to the end of word
- c$ - change (replace) to the end of line
- s - delete character at cursor and subsitute text
- S - delete line at cursor and substitute text (same as cc)
- xp - transpose two letters (delete and paste, technically)
- u - undo
- . - repeat last command
Marking text (visual mode)
- v - start visual mode, mark lines, then do command (such as y-yank)
- V - start Linewise visual mode
- o - move to other end of marked area
- Ctrl+v - start visual block mode
- O - move to Other corner of block
- aw - mark a word
- ab - a () block (with braces)
- aB - a {} block (with brackets)
- ib - inner () block
- iB - inner {} block
- Esc - exit visual mode
Visual commands
- > - shift right
- < - shift left
- y - yank (copy) marked text
- d - delete marked text
- ~ - switch case
Cut and Paste
- yy - yank (copy) a line
- 2yy - yank 2 lines
- yw - yank word
- y$ - yank to end of line
- p - put (paste) the clipboard after cursor
- P - put (paste) before cursor
- dd - delete (cut) a line
- dw - delete (cut) the current word
- x - delete (cut) current character
Exiting
- :w - write (save) the file, but don't exit
- :wq - write (save) and quit
- :q - quit (fails if anything has changed)
- :q! - quit and throw away changes
Search/Replace
- /pattern - search for pattern
- ?pattern - search backward for pattern
- n - repeat search in same direction
- N - repeat search in opposite direction
- :%s/old/new/g - replace all old with new throughout file
- :%s/old/new/gc - replace all old with new throughout file with confirmations
Working with multiple files
- :e filename - Edit a file in a new buffer
- :bnext (or :bn) - go to next buffer
- :bprev (of :bp) - go to previous buffer
- :bd - delete a buffer (close a file)
- :sp filename - Open a file in a new buffer and split window
- ctrl+ws - Split windows
- ctrl+ww - switch between windows
- ctrl+wq - Quit a window
- ctrl+wv - Split windows vertically
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Maintainer: " Amir Salihefendic " http://amix.dk - amix@amix.dk " " Version: " 5.0 - 29/05/12 15:43:36 " " Blog_post: " http://amix.dk/blog/post/19691#The-ultimate-Vim-configuration-on-Github " " Awesome_version: " Get this config, nice color schemes and lots of plugins! " " Install the awesome version from: " " https://github.com/amix/vimrc " " Syntax_highlighted: " http://amix.dk/vim/vimrc.html " " Raw_version: " http://amix.dk/vim/vimrc.txt " " Sections: " -> General " -> VIM user interface " -> Colors and Fonts " -> Files and backups " -> Text, tab and indent related " -> Visual mode related " -> Moving around, tabs and buffers " -> Status line " -> Editing mappings " -> vimgrep searching and cope displaying " -> Spell checking " -> Misc " -> Helper functions " """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => General """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Sets how many lines of history VIM has to remember set history=700 " Enable filetype plugins filetype plugin on filetype indent on " Set to auto read when a file is changed from the outside set autoread " With a map leader it's possible to do extra key combinations " likew saves the current file let mapleader = "," let g:mapleader = "," " Fast saving nmap <leader>w :w!<cr> """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => VIM user interface """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Set 7 lines to the cursor - when moving vertically using j/k set so=7 " Turn on the WiLd menu set wildmenu " Ignore compiled files set wildignore=*.o,*~,*.pyc "Always show current position set ruler " Height of the command bar set cmdheight=2 " A buffer becomes hidden when it is abandoned set hid " Configure backspace so it acts as it should act set backspace=eol,start,indent set whichwrap+=<,>,h,l " Ignore case when searching set ignorecase " When searching try to be smart about cases set smartcase " Highlight search results set hlsearch " Makes search act like search in modern browsers set incsearch " Don't redraw while executing macros (good performance config) set lazyredraw " For regular expressions turn magic on set magic " Show matching brackets when text indicator is over them set showmatch " How many tenths of a second to blink when matching brackets set mat=2 " No annoying sound on errors set noerrorbells set novisualbell set t_vb= set tm=500 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => Colors and Fonts """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Enable syntax highlighting syntax enable colorscheme desert set background=dark " Set extra options when running in GUI mode if has("gui_running") set guioptions-=T set guioptions+=e set t_Co=256 set guitablabel=%M\ %t endif " Set utf8 as standard encoding and en_US as the standard language set encoding=utf8 " Use Unix as the standard file type set ffs=unix,dos,mac """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => Files, backups and undo """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Turn backup off, since most stuff is in SVN, git et.c anyway... set nobackup set nowb set noswapfile """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => Text, tab and indent related """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Use spaces instead of tabs set expandtab " Be smart when using tabs ;) set smarttab " 1 tab == 4 spaces set shiftwidth=4 set tabstop=4 " Linebreak on 500 characters set lbr set tw=500 set ai "Auto indent set si "Smart indent set wrap "Wrap lines """""""""""""""""""""""""""""" " => Visual mode related """""""""""""""""""""""""""""" " Visual mode pressing * or # searches for the current selection " Super useful! From an idea by Michael Naumann vnoremap <silent> * :call VisualSelection('f')<CR> vnoremap <silent> # :call VisualSelection('b')<CR> """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => Moving around, tabs, windows and buffers """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Treat long lines as break lines (useful when moving around in them) map j gj map k gk " Mapto / (search) and Ctrl- map <space> / map <c-space> ? " Disable highlight whento ? (backwards search) map <silent> <leader><cr> :noh<cr> " Smart way to move between windows map <C-j> <C-W>j map <C-k> <C-W>k map <C-h> <C-W>h map <C-l> <C-W>l " Close the current buffer map <leader>bd :Bclose<cr> " Close all the buffers map <leader>ba :1,1000 bd!<cr> " Useful mappings for managing tabs map <leader>tn :tabnew<cr> map <leader>to :tabonly<cr> map <leader>tc :tabclose<cr> map <leader>tm :tabmove " Opens a new tab with the current buffer's path " Super useful when editing files in the same directory map <leader>te :tabedit <c-r>=expand("%:p:h")<cr>/ " Switch CWD to the directory of the open buffer map <leader>cd :cd %:p:h<cr>:pwd<cr> " Specify the behavior when switching between buffers try set switchbuf=useopen,usetab,newtab set stal=2 catch endtry " Return to last edit position when opening files (You want this!) autocmd BufReadPost * \ if line("'\"") > 0 && line("'\"") <= line("$") | \ exe "normal! g`\"" | \ endif " Remember info about open buffers on close set viminfo^=% """""""""""""""""""""""""""""" " => Status line """""""""""""""""""""""""""""" " Always show the status line set laststatus=2 " Format the status line set statusline=\ %{HasPaste()}%F%m%r%h\ %w\ \ CWD:\ %r%{getcwd()}%h\ \ \ Line:\ %l """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => Editing mappings """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Remap VIM 0 to first non-blank character map 0 ^ " Move a line of text using ALT+[jk] or Comamnd+[jk] on mac nmap <M-j> mz:m+<cr>`z nmap <M-k> mz:m-2<cr>`z vmap <M-j> :m'>+<cr>` is pressed mzgv`yo`z vmap <M-k> :m'<-2 class="Special" span="span" style="color: #e0c060;"><-2>
Subscribe to:
Posts (Atom)
Labels
- _ASSERTE (1)
- _CRT_ASSERT (1)
- _CRT_ERROR (1)
- _CRT_WARN (1)
- _RPT0 (1)
- _RPT2 (1)
- _RPTF2 (1)
- -1073741515 (1)
- .vimrc (3)
- \160 (1)
- 00 (1)
- 0unzip (1)
- 10.4 (1)
- 1073741515 (1)
- 10minutemail (1)
- 28022013 (1)
- 5giay (1)
- ABI (1)
- absolute (1)
- Airlines (1)
- alias (2)
- Apple (3)
- Arch Linux (1)
- arduino (1)
- assignment (2)
- Australia (1)
- auto (1)
- Avoid (1)
- AvoidDirectlyAccessGlobals (1)
- AXE central processors (1)
- AXE system (1)
- bash (6)
- Bash script (3)
- bashrc (2)
- BIG_ENDIAN (1)
- bit-fields (1)
- blogspot (1)
- break down (1)
- buffer overflows (1)
- bug tracking (1)
- build (1)
- Built-in Shell Variables (1)
- C library (1)
- C programming (1)
- c shell (2)
- C++ (1)
- C++ Programming (1)
- C++Test (2)
- case (1)
- cast (1)
- cc (1)
- CDRWIN (1)
- CFLAGS (1)
- change management (1)
- check (1)
- check float values equality (1)
- checker (1)
- CHECKSUM (1)
- chrome (1)
- cl.exe (1)
- clearcase (1)
- Clearcase commands (1)
- cleartool (2)
- Clock (1)
- CloneCD (1)
- cloud (2)
- cmd (1)
- co.cc (1)
- CodePlex (1)
- Coding (1)
- Coding standard (1)
- Coding Standards (1)
- color (1)
- colour (1)
- Command Line (1)
- Command-Line (1)
- Command-Line editing (1)
- Command-Line editing mode (1)
- CommandLine (1)
- compilation (1)
- compile (1)
- compiler (2)
- compliance (1)
- compliance checker (1)
- constructor (1)
- Copy (2)
- cpp programming (1)
- CreateFile (2)
- creator (1)
- critical systems (2)
- cscope (3)
- csh (1)
- ctags (1)
- customer service (1)
- CXXFLAGS (1)
- dangerous functions (1)
- DCB sructure (1)
- Debian (1)
- debug (2)
- DEK Technologies (1)
- Delete (1)
- detected (1)
- Dev-cpp (1)
- developers (1)
- device (1)
- device driver (1)
- DeviceIoControl (1)
- diagram (1)
- diff (1)
- Directly (1)
- disposable (1)
- disposable e-mail addresses (1)
- divide and conquer. (1)
- dns (2)
- domainname (1)
- downgrade (1)
- drawback (1)
- dropbox (1)
- e-mail addresses (1)
- eclipse (1)
- Edit (1)
- End (1)
- environment (1)
- epsilon (1)
- Ericsson (4)
- ERLANG (2)
- errno (1)
- Error (2)
- error code (1)
- error result (1)
- example (1)
- Excel (1)
- exec (1)
- execute (1)
- execution time (1)
- exit code (1)
- explicit calculation of pointer (1)
- explorer (1)
- facebook (3)
- fansipan (1)
- fb (1)
- Fedora (1)
- fgets (1)
- Firefox (1)
- Firefox shortcuts (1)
- float (1)
- float equality (1)
- floating point (1)
- folding (1)
- forwarding (1)
- free (1)
- FreeCommander (1)
- from cl (1)
- function (1)
- Functions (3)
- FunctionsCallOrder (1)
- gitdiff (1)
- global data (1)
- gmail (1)
- GNU (5)
- google (1)
- GreatNews (1)
- Ground (1)
- Guerrilla Mail (1)
- Guidelines (1)
- Headquarters (1)
- help desk ticketing (1)
- high-level (1)
- holiday (1)
- Home (1)
- host (1)
- hostname (2)
- hosts (2)
- howto (1)
- iCloud (1)
- ide (1)
- illegal (1)
- implementation code (1)
- indexing (1)
- inet_pton (1)
- interface header (1)
- ioctl() (1)
- iPhone (1)
- iPhoneVietnam (1)
- java (1)
- jetstar (1)
- Job Ad (1)
- Karaoke (1)
- Korn shell (1)
- labelname (1)
- layers (1)
- Legibility (1)
- less confusing (1)
- linux (2)
- LITTLE_ENDIAN (1)
- login (1)
- lsocket (1)
- Lunar new yeat (1)
- Mac (1)
- Mac OS (1)
- Mac OS shortcuts (1)
- mailinator (1)
- maintainability (2)
- make (2)
- make clean (2)
- Makefile (2)
- Mandriva (1)
- Melbourne (1)
- memory (2)
- Microsoft (1)
- Mint (1)
- mintemail (1)
- misra (3)
- MISRA-C (1)
- MISRA-C 2004 (1)
- misra2004 (1)
- Mobifone (1)
- MobileMe (1)
- Modular (1)
- Modular programming (1)
- modules (1)
- more readable (1)
- Multi-Targeting (1)
- nbtscan (1)
- nbtstat (1)
- nested (1)
- network (1)
- network operations (1)
- nm. objdump (1)
- NoMachine (1)
- notepad++ (1)
- OFFLOAD (1)
- open() (1)
- OpenNx (1)
- OpenSSH (1)
- OpenStack (1)
- openSUSE (2)
- Orcas (1)
- outlook (1)
- outlook 2007 (1)
- parasoft (7)
- parts (1)
- password (1)
- Paste (1)
- patterns (1)
- PCLinuxOS (1)
- PCmover (1)
- perl (2)
- pkgmgr (1)
- PLEX (2)
- PLEX-C (1)
- pointer (2)
- pointer alignment (1)
- Pointer arithmetic (1)
- pop (1)
- Precompile (1)
- print16() (1)
- print32() (1)
- printHex() (1)
- programming (4)
- Programming Language for EXchanges (1)
- prompt (1)
- protocol (1)
- Puppy Linux (1)
- push (1)
- putty (2)
- re-use (1)
- read() (1)
- readelf (1)
- ReadFile (1)
- real-time (1)
- regsvr32 (1)
- request tracker (1)
- Reset Windows password (1)
- risky (1)
- rule (1)
- Sabayon Gentoo Live CD (1)
- safe (1)
- safety code (1)
- SBG HW environment (1)
- Screen (1)
- script (2)
- secure (1)
- Security (1)
- Send To (1)
- Send To menu (1)
- SendTo (1)
- serial number (1)
- serial port (1)
- Serial programming (2)
- services (1)
- sethc.exe (1)
- setup (1)
- setview (2)
- shared mem (1)
- shell (3)
- shell:sendto (1)
- side effects (1)
- site feed (1)
- skew (1)
- Slackware (1)
- snprintf (1)
- socket (1)
- source (1)
- ssh (2)
- status (1)
- strace (1)
- stray (1)
- string (2)
- strncat (1)
- strncpy (1)
- struct (1)
- SunOS (1)
- SWAP16/32 (1)
- switch (1)
- symbol (2)
- system (1)
- system() cmd (1)
- Tab (1)
- taglist (1)
- TC shell (1)
- TCP (1)
- tcpdump (1)
- technique (1)
- Telnet Client (1)
- tenmien (1)
- test (1)
- Testing (1)
- Tet (1)
- Thread safe (1)
- Thread safe programming (1)
- thread safety (1)
- Thunderbird (2)
- Tiger (1)
- tip (1)
- Tips (1)
- trick (1)
- tutorial (1)
- typedef (1)
- Ubuntu (1)
- UCdetector (1)
- uninitialized (1)
- union (1)
- unix (3)
- Unix access (1)
- unsafe (2)
- unsafe string (1)
- unzip (1)
- update (1)
- upgrade (1)
- useful tools (2)
- Variable Substitution (1)
- variables (1)
- vav (3)
- vav.vn (2)
- version (1)
- vi (2)
- Vietnam airlines (1)
- Viettel (1)
- vim (4)
- vimdiff (1)
- viminfo (1)
- Vinaphone (1)
- Violation (2)
- Vista (2)
- visual studio (1)
- vnnic (1)
- void (1)
- vs2005 (1)
- vs2008 (1)
- vspc (1)
- warranty (1)
- web (1)
- website (2)
- website test (1)
- Win8 (1)
- Windows (2)
- Windows 8.1 (1)
- winsxs (1)
- winsxslite (1)
- WinXP (1)
- workflow processes (1)
- write() (1)
- WriteFile (1)
- X (1)
- x11 (1)
- x64 (1)
- Xming (1)
- youth counselling (1)
- youtube (1)
- zebrazone (1)
- zebrazoo (1)
- zim (1)