my vim settings

Posted 奇妙之二进制

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了my vim settings相关的知识,希望对你有一定的参考价值。

filetype on
set encoding=UTF-8

call plug#begin()

Plug 'tyru/open-browser.vim' " opens url in browser

”Plug 'vim-scripts/taglist.vim' " depend apt install universal_tag
“let Tlist_Exit_OnlyWindow=1
“let Tlist_File_Fold_Auto_Close=1
”autocmd FileType c,cc,cpp,cxx,h,hpp,py TlistOpen

Plug 'https://github.com/preservim/nerdtree',  'on': 'NERDTreeToggle'  " NERD tree will be loaded on the first invocation of NERDTreeToggle command
map <C-n>  :NERDTreeToggle<CR>
let NERDTreeWinPos = "right"
autocmd vimenter * NERDTree " auto open
autocmd VimEnter * wincmd p " Go to previous (last accessed) window.
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif " auto close if nerdtree is the last open win
let g:NERDTreeDirArrowExpandable = '+'
let g:NERDTreeDirArrowCollapsible = '-'
let NERDTreeIgnore = ['\\.pyc$', '\\.swp', '\\.swo', '__pycache__']
let NERDTreeMouseMode = 3 " single click mouse will fold/unfold the dir or open file

"Can be enabled or disabled
let g:webdevicons_enable_nerdtree = 1
"whether or not to show the nerdtree brackets around flags
let g:webdevicons_conceal_nerdtree_brackets = 1
"adding to vim-airline's tabline
let g:webdevicons_enable_airline_tabline = 1
"adding to vim-airline's statusline
let g:webdevicons_enable_airline_statusline = 1


Plug 'tiagofumo/vim-nerdtree-syntax-highlight'
"Highlight full name (not only icons). You need to add this if you don't have vim-devicons and want highlight.
let g:NERDTreeFileExtensionHighlightFullName = 1
let g:NERDTreeExactMatchHighlightFullName = 1
let g:NERDTreePatternMatchHighlightFullName = 1
"Highlight full name (not only icons). You need to add this if you don't have vim-devicons and want highlight.
let g:NERDTreeHighlightFolders = 1
"highlights the folder name
let g:NERDTreeHighlightFoldersFullName = 1
"you can add these colors to your .vimrc to help customizing
let s:brown = "905532"
let s:aqua =  "3AFFDB"
let s:blue = "0000FF"
let s:darkBlue = "44788E"
let s:purple = "834F79"
let s:lightPurple = "834F79"
let s:red = "AE403F"
let s:beige = "F5C06F"
let s:yellow = "F09F17"
let s:orange = "D4843E"
let s:darkOrange = "F16529"
let s:pink = "CB6F6F"
let s:salmon = "EE6E73"
let s:green = "8FAA54"
let s:Turquoise = "40E0D0"
let s:lightGreen = "31B53E"
let s:white = "FFFFFF"
let s:rspec_red = "FE405F"
let s:git_orange = "F54D27"
let s:gray = "808A87"
let g:NERDTreeExtensionHighlightColor =  " this line is needed to avoid error
let g:NERDTreeExtensionHighlightColor['o'] = s:gray " sets the color of o files to blue
let g:NERDTreeExtensionHighlightColor['h'] = s:red " sets the color of h files to red
let g:NERDTreeExtensionHighlightColor['c'] = s:blue " sets the color of c files to blue
let g:NERDTreeExtensionHighlightColor['cpp'] = s:blue " sets the color of cpp files to blue
let g:NERDTreeExtensionHighlightColor['cc'] = s:blue " sets the color of cpp files to blue
let g:NERDTreeExtensionHighlightColor['c++'] = s:blue " sets the color of c++ files to blue


Plug 'Xuyuanp/nerdtree-git-plugin'
let g:NERDTreeIndicatorMapCustom =  
				\\ "Modified"  : "✹",
				\\ "Staged"    : "✚",
				\\ "Untracked" : "✭",
				\\ "Renamed"   : "➜",
				\\ "Unmerged"  : "═",
				\\ "Deleted"   : "✖",
				\\ "Dirty"     : "✗",
				\\ "Clean"     : "✔︎",
				\\ 'Ignored'   : '☒',
				\\ "Unknown"   : "?"
				\\
		
