First, when installing vim (we recommend that you install it in the lab of our job University, first change the source, and see how to modify the source later ), enter sudo apt-get install vim-gtk directly in the command line. If you find that the command cannot be installed, read it.
Reading the package list... complete
Analyzing the dependency tree of the software package
Reading status information... complete
Some software packages cannot be installed. If you are using the unstable release, this may be
This is because the system cannot meet your requirements. This version may contain software you need.
Packages have not yet been created or they have been removed from the new Incoming directory.
The following information may help solve the problem:
The following software packages have dependencies that are not met:
Ia32-libs: Dependency: ia32-libs-multiarch
E: the error cannot be corrected because you require some software packages to maintain the status quo, that is, they destroy the dependency between software packages.
------------------------
No suitable solution can be found online.
Here, you only need to input two more commands (update first and then fix the dependency ):
Enter the following two commands, and then sudo apt-get install vim-gtk
Sudo apt-get update
Sudo apt-get-f install
If a software package conflict is found DURING vim installation, the details are as follows:
Apt-get install vim
Reading the package list... complete
Analyzing the dependency tree of the software package
Reading status information... complete
Some software packages cannot be installed. If you are using an unstable release, this may be
This is because the system cannot meet your requirements. This version may contain software you need.
Packages have not yet been created or they are still in the incoming directory.
The following software packages have dependency that cannot be met:
Vim: Dependency: vim-common (=. 1.314-3ubuntu3. 1) But. 2.079-1ubuntu5 is about to be installed
E: software packages that cannot be installed
This problem should be caused by the software source. The version in the source is relatively low; the dependent version number is lower than the version number to be installed, resulting in no installation method.
You only need to delete the original software source and replace it with the new software source.
The modification method is as follows: first enter etc/apt in the command line, and then there will be a file sources. list. Then enter the command sudo gedit sources. list
Then we can directly overwrite the following to the original file (our college Intranet is very fast, basically it can reach about 5 Mb/s ).
Updated servers of Harbin Institute of Technology, including other open-source images: (the source of ICBC seems to be available only in the lab or our base, and it seems that it cannot be connected to = in the dormitory. In the dormitory, it is recommended to change the source to 163, and the domestic source is generally faster than the foreign source. In addition, if a software does not have a valid source, we recommend that you use another source, or when you have just installed ubuntu, it seems that you need sudo apt-get update to update the source. Otherwise, the software cannot be installed in the Software Center, prompting that there is no legal software source ...)
Deb http://run.hit.edu.cn/ubuntu/ precise main restricted universe multiverse
Deb http://run.hit.edu.cn/ubuntu/ precise-security main restricted universe multiverse
Deb http://run.hit.edu.cn/ubuntu/ precise-updates main restricted universe multiverse
Deb http://run.hit.edu.cn/ubuntu/ precise-backports main restricted universe multiverse
Deb http://run.hit.edu.cn/ubuntu/ precise-proposed main restricted universe multiverse
Deb-src http://run.hit.edu.cn/ubuntu/ precise main restricted universe multiverse
Deb-src http://run.hit.edu.cn/ubuntu/ precise-security main restricted universe multiverse
Deb-src http://run.hit.edu.cn/ubuntu/ precise-updates main restricted universe multiverse
Deb-src http://run.hit.edu.cn/ubuntu/ precise-backports main restricted universe multiverse
Deb-src http://run.hit.edu.cn/ubuntu/ precise-proposed main restricted universe multiverse
Link (other source addresses): http://hi.baidu.com/zhangfeezju/blog/item/8f96bdde15f8b90c495403cd.html
Modify the vim configuration file:
First, enter etc/vim under the command line, which contains the file vimrc, and then enter sudo gedit vimrc under the command line. Then the system will open vimrc with a file similar to notepad, copy your configuration file to the end of the file,
Your vim configuration file is successfully configured.
Below is my vim configuration (similar to codeblocks in the style of others ).
Set encoding = utf-8set termencoding = utf-8set fileencodings = UTF-8, chinese, latin-1if has ("win32 ") set fileencoding = chineseelse set fileencoding = utf-8endiflanguage messages zh_CN.utf-8 "set up color scheme not with previous versions and set nocompatible" set colorscheme murphy "show row set nu" detect file type filetype on "set when when the file is changed, it will automatically load the set autoread "record the number of historical rows set history = 100" display syntax highlighting syntax enablesyntax on "when processing unsaved or read-only files, the pop-up confirmation set confirm "shares the clipboard with windows set c Lipboard + = unnamed "file loading plug-in filetype plugin on" for a specific file type to load the relevant indent file filetype indent on "Save the global variable set viminfo + =! "Do not use line breaks to separate words with the following symbols: set iskeyword + =_, $, @, % ,#, -"set mouse always available set mouse = a" highlight current row set cursorline "command line height set height Height = 1" the prompt set shortmess = atI for children in Somalia is not displayed at startup "set noerrorbells" is blank between Split windows, easy to read: set fillchars = vert: \, stl: \, stlnc: """""""" "Do Not Back Up Files (do not back up files when overwriting files) set nobackup "do not generate swap files. When the buffer is discarded, hide the pixels inserted between setlocal noswapfileset bufhidden = hide" characters. Number of lines set linespace = 0 "command line in enhanced mode automatically complete operation set wildmenu" set paste mode, so that the paste is not misplaced "set paste" save the file, ctrl + S: "nmap <C-s> <esc>: w <CR>" imap <C-s> <esc>: w <CR> noremap <C-S>: update <CR> vnoremap <C-S> <C-C>: update <CR> inoremap <C-S> <C-O>: update <CR> """""""""""""""""""""""""""""""""""" "Search and match """ """""""""""""""""""""""""""""""""""""""" "highlight matching parentheses set showmatch" high Highlight the found sentence (phrases) "set hlsearch". When searching, the entered words are highlighted by character (similar to firefox search ), that is, when you enter the search content, the search result set incsearch is displayed. The case-insensitive set ignorecase is ignored during search. Do not flash set novisualbell """"""""""""""""" """""""""""""""""""""""""""""""""""""""" "text format and layout """"""""""""""""""""""" """""""""""""""""""""""""""""""""""""""" "automatic formatting set formatoptions = tcrqn" inherits the indent of the previous line, it is especially suitable for multi-line annotation set autoindent "providing automatic indentation for C programs set smartindent" using C-style indent set cindent "Tab: 4 set tabstop = 4" unified indent: 4 "enables you to delete four spaces at a time when you press the backspace key set softtabstop = 4" set <and> width when the command is moved for 4 set shiftwidth = 4 "do not use spaces to replace the tab set noexpandtab", set textwidth = 120 "automatically switch the current directory to the directory where the current file is located. set autochdir" fold code set foldmethod = syntax "when a file is opened, set foldlevel = 100 """""""""""""""""""""""""" "automatic instance brackets """"""""""""""""""" "inoremap (() <ESC> iinoremap) <c-r> = ClosePair (') <C R> inoremap {{}< ESC> iinoremap} <c-r> = ClosePair ('}') <CR> inoremap [[] <ESC> iinoremap] <c-r> = ClosePair (']') <CR> inoremap ''' <ESC> iinoremap "<ESC> ifunction ClosePair (char) if getline ('. ') [col ('. ')-1] = a: char return "\ <Right>" else return: char endifendf """""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""" "set mapleader """""""""""""""""""""""""""""" """""""""" """""""""""""""""""""""""""""""""""""""" "Let mapleader = ", "" platformfunction! MySys () if has ("win32") return "windows" else return "linux" endifendfunction "if file not opened, create a new tab, or switch to the opened filefunction! SwitchToBuf (filename) "find in current tab let bufwinnr = bufwinnr (a: filename) if bufwinnr! =-1 exec bufwinnr. "wincmd w" return else "search each tab tabfirst let tb = 1 while tb <= tabpagenr (" $ ") let bufwinnr = bufwinnr (a: filename) if bufwinnr! =-1 exec "normal ". tb. "gt" exec bufwinnr. "wincmd w" return endif tabnext let tb = tb + 1 endwhile "not exist, new tab exec" tabnew ". a: filename endifendfunction "fast edit. vimrcif MySys () = 'linux '"fast reloading of. vimrc map <silent> <leader> ss: source ~ /. Vimrc <cr> "fast editing of the. vimrc map <silent> <leader> ee: call SwitchToBuf ("~ /. Vimrc ") <cr>" when. vimrc is edited, reload it autocmd! Bufwritepost. vimrc source ~ /. Vimrcelseif MySys () = 'windows' "Set helplang set helplang = cn" Fast reloading of the _ vimrc map <silent> <leader> ss: source ~ /_ Vimrc <cr> "Fast editing of _ vimrc map <silent> <leader> ee: call SwitchToBuf ("~ /_ Vimrc ") <cr>" When _ vimrc is edited, reload it autocmd! Bufwritepost _ vimrc source ~ /_ Vimrcendifif MySys () = 'windows' source $ VIMRUNTIME/mswin. vim behave mswinendif """"""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""" """"""""""" """""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""" "Add project to allow access to ctags """"""""""""""""""""""""""""" the project after "" project1 "set tags = tagsset autochdir" is added to the tags variable """"""""""""""""""""""" "set Taglist """""""""""""""""""""""""""""" "sort by name let Tlist_Sort_Type =" name "" display the window on the right. let Tlist_Use_left_Window = 1 "if there is only one buffer, the kill window also kill bufferlet Tlist_Exist_OnlyWindow = 1 "so that the taglist displays only the tags of the current file, and the tags of other files are collapsed (when the tags of multiple files are displayed at the same time) let Tlist_File_Fold_Auto_Close = 1 "Do Not Display The folding tree let Tlist_Enable_Fold_Column = 1 "does not display the tags of multiple files at the same time, only show the current file's let Tlist_Show_One_File = 1" keyboard ing nmap tl: tlistToggle <cr> """""""""""""""""""""""""""""""""""" "sets winManager to manage netrw and Taglist. """""""""""""""""""""""""""""""""""""""" "Let g: winManagerWindowLayout = "FileExplorer | TagList" let g: persistentBehaviour = 0let g: winManagerWidth = 30let g: defaultExplorer = 0 nmap <C-W> <C-F>: firstExplorerWindow <cr> nmap <C-W> <C-B>: BottomExplorerWindow <cr> "nmap <silent> <F8>: WMToggle <cr> nmap wm: WMToggle <cr> "set netrw" let g: netrw_winsize = 30 "nmap <silent> <leader> f E: Sexplore! <Cr> "let Tlist_File_Fold_Auto_Close = 1" quickly switch header files/source files "nnoremap <silent> <F12>: A <cr>" "nmap <silent> <F12>: A <CR> "Quickly search for" nnoremap <silent> <F3>: grep <cr> "set MiniBufExploer """ "quickfix mode autocmd FileType c, cpp map <buffer> <leader> <space>: w <cr>: make <cr> """""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""" """""""""""""""""""""" "F5 "compile and run C ++ program "F6 compile and run C program """""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""" "C: Compile and run map <F6>: call CompileRunGcc () <CR> func! CompileRunGcc () exec "w" exec "! Gcc %-o % <"exec "! ./% <"Endfunc" C ++ compilation and running map <F5>: call CompileRunGpp () <CR> func! CompileRunGpp () exec "w" exec "! G ++ %-o % <"exec "!. /% <"Endfunc source $ VIMRUNTIME/vimrc_example.vimsource $ VIMRUNTIME/mswin. vimbehave mswinset diffexpr = MyDiff () function MyDiff () let opt = '-a -- binary' if & diffopt = ~ 'Icase' | let opt = opt. '-I' | endif if & diffopt = ~ 'Iwhite' | let opt = opt. '-B' | endif let arg1 = v: fname_in if arg1 = ~ ''| Let arg1 = '"'. arg1. '"' | endif let arg2 = v: fname_new if arg2 = ~ ''| Let arg2 = '"'. arg2. '"' | endif let arg3 = v: fname_out if arg3 = ~ ''| Let arg3 = '"'. arg3. '"' | endif let eq ='' if $ VIMRUNTIME = ~ ''If & sh = ~ '\ <Cmd' let cmd = '""'. $ VIMRUNTIME. '\ diff "'Let eq ='" 'else let cmd = substitute ($ VIMRUNTIME ,'','"',''). '\ diff "' endif else let cmd = $ VIMRUNTIME. '\ diff 'endif silent execute '! '. Cmd. ''. opt. arg1. ''. arg2. '> '. arg3. some options when eqendfunction is automatically completed (ctrl-p): when there are more than one option, the menu is displayed, the longest selection; show the additional information currently selected if v: version >=700 set completeopt = menu, longest, preview endif """""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""" "status row related actions """""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""" """""""""""""""" """""""""""""""""""""""""""""""""""""""" "" Display status bar (default value: 1, unable to display status bar) set laststatus = 2 "status line color highlight StatusLine guifg = SlateBlue guibg = Yellowhighlight StatusLineNC guifg = Gray guibg = Whitefunction! CurDir () let curdir = substitute (getcwd (), '/Users/amir /',"~ /"," G ") return curdirendfunction "status row display content "" "% F current file name" % m current File Modification status "% r current file read-only" % Y current file type "% {& fileformat} current file encoding" % B ASCII value of characters at the current cursor "% B current cursor hexadecimal value of the character "% l current cursor row number" % c current cursor column number "% V current cursor virtual column number (calculated based on the number of bytes occupied by the character) "% p percentage of current row to total number of rows" % Percent "% L total number of current file rows set statusline = \ % F % m % r % h \ % w \ CWD: \ % r % {CurDir ()} % h \ Line: \ % l/% L: % c "sets the information displayed in the status Line as follows:" set nowr Apscan "Highlight currentif has (" gui_running ") set cursorline hi cursorline guibg = #333333 hi CursorColumn guibg = #333333 endif """"""""""""""""""""""""" "=> VIM userinterface """"""""""""""""""""""""""""""""""""" "Set 7 lines to the curors-when moving vertical .. set so = 7 "Do not redraw, when running macros .. lazyredrawset lz "Change buffer- Without savingset hid "Set magic onset magic" How many tenths of a second to blinkset mat = 2 set lines = 40 set columns = 100 """""""""""" """""""""""""""""""""""""""""""""""""""" click """""""""""""""""""""""""""""""" "set guioptions-= Tset guioptions-= mmap <silent> <F4>: if & guioptions = ~ # 'T' <Bar> \ set guioptions-= T <Bar> \ set guioptions-= m <bar> \ else <Bar> \ set guioptions + = T <Bar> \ set guioptions + = m <Bar> \ endif <CR> """"""""""""""""""""""""""" """"""""""" """""""""""""""""""""""""""""""""""""""" "" let g: calendar_diary =/calendar "map ca: Calendar <cr>" enables gvim to support Alt + n to switch the tab function! BufPos_ActivateBuffer (num) let l: count = 1 for I in range (1, bufnr ("$") if buflisted (I) & getbufvar (I, "& modifiable ") if l: count = a: num exe "buffer ". I return endif let l: count = l: count + 1 endif endforendfunction
On January 5, I found that the article "hands-on teach you how to convert Vim into an IDE programming environment (image and text)" was written in great detail, and I gave up the above ugly =.
Attach his link http://blog.csdn.net/wooin/article/details/1858917