1. Use CD/to go to the file system;
2. Switch CD/etc/Vim to the Vim directory;
3. Modify the File Permission: sudo chmod 777 vimrc. You will be prompted to enter the password and enter the password;
4. Run Vim vimrc to open the vim file. The content is basically as follows:
"All system-wide defaults are set in $ vimruntime/Debian. Vim (usually just
"/Usr/share/Vim/vimcurrent/Debian. Vim) and sourced by the call to: Runtime
"You can find below. If you wish to change any of those settings, you showould
"Do it in this file (/etc/Vim/vimrc), since Debian. Vim will be overwritten
"Everytime an upgrade of the vim packages is saved med. It is recommended
"Make changes after sourcing Debian. Vim since it alters the value of
"'Compute' option.
"This line shoshould not be removed as it ensures that varous options are
"Properly set to work with the vim-related packages available In Debian.
Runtime! Debian. Vim
"Uncomment the next line to make Vim more vi-compatible
"NOTE: Debian. Vim sets 'nocomputed'. Setting 'computed' changes numerous
"Options, so any other options shoshould be set after setting 'compute '.
"Set compatible
"Vim5 and later versions support syntax highlighting. uncommenting
"Following enables syntax highlighting by default.
If has ("Syntax ")
Syntax on
Endif
"If using a dark background within the editing area and syntax highlighting
"Turn on this option as well
"Set background = dark
"Uncomment the following to have Vim jump to the last position when
"Reopening a file
"If has (" autocmd ")
"Au bufreadpost * If line (" '/"")> 1 & line ("'/" ") <= line (" $ ") | EXE" normal! G'/"" | endif
"Endif
"Uncomment the following to have Vim load indentation rules and plugins
"According to the detected filetype.
"If has (" autocmd ")
"Filetype plugin indent on
"Endif
"The following are commented out as they cause Vim to behave a lot
"Differently from regular VI. They are highly recommended though.
"Set showcmd" show (partial) command in status line.
"Set showmatch" show matching brackets.
"Set ignorecase" Do case insensitive matching
"Set smartcase" do smart case matching
"Set incsearch" incremental search
"Set autowrite" automatically save before commands like: Next and: Make
"Set hidden" Hide buffers when they are abandoned
"Set mouse = A" enable mouse usage (all modes)
"Source a global configuration file if available
If filereadable ("/etc/Vim/vimrc. Local ")
Source/etc/Vim/vimrc. Local
Endif
5. Insert the configuration file as follows:
""""""""""""""""""""""""""""""""""""""
"Syntax coloring and highlighting settings
""""""""""""""""""""""""""""""""""""""
"Enable syntax highlighting
Syntax enable
Syntax on
"Color Scheme
"Colo Ruki
"Colors Ruki
"The Ruki plug-in is not found. temporarily disable this function. After finding the plug-in, enable this function.
"Set highlight search
: Set hlsearch
""""""""""""""""""""""""""""""""""""""
"File Settings
""""""""""""""""""""""""""""""""""""""
Set encoding = UTF-8
Set fileencoding = Chinese
Set fileencodings = ucs-bom, UTF-8, Chinese
Set ambiwidth = double
"Check file type
Filetype on
"No backup by default
: Set nobackup
: Set nowritebackup
""""""""""""""""""""""""""""""""""""""
"Mouse settings
""""""""""""""""""""""""""""""""""""""
"Mouse support
If has ('mouse ')
: Set mouse =
Endif
"Using the mouse like Microsoft Windows seems to solve the problem of multiple consecutive lines of indentation and the problem of backspace
: Behave mswin
""""""""""""""""""""""""""""""""""""""
"Editor settings
""""""""""""""""""""""""""""""""""""""
"Display row number
Set number
"Tab width
: Set Ts = 4
"Auto indent
: Set Sw = 4
"C/C ++ Style Auto indent
: Set CIN
"Option for setting automatic indentation of C/C ++ Style
: Set cino =: 0g0t0 (Sus
"Enable Automatic indentation for common file types
: Set AI
"The status line at the cursor position is displayed in the lower right corner during editing.
: Set ruler
"Display matching brackets
: Set showmatch
"The deletion key can be used in insert mode.
: Set backspace = indent, EOL, start
"Code folding, command za
: Set foldmethod = syntax
: Set foldlevel = 100 "do not automatically collapse the code when Vim is started.
"Set Font
: Set guifont = courier/9
"When you right-click a window, a shortcut menu is displayed.
: Set mousemodel = popup
"Automatic line feed
If (has ("gui_running") "Gui settings
"Do not fold rows. If a line is too long and exceeds the screen width, it will extend to the right side to the outside of the screen
: Set nowrap
"Add a horizontal scroll bar. If you specify no rows, it is necessary to add a horizontal scroll bar for the window.
: Set guioptions + = B
Settings on the else character Interface
Set wrap
Endif
""""""""""""""""""""""""""""""""""""""
"Shortcut key settings
""""""""""""""""""""""""""""""""""""""
"<F1> dynamic switching between menu bar and toolbar hide and display
Set guioptions-= m
Set guioptions-= T
Map <silent> <F1>: IF & guioptions = ~ # 'T' <bar>
/Set guioptions-= T <bar>
/Set guioptions-= m <bar>
/Else <bar>
/Set guioptions + = T <bar>
/Set guioptions + = m <bar>
/Endif <CR>
"<F2> code_complete.vim Plugin: The function is automatically completed.
If! Exists ("G: completekey ")
Let G: completekey = "<F2>" "hotkey
Endif
"<F3> <F4> case-insensitive Conversion
Map <F3> Gu
Map <F4> Gu
"The current directory generates a tags syntax file for Automatic completion. Function prompt: code_complete.vim omnicppcomplete. Vim...
"Map <F5> :! Ctags-r -- c-kinds = + p -- fields = + S. <CR>
Map <F5> :! Ctags-r -- c-kinds = + p -- C ++-kinds = + p -- fields = + IAS -- extra = + q. <CR>
"Function and Variable list
Map <F6>: tlisttoggle <CR>
"File Browser
Map <F7>: wmtoggle <CR>
Let G: winmanagerwindowlayout = "fileexplorer"
"File tree list
Map <F8>: nerdtree <CR>
"Copy, paste, and clipboard CTRL ing Ctrl + C Ctrl + V Ctrl + x
: Map <C-V> "+ Pa <ESC>
: Map! <C-V> <ESC> "+ Pa
: Map <C-C> "+ Y
: Map <C-X> "+ x
"Select Ctrl + A for all mappings.
: Map <C-A> ggvg
: Map! <C-A> <ESC> ggvg
"Multi-line indent
: Map <tab>
: Map <s-tab> <
""""""""""""""""""""""""""""""""""""""
"Plugin settings
""""""""""""""""""""""""""""""""""""""
"Enable omnicppcomplete. Vim
Set nocp
Filetype plugin on
"2html plug-in, enabling XHTML CSS
: Let html_number_lines = 1
: Let html_use_css = 1
: Let use_xhtml = 1
"Fencview. Vim plug-in settings
Let G: fencview_autodetect = 1 "automatically identifies the encoding when the file is opened
Let G: fencview_checklines = 10 "check the first 10 lines to determine the encoding.
"Autocomplpop. Vim & supertab. Vim plug-in settings
Let G: autocomplpop_ignorecaseoption = 1
Set ignorecase
""""""""""""""""""""""""""""""""""""""
"Other settings
""""""""""""""""""""""""""""""""""""""
"Remove the annoying VI consistency mode to avoid bugs and limitations in earlier versions.
: Set nocompatible
The insert position is in the last 5th rows. to distinguish it from the previous content, place more spaces before and after the inserted content.
6. The inserted vimrc content is as follows:
"All system-wide defaults are set in $ vimruntime/Debian. Vim (usually just
"/Usr/share/Vim/vimcurrent/Debian. Vim) and sourced by the call to: Runtime
"You can find below. If you wish to change any of those settings, you showould
"Do it in this file (/etc/Vim/vimrc), since Debian. Vim will be overwritten
"Everytime an upgrade of the vim packages is saved med. It is recommended
"Make changes after sourcing Debian. Vim since it alters the value of
"'Compute' option.
"This line shoshould not be removed as it ensures that varous options are
"Properly set to work with the vim-related packages available In Debian.
Runtime! Debian. Vim
"Uncomment the next line to make Vim more vi-compatible
"NOTE: Debian. Vim sets 'nocomputed'. Setting 'computed' changes numerous
"Options, so any other options shoshould be set after setting 'compute '.
"Set compatible
"Vim5 and later versions support syntax highlighting. uncommenting
"Following enables syntax highlighting by default.
If has ("Syntax ")
Syntax on
Endif
"If using a dark background within the editing area and syntax highlighting
"Turn on this option as well
"Set background = dark
"Uncomment the following to have Vim jump to the last position when
"Reopening a file
"If has (" autocmd ")
"Au bufreadpost * If line (" '/"")> 1 & line ("'/" ") <= line (" $ ") | EXE" normal! G'/"" | endif
"Endif
"Uncomment the following to have Vim load indentation rules and plugins
"According to the detected filetype.
"If has (" autocmd ")
"Filetype plugin indent on
"Endif
"The following are commented out as they cause Vim to behave a lot
"Differently from regular VI. They are highly recommended though.
"Set showcmd" show (partial) command in status line.
"Set showmatch" show matching brackets.
"Set ignorecase" Do case insensitive matching
"Set smartcase" do smart case matching
"Set incsearch" incremental search
"Set autowrite" automatically save before commands like: Next and: Make
"Set hidden" Hide buffers when they are abandoned
"Set mouse = A" enable mouse usage (all modes)
""""""""""""""""""""""""""""""""""""""
"Syntax coloring and highlighting settings
""""""""""""""""""""""""""""""""""""""
"Enable syntax highlighting
Syntax enable
Syntax on
"Color Scheme
"Colo Ruki
"Colors Ruki
"The Ruki plug-in is not found. temporarily disable this function. After finding the plug-in, enable this function.
"Set highlight search
: Set hlsearch
""""""""""""""""""""""""""""""""""""""
"File Settings
""""""""""""""""""""""""""""""""""""""
Set encoding = UTF-8
Set fileencoding = Chinese
Set fileencodings = ucs-bom, UTF-8, Chinese
Set ambiwidth = double
"Check file type
Filetype on
"No backup by default
: Set nobackup
: Set nowritebackup
""""""""""""""""""""""""""""""""""""""
"Mouse settings
""""""""""""""""""""""""""""""""""""""
"Mouse support
If has ('mouse ')
: Set mouse =
Endif
"Using the mouse like Microsoft Windows seems to solve the problem of multiple consecutive lines of indentation and the problem of backspace
: Behave mswin
""""""""""""""""""""""""""""""""""""""
"Editor settings
""""""""""""""""""""""""""""""""""""""
"Display row number
Set number
"Tab width
: Set Ts = 4
"Auto indent
: Set Sw = 4
"C/C ++ Style Auto indent
: Set CIN
"Option for setting automatic indentation of C/C ++ Style
: Set cino =: 0g0t0 (Sus
"Enable Automatic indentation for common file types
: Set AI
"The status line at the cursor position is displayed in the lower right corner during editing.
: Set ruler
"Display matching brackets
: Set showmatch
"The deletion key can be used in insert mode.
: Set backspace = indent, EOL, start
"Code folding, command za
: Set foldmethod = syntax
: Set foldlevel = 100 "do not automatically collapse the code when Vim is started.
"Set Font
: Set guifont = courier/9
"When you right-click a window, a shortcut menu is displayed.
: Set mousemodel = popup
"Automatic line feed
If (has ("gui_running") "Gui settings
"Do not fold rows. If a line is too long and exceeds the screen width, it will extend to the right side to the outside of the screen
: Set nowrap
"Add a horizontal scroll bar. If you specify no rows, it is necessary to add a horizontal scroll bar for the window.
: Set guioptions + = B
Settings on the else character Interface
Set wrap
Endif
""""""""""""""""""""""""""""""""""""""
"Shortcut key settings
""""""""""""""""""""""""""""""""""""""
"<F1> dynamic switching between menu bar and toolbar hide and display
Set guioptions-= m
Set guioptions-= T
Map <silent> <F1>: IF & guioptions = ~ # 'T' <bar>
/Set guioptions-= T <bar>
/Set guioptions-= m <bar>
/Else <bar>
/Set guioptions + = T <bar>
/Set guioptions + = m <bar>
/Endif <CR>
"<F2> code_complete.vim Plugin: The function is automatically completed.
If! Exists ("G: completekey ")
Let G: completekey = "<F2>" "hotkey
Endif
"<F3> <F4> case-insensitive Conversion
Map <F3> Gu
Map <F4> Gu
"The current directory generates a tags syntax file for Automatic completion. Function prompt: code_complete.vim omnicppcomplete. Vim...
"Map <F5> :! Ctags-r -- c-kinds = + p -- fields = + S. <CR>
Map <F5> :! Ctags-r -- c-kinds = + p -- C ++-kinds = + p -- fields = + IAS -- extra = + q. <CR>
"Function and Variable list
Map <F6>: tlisttoggle <CR>
"File Browser
Map <F7>: wmtoggle <CR>
Let G: winmanagerwindowlayout = "fileexplorer"
"File tree list
Map <F8>: nerdtree <CR>
"Copy, paste, and clipboard CTRL ing Ctrl + C Ctrl + V Ctrl + x
: Map <C-V> "+ Pa <ESC>
: Map! <C-V> <ESC> "+ Pa
: Map <C-C> "+ Y
: Map <C-X> "+ x
"Select Ctrl + A for all mappings.
: Map <C-A> ggvg
: Map! <C-A> <ESC> ggvg
"Multi-line indent
: Map <tab>
: Map <s-tab> <
""""""""""""""""""""""""""""""""""""""
"Plugin settings
""""""""""""""""""""""""""""""""""""""
"Enable omnicppcomplete. Vim
Set nocp
Filetype plugin on
"2html plug-in, enabling XHTML CSS
: Let html_number_lines = 1
: Let html_use_css = 1
: Let use_xhtml = 1
"Fencview. Vim plug-in settings
Let G: fencview_autodetect = 1 "automatically identifies the encoding when the file is opened
Let G: fencview_checklines = 10 "check the first 10 lines to determine the encoding.
"Autocomplpop. Vim & supertab. Vim plug-in settings
Let G: autocomplpop_ignorecaseoption = 1
Set ignorecase
""""""""""""""""""""""""""""""""""""""
"Other settings
""""""""""""""""""""""""""""""""""""""
"Remove the annoying VI consistency mode to avoid bugs and limitations in earlier versions.
: Set nocompatible
"Source a global configuration file if available
If filereadable ("/etc/Vim/vimrc. Local ")
Source/etc/Vim/vimrc. Local
Endif
7. Save. Save method: Press ESC, enter WQ, and press Enter.
8. Now, the configuration file is modified successfully.