"If only 2 windows left, NERDTree and Tag_List, close vim
function ExitIfOnlyNerdAndTag()
  if winnr("$") == 3
		echo bufname(winbufnr(1))
		echo bufname(winbufnr(2))
		echo bufname(winbufnr(3))

    let w1 = bufname(winbufnr(1))
    let w2 = bufname(winbufnr(2))
    let w3 = bufname(winbufnr(3))
    if (exists(":NERDTree")) && (w1 == "__Tag_List__" || w2 == "__Tag_List__" || w3 == "__Tag_List__")
      echo winnr("$")
			echo tabpagenr("$")
			if(tabpagenr("$") == 3)
        exec 'qa'
			endif
    endif
  endif
endfun
"autocmd BufWinLeave * call ExitIfOnlyNerdAndTag()

Plug 'ryanoasis/vim-devicons' " show icon in nerd tree, need to install nerd font, and set terminel font to nerd font

Plug 'vim-airline/vim-airline-themes'
Plug 'vim-airline/vim-airline' 

Plug 'https://github.com/ap/vim-css-color' " CSS Color Preview
Plug 'https://github.com/tpope/vim-commentary' " For Commenting gcc & gc

"Plug 'Yggdroot/LeaderF',  'do': './install.sh' 


Plug 'jiangmiao/auto-pairs' " pair complete

Plug 'kien/rainbow_parentheses.vim'
let g:rbpt_colorpairs = [
    \\ ['brown',       'RoyalBlue3'],
    \\ ['Darkblue',    'SeaGreen3'],
    \\ ['darkgray',    'DarkOrchid3'],
    \\ ['darkgreen',   'firebrick3'],
    \\ ['darkcyan',    'RoyalBlue3'],
    \\ ['darkred',     'SeaGreen3'],
    \\ ['darkmagenta', 'DarkOrchid3'],
    \\ ['brown',       'firebrick3'],
    \\ ['gray',        'RoyalBlue3'],
    \\ ['darkmagenta', 'DarkOrchid3'],
    \\ ['Darkblue',    'firebrick3'],
    \\ ['darkgreen',   'RoyalBlue3'],
    \\ ['darkcyan',    'SeaGreen3'],
    \\ ['darkred',     'DarkOrchid3'],
    \\ ['red',         'firebrick3'],
    \\ ]

let g:rbpt_max = 16
let g:rbpt_loadcmd_toggle = 0
au VimEnter * RainbowParenthesesToggle
au Syntax * RainbowParenthesesLoadRound
au Syntax * RainbowParenthesesLoadSquare
au Syntax * RainbowParenthesesLoadBraces


Plug 'majutsushi/tagbar'
let g:tagbar_ctags_bin = 'ctags' " tagbar 依赖 ctags 插件
let g:tagbar_width     = 30      " 设置 tagbar 的宽度为 30 列,默认 40 列
let g:tagbar_autofocus = 1       " 打开 tagbar 时光标在 tagbar 页面内,默认在 vim 打开的文件内
let g:tagbar_left      = 1       " 让 tagbar 在页面左侧显示,默认右边
let g:tagbar_sort      = 0       " 标签不排序,默认排序
map <F8> :TagbarToggle<CR>       " 


Plug 'godlygeek/tabular'
Plug 'preservim/vim-markdown'


call plug#end()

noremap <C-S-v> "+p " support paste from system
map <C-f> /   " support ctrl-f to find
map <C-a> ggVG " support ctrl-a to select all
inoremap <C-s> <esc>:w<CR>a
nnoremap <C-s> <esc>:w<CR>
vnoremap <C-r> y:%s`<C-R>"``g<left><left>
noremap <C-S-v> "+p " support paste from system

set undofile “ u命令持久化
set undodir=~/.vim/undodir
"set guifont=Ubuntu\\ Mono\\ Nerd\\ 18 " set gvim font
set nu
set hlsearch
set mouse=a
set wildmenu
"set cmdheight=1

以上是关于my vim settings的主要内容,如果未能解决你的问题,请参考以下文章

My Vim

vim + oh-my-zsh + git搭建开发环境

my-vim-wiki-doing

修改MySQL密码

Vim 十年

MySQL 5.7 忘记密码后修改密码