[关闭]
@daduizhang 2021-03-22T15:14:00.000000Z 字数 6204 阅读 835

搭建ubuntu18.04环境

Linux


镜像地址:https://mirrors.aliyun.com/ubuntu-releases/
或者

  1. # 桌面版
  2. https://mirrors.aliyun.com/ubuntu-releases/18.04.5/ubuntu-18.04.5-desktop-amd64.iso
  3. # 服务版
  4. https://mirrors.aliyun.com/ubuntu-releases/18.04.5/ubuntu-18.04.5-live-server-amd64.iso

安装虚拟机插件(使用VMware):https://www.cnblogs.com/360minitao/p/11943144.html
或者使用vagrant、virturalBox

更换阿里镜像源

  1. vim /etc/apt/source.list
  2. deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
  3. deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
  4. deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
  5. deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
  6. deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
  7. deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
  8. deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
  9. deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
  10. deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
  11. deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

更新系统语言为中文

https://www.cnblogs.com/lzyws739307453/p/12907656.html

安装zsh和oh-my-zsh

  1. vim /etc/hosts
  2. # 最后一行追加
  3. 151.101.108.133 raw.githubusercontent.com
  4. sudo -s
  5. apt-get install zsh curl git
  6. wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh
  7. cat /etc/shells
  8. chsh -s /usr/bin/zsh
  9. 同时配置终端首选项 自定义命令为zsh

安装插件

  1. # 高亮插件
  2. sudo git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
  3. # 补全插件
  4. sudo git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
  5. # autojump(需要更改python的环境变量,不太需要装)
  6. sudo git clone https://github.com/joelthelion/autojump.git
  7. # 更新zshrc文件
  8. autojump需要在zshrc上添加最后一行
  9. [[ -s ~/.autojump/etc/profile.d/autojump.zsh ]] && . ~/.autojump/etc/profile.d/autojump.zsh
  10. # 安装lsd替换原生的ls
  11. https://github.com/peltoche/lsd
  12. apt-get install lsd
  13. alias ls="lsd"
  14. alias ll="lsd -l"
  15. alias la="lsd -la"

安装字体

  1. https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Regular.ttf
  2. https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold.ttf
  3. https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Italic.ttf
  4. https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold%20Italic.ttf

安装zsh主题

  1. git clone --depth=1 https://gitee.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k

设置zshrc

  1. ZSH_THEME="powerlevel10k/powerlevel10k"
  2. [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh

vim 配置

  1. # 第一步
  2. mkdir ~/.vim
  3. sudo vim ~/.vim/vimrc
  4. sudo mkdir ~/.vim/autoload
  5. sudo curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
  6. https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
  7. # 第二部配置vimrc,将下列复制到vimrc中
  8. let mapleader=" "
  9. "开启高亮
  10. syntax on
  11. "开启行号
  12. set number
  13. "设置字体不会超出当前行的位置
  14. set wrap
  15. "当前行列高亮
  16. set cursorcolumn
  17. set cursorline
  18. highlight CursorLine cterm=NONE ctermbg=black ctermfg=green guibg=NONE guifg=NONE
  19. highlight CursorColumn cterm=NONE ctermbg=black ctermfg=green guibg=NONE guifg=NONE
  20. "让打字显示
  21. set showcmd
  22. "tab补全命令
  23. set wildmenu
  24. "在命令行输入/然后输入要搜索的进行高亮显示
  25. set hlsearch
  26. exec "nohlsearch"
  27. set incsearch
  28. set ignorecase
  29. set smartcase
  30. "搜索完了 这两个= 是下一个 -是上一个并且聚焦
  31. noremap = nzz
  32. noremap - Nzz
  33. "空格然后回车清空所有搜索结果
  34. noremap <LEADER><CR> :nohlsearch<CR>
  35. set nocompatible
  36. filetype on
  37. filetype indent on
  38. filetype plugin on
  39. filetype plugin indent on
  40. set encoding=utf-8
  41. "修改tab缩进距离
  42. set expandtab
  43. set tabstop=2
  44. set shiftwidth=2
  45. set softtabstop=2
  46. set list
  47. set listchars=tab:▸\ ,trail:▫
  48. set scrolloff=5
  49. set tw=0
  50. set indentexpr=
  51. set backspace=indent,eol,start
  52. set foldlevel=99
  53. let &t_SI = "\<Esc>]50;CursorShape=1\x7"
  54. let &t_SR = "\<Esc>]50;CursorShape=2\x7"
  55. let &t_EI = "\<Esc>]50;CursorShape=0\x7"
  56. set autochdir
  57. au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
  58. "命令模式下
  59. "大写S退出
  60. map S :w<CR>
  61. map s <nop>
  62. "大写Q退出
  63. map Q :q<CR>
  64. "加载vim配置
  65. map R :source $MYVIMRC<CR>
  66. "分屏 sr向右分屏 sl向左分屏幕 su向上分屏 sd 向下分屏
  67. map sr :set splitright<CR>:vsplit<CR>
  68. map sl :set nosplitright<CR>:vsplit<CR>
  69. map su :set nosplitbelow<CR>:split<CR>
  70. map sd :set splitbelow<CR>:split<CR>
  71. "分屏移动 Ctrl + l 右移动 Ctrl +j向下 Ctrl+ k向上 Ctrl + h向左
  72. map <C-l> <C-w>l
  73. map <C-k> <C-w>k
  74. map <C-h> <C-w>h
  75. map <C-j> <C-w>j
  76. "z加方向键调整分屏大小
  77. map z<up> :res +5<CR>
  78. map z<down> :res -5<CR>
  79. map z<left> :vertical resize-5<CR>
  80. map z<right> :vertical resize+5<CR>
  81. "插件
  82. call plug#begin('~/.vim/plugged')
  83. Plug 'vim-airline/vim-airline'
  84. Plug 'connorholyday/vim-snazzy'
  85. " File navigation
  86. Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
  87. Plug 'Xuyuanp/nerdtree-git-plugin'
  88. " Taglist
  89. Plug 'majutsushi/tagbar', { 'on': 'TagbarOpenAutoClose' }
  90. " Error checking
  91. Plug 'w0rp/ale'
  92. " Auto Complete
  93. Plug 'Valloric/YouCompleteMe'
  94. " Undo Tree
  95. Plug 'mbbill/undotree/'
  96. " Other visual enhancement
  97. Plug 'nathanaelkane/vim-indent-guides'
  98. Plug 'itchyny/vim-cursorword'
  99. " Git
  100. Plug 'rhysd/conflict-marker.vim'
  101. Plug 'tpope/vim-fugitive'
  102. Plug 'mhinz/vim-signify'
  103. Plug 'gisphm/vim-gitignore', { 'for': ['gitignore', 'vim-plug'] }
  104. " HTML, CSS, JavaScript, PHP, JSON, etc.
  105. Plug 'elzr/vim-json'
  106. Plug 'hail2u/vim-css3-syntax'
  107. Plug 'spf13/PIV', { 'for' :['php', 'vim-plug'] }
  108. Plug 'gko/vim-coloresque', { 'for': ['vim-plug', 'php', 'html', 'javascript', 'css', 'less'] }
  109. Plug 'pangloss/vim-javascript', { 'for' :['javascript', 'vim-plug'] }
  110. Plug 'mattn/emmet-vim'
  111. " Python
  112. Plug 'vim-scripts/indentpython.vim'
  113. " Markdown
  114. Plug 'iamcco/markdown-preview.nvim', { 'do': { -> mkdp#util#install_sync() }, 'for' :['markdown', 'vim-plug'] }
  115. Plug 'dhruvasagar/vim-table-mode', { 'on': 'TableModeToggle' }
  116. Plug 'vimwiki/vimwiki'
  117. " Bookmarks
  118. Plug 'kshenoy/vim-signature'
  119. " Other useful utilities
  120. Plug 'terryma/vim-multiple-cursors'
  121. Plug 'junegunn/goyo.vim' " distraction free writing mode
  122. Plug 'tpope/vim-surround' " type ysks' to wrap the word with '' or type cs'` to change 'word' to `word`
  123. Plug 'godlygeek/tabular' " type ;Tabularize /= to align the =
  124. Plug 'gcmt/wildfire.vim' " in Visual mode, type i' to select all text in '', or type i) i] i} ip
  125. Plug 'scrooloose/nerdcommenter' " in <space>cc to comment a line
  126. " Dependencies
  127. Plug 'MarcWeber/vim-addon-mw-utils'
  128. Plug 'kana/vim-textobj-user'
  129. Plug 'fadein/vim-FIGlet'
  130. call plug#end()
  131. color snazzy
  132. " ===
  133. " === NERDTree
  134. " ===
  135. "ff调出文件目录
  136. map tt :NERDTreeToggle<CR>
  137. let NERDTreeMapOpenExpl = ""
  138. let NERDTreeMapUpdir = ""
  139. let NERDTreeMapUpdirKeepOpen = "l"
  140. let NERDTreeMapOpenSplit = ""
  141. let NERDTreeOpenVSplit = ""
  142. let NERDTreeMapActivateNode = "i"
  143. let NERDTreeMapOpenInTab = "o"
  144. let NERDTreeMapPreview = ""
  145. let NERDTreeMapCloseDir = "n"
  146. let NERDTreeMapChangeRoot = "y"
  147. 复制后 进入vim的命令行模式输入
  148. :PlugInstall
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注