Windows Terminal + Nvim 打造 IDE
最终使用效果图
Windows Terminal 安装
可以在
配置和使用
官方文档 重度依赖命令行用户建议仔细阅读官方文档。
配置终端
建议安装Cascadia Code Font字体,微软开源的编程字体。
配置描述:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | { "$schema": "https://aka.ms/terminal-profiles-schema", "alwaysShowTabs": false, "defaultProfile": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}", // 默认使用的终端(我的是powershell) guid 匹配 "initialCols": 120, // 默认列宽度 "initialRows": 30, // 默认行高度 // 快捷键 "keybindings": [{ "command": "closeTab", "keys": [ "ctrl+shift+w" ] }, { "command": { "action": "splitPane", "split": "vertical" }, "keys": "alt+shift+plus" // 垂直分割窗口 }, { "command": { "action": "splitPane", "split": "horizontal" }, "keys": "alt+shift+-" // 水平分割窗口 }, { "command": { "action": "splitPane", "split": "auto", "splitMode": "duplicate" }, "keys": "alt+shift+d" // 自动分割 } .... ], "requestedTheme": "system",// 标题栏样式,system 跟随系统 "showTabsInTitlebar": true, "showTerminalTitleInTitlebar": true, "wordDelimiters": " ./\\()"'-:,.;<>~!@#$%^&*|+=[]{}~?\u2502", // 终端配置放在这里 "profiles": [{ "acrylicOpacity": 0.5, // 透明度 "background": "#012456", "closeOnExit": true, "colorScheme": "One Half Dark", // 主题对应下面的主题名称 "commandline": "powershell.exe", "cursorColor": "#FFFFFF", "cursorShape": "bar", "fontFace": "Cascadia Mono PL",// Cascadia Code Font 字体 "fontSize": 12, "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}", // 唯一标识 "historySize": 9001, "icon": "ms-appx:///ProfileIcons/{61c54bbd-c2c6-5271-96e7-009a87ff44bf}.png", "name": "Windows PowerShell", "padding": "0, 0, 0, 0", "snapOnInput": true, "startingDirectory": "%USERPROFILE%", "useAcrylic": true, "scrollbarState": "hidden" }, { "acrylicOpacity": 0.5, "closeOnExit": true, "colorScheme": "One Half Dark", "commandline": "bash.exe", // git bash 终端 "cursorColor": "#FFFFFF", "cursorShape": "bar", "fontFace": "Cascadia Mono PL", "fontSize": 12, "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bc}", "historySize": 9001, "icon": "C:\\software\\Git\\icon.png", // 终端图标 "name": "Git bash", "padding": "0, 0, 0, 0", "snapOnInput": true, "startingDirectory": "%USERPROFILE%", "useAcrylic": true, "scrollbarState": "hidden" } ], // 这里是放主题配色的地方 "schemes": [{ "background": "#0C0C0C", "black": "#0C0C0C", "blue": "#0037DA", "brightBlack": "#767676", "brightBlue": "#3B78FF", "brightCyan": "#61D6D6", "brightGreen": "#16C60C", "brightPurple": "#B4009E", "brightRed": "#E74856", "brightWhite": "#F2F2F2", "brightYellow": "#F9F1A5", "cyan": "#3A96DD", "foreground": "#F2F2F2", "green": "#13A10E", "name": "Campbell", // 主题名 "purple": "#881798", "red": "#C50F1F", "white": "#CCCCCC", "yellow": "#C19C00" }, { "background": "#282C34", "black": "#282C34", "blue": "#61AFEF", "brightBlack": "#5A6374", "brightBlue": "#61AFEF", "brightCyan": "#56B6C2", "brightGreen": "#98C379", "brightPurple": "#C678DD", "brightRed": "#E06C75", "brightWhite": "#DCDFE4", "brightYellow": "#E5C07B", "cyan": "#56B6C2", "foreground": "#DCDFE4", "green": "#98C379", "name": "One Half Dark", // 主题名 "purple": "#C678DD", "red": "#E06C75", "white": "#DCDFE4", "yellow": "#E5C07B" } ] } |
快捷键:
ProwShell 美化
依赖
使用 PowerShell,安装
1 2 | Install-Module posh-git -Scope CurrentUser Install-Module oh-my-posh -Scope CurrentUser |
在
1 2 3 | Import-Module posh-git Import-Module oh-my-posh Set-Theme Paradox |
重器
这里如果无法安装使用
1 2 | ? get-executionpolicy RemoteSigned |
可以使用
NVIM 安装
neovim
windows 用户配置文件在
安装 Vim-Plug
1 2 3 4 5 6 7 8 | md ~\AppData\Local\nvim\autoload $uri = 'https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' (New-Object Net.WebClient).DownloadFile( $uri, $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath( "~\AppData\Local\nvim-data\site\autoload\plug.vim" ) ) |
配置 vim
我的配置,此配置中有导航栏,状态栏,
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 | " set nocompatible " 关闭兼容模式 " filetype off " 关闭自动补全 set number " 打开行号设置 set encoding=utf-8 set ruler " 光标信息 set hlsearch " 高亮显示搜索 set incsearch " 边搜索边高亮 set ignorecase " 忽悠大小写 set cursorline " 突出当前显示行 set ts=4 " tab 占4个字符宽度 set softtabstop=4 set shiftwidth=4 set expandtab set autoindent " 复制上一行的缩进 " expandtab " tab为4个空格 autocmd Filetype html setlocal ts=2 sw=2 expandtab autocmd Filetype css setlocal ts=2 sw=2 expandtab autocmd Filetype javascript setlocal ts=2 sw=2 expandtab autocmd Filetype json setlocal ts=2 sw=2 expandtab syntax enable " 语法高亮 syntax on " set t_Co=256 " 开启24bit的颜色,开启这个颜色会更漂亮一些 set termguicolors set background=dark " colorscheme desert " packadd! dracula " colorscheme one " 最后加载 gruvbox 主题 autocmd vimenter * colorscheme gruvbox let g:airline_theme='one' " 取消备份 set nobackup set noswapfile " 退出插入模式自动保存 " au InsertLeave *.go,*.java,*.c,*.cpp,*.js,*.html,*.css,*.tpl,*.sh,*.bat,*.conf write let mapleader=";" " 定义快捷键前缀,即<Leader> " ==== 系统剪切板复制粘贴 ==== " v 模式下复制内容到系统剪切板 vmap <Leader>c "+yy " n 模式下复制一行到系统剪切板 nmap <Leader>c "+yy " n 模式下粘贴系统剪切板的内容 nmap <Leader>v "+p " 解决插入模式下delete/backspce键失效问题 set backspace=2 " 插件配置 call plug#begin('~/.vim/plugged') " vim 状态栏 Plug 'vim-airline/vim-airline' Plug 'vim-airline/vim-airline-themes' " 左侧导航目录 Plug 'scrooloose/nerdtree' " 侧边栏美化(需要下载字体,暂时不用) " Plug 'ryanoasis/vim-devicons' " 文件搜索插件 Plug 'kien/ctrlp.vim' " 方法大纲搜索 Plug 'tacahiroy/ctrlp-funky' " 大纲 Plug 'majutsushi/tagbar' " editorconfig 插件 Plug 'editorconfig/editorconfig-vim' " 快速注释插件 Plug 'scrooloose/nerdcommenter' " vim 文件左侧 git 状态 Plug 'airblade/vim-gitgutter' " git 插件 Plug 'tpope/vim-fugitive' " go 语言相关插件 Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' } " Plug 'volgar1x/vim-gocode' " 主题 Plug 'dracula/vim', { 'as': 'dracula' } " colorscheme one Plug 'rakr/vim-one' Plug 'morhetz/gruvbox' " 可以在导航目录中看到 git 版本信息 Plug 'Xuyuanp/nerdtree-git-plugin' " 自动补全括号的插件,包括小括号,中括号,以及花括号 " Plug 'jiangmiao/auto-pairs' " 可以使 nerdtree Tab 标签的名称更友好些 " Plug 'jistr/vim-nerdtree-tabs' " html 神器 Plug 'mattn/emmet-vim' " 补全插件 Plug 'neoclide/coc.nvim', {'branch': 'release'} " markdown 插件 " rust 插件 Plug 'rust-lang/rust.vim' " 翻译插件 (按需使用) " Plug 'JavaHello/vim-fy' call plug#end() "============================================================================== " nerdtree 文件列表插件配置 "============================================================================== let g:NERDTreeDirArrowExpandable = '?' let g:NERDTreeDirArrowCollapsible = '?' " 显示行号 " let NERDTreeShowLineNumbers=1 " 设置宽度 let NERDTreeWinSize=31 " 自动打开 nerdtree autocmd StdinReadPre * let s:std_in=1 autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | endif " 使用 vim 而不是 vim . autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif " 打开任意文件启动 nerdtree 我不需要 " autocmd vimenter * NERDTree " 打开 vim 文件及显示书签列表 " let NERDTreeShowBookmarks=2 " 忽略一下文件的显示 let NERDTreeIgnore=['\.pyc','\~$','\.swp'] "============================================================================== " ctrlp.vim 文件搜索插件配置 "============================================================================== " 快捷键配置 let g:ctrlp_map = '<c-p>' let g:ctrlp_cmd = 'CtrlP' " 设置工作目录读取方式 let g:ctrlp_working_path_mode = 'ra' " 忽略搜索文件 "let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$' let g:ctrlp_custom_ignore = { \ 'dir': '\v[\/](\.git|\.hg|\.svn|target|node_modules)$', \ 'file': '\v\.(exe|so|dll|class)$', \ 'link': 'some_bad_symbolic_links', \ } "============================================================================== " ctrlp-funky 插件配置 "============================================================================== map <F6> :CtrlPFunky<cr> let g:ctrlp_extensions = ['funky'] let g:ctrlp_funky_syntax_highlight = 1 "============================================================================== " tagbar 插件配置 "============================================================================== " map <F5> :TagbarToggle<cr> let g:tagbar_type_go = { \ 'ctagstype' : 'go', \ 'kinds' : [ \ 'p:package', \ 'i:imports:1', \ 'c:constants', \ 'v:variables', \ 't:types', \ 'n:interfaces', \ 'w:fields', \ 'e:embedded', \ 'm:methods', \ 'r:constructor', \ 'f:functions' \ ], \ 'sro' : '.', \ 'kind2scope' : { \ 't' : 'ctype', \ 'n' : 'ntype' \ }, \ 'scope2kind' : { \ 'ctype' : 't', \ 'ntype' : 'n' \ }, \ 'ctagsbin' : 'gotags', \ 'ctagsargs' : '-sort -silent' \ } "============================================================================== " vim-airline 配置 "============================================================================== " 启用显示缓冲区 let g:airline#extensions#tabline#enabled = 1 "============================================================================== " nerdocmmenter 注释插件配置 "============================================================================== let g:NERDSpaceDelims = 1 " 默认情况下,在注释分割符后添加空格 let g:NERDCompactSexyComs = 1 " 使用紧凑语法进行美化的多行s注释 let g:NERDDefaultAlign = 'left' " 让对齐向注释分割符向左而不是跟随代码缩进 let g:NERDAltDelims_java = 1 " 默认情况,将语言设置为使用其备用分割符 let g:NERDCustomDelimiters = { 'c': { 'left': '/**', 'right': '*/'}} " 添加自定义格式 let g:NERDCommentEmptyLines = 1 " 允许注释和反转空行(在注释区域时很有用) let g:NERDTrimTrailingWhitespace = 1 " 在取消s注释时启用尾部空格的修剪 let g:NERDToggleCheckAllLines = 1 " 启用检查是否以注释 "============================================================================== " vim-go 插件 "============================================================================== let g:go_fmt_command = "goimports" " 格式化将默认的 gofmt 替换 let g:go_autodetect_gopath = 1 let g:go_list_type = "quickfix" let g:go_version_warning = 1 let g:go_highlight_types = 1 let g:go_highlight_fields = 1 let g:go_highlight_functions = 1 let g:go_highlight_function_calls = 1 let g:go_highlight_operators = 1 let g:go_highlight_extra_types = 1 let g:go_highlight_methods = 1 let g:go_highlight_generate_tags = 1 let g:godef_split=2 "============================================================================== " nerdtree-git-plugin 插件 "============================================================================== let g:NERDTreeIndicatorMapCustom = { \ "Modified" : "?", \ "Staged" : "?", \ "Untracked" : "?", \ "Renamed" : "?", \ "Unmerged" : "═", \ "Deleted" : "?", \ "Dirty" : "?", \ "Clean" : "??", \ 'Ignored' : '?', \ "Unknown" : "?" \ } let g:NERDTreeShowIgnoredStatus = 1 "============================================================================== " coc.nvim 插件 "============================================================================== " TextEdit might fail if hidden is not set. set hidden " Some servers have issues with backup files, see #649. set nobackup set nowritebackup " Give more space for displaying messages. set cmdheight=2 " Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable " delays and poor user experience. set updatetime=300 " Don't pass messages to |ins-completion-menu|. set shortmess+=c " Always show the signcolumn, otherwise it would shift the text each time " diagnostics appear/become resolved. if has("patch-8.1.1564") " Recently vim can merge signcolumn and number column into one set signcolumn=number else set signcolumn=yes endif " Use tab for trigger completion with characters ahead and navigate. " NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by " other plugin before putting this into your config. inoremap <silent><expr> <TAB> \ pumvisible() ? "\<C-n>" : \ <SID>check_back_space() ? "\<TAB>" : \ coc#refresh() inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>" function! s:check_back_space() abort let col = col('.') - 1 return !col || getline('.')[col - 1] =~# '\s' endfunction " Use <c-space> to trigger completion. inoremap <silent><expr> <c-space> coc#refresh() " Use <cr> to confirm completion, `<C-g>u` means break undo chain at current " position. Coc only does snippet and additional edit on confirm. " <cr> could be remapped by other vim plugin, try `:verbose imap <CR>`. if exists('*complete_info') inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>" else inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>" endif " Use `[g` and `]g` to navigate diagnostics nmap <silent> [g <Plug>(coc-diagnostic-prev) nmap <silent> ]g <Plug>(coc-diagnostic-next) " GoTo code navigation. nmap <silent> gd <Plug>(coc-definition) nmap <silent> gy <Plug>(coc-type-definition) nmap <silent> gi <Plug>(coc-implementation) nmap <silent> gr <Plug>(coc-references) " Use K to show documentation in preview window. nnoremap <silent> K :call <SID>show_documentation()<CR> function! s:show_documentation() if (index(['vim','help'], &filetype) >= 0) execute 'h '.expand('<cword>') else call CocAction('doHover') endif endfunction " Highlight the symbol and its references when holding the cursor. autocmd CursorHold * silent call CocActionAsync('highlight') " Symbol renaming. nmap <leader>rn <Plug>(coc-rename) " Formatting selected code. xmap <leader>f <Plug>(coc-format-selected) nmap <leader>f <Plug>(coc-format-selected) augroup mygroup autocmd! " Setup formatexpr specified filetype(s). autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected') " Update signature help on jump placeholder. autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') augroup end " Applying codeAction to the selected region. " Example: `<leader>aap` for current paragraph xmap <leader>a <Plug>(coc-codeaction-selected) nmap <leader>a <Plug>(coc-codeaction-selected) " Remap keys for applying codeAction to the current buffer. nmap <leader>ac <Plug>(coc-codeaction) " Apply AutoFix to problem on the current line. nmap <leader>qf <Plug>(coc-fix-current) " Map function and class text objects " NOTE: Requires 'textDocument.documentSymbol' support from the language server. xmap if <Plug>(coc-funcobj-i) omap if <Plug>(coc-funcobj-i) xmap af <Plug>(coc-funcobj-a) omap af <Plug>(coc-funcobj-a) xmap ic <Plug>(coc-classobj-i) omap ic <Plug>(coc-classobj-i) xmap ac <Plug>(coc-classobj-a) omap ac <Plug>(coc-classobj-a) " Use CTRL-S for selections ranges. " Requires 'textDocument/selectionRange' support of LS, ex: coc-tsserver nmap <silent> <C-s> <Plug>(coc-range-select) xmap <silent> <C-s> <Plug>(coc-range-select) " Add `:Format` command to format current buffer. command! -nargs=0 Format :call CocAction('format') " Add `:Fold` command to fold current buffer. command! -nargs=? Fold :call CocAction('fold', <f-args>) " Add `:OR` command for organize imports of the current buffer. command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport') " Add (Neo)Vim's native statusline support. " NOTE: Please see `:h coc-status` for integrations with external plugins that " provide custom statusline: lightline.vim, vim-airline. set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')} " Mappings using CoCList: " Show all diagnostics. nnoremap <silent> <space>a :<C-u>CocList diagnostics<cr> " Manage extensions. nnoremap <silent> <space>e :<C-u>CocList extensions<cr> " Show commands. nnoremap <silent> <space>c :<C-u>CocList commands<cr> " Find symbol of current document. nnoremap <silent> <space>o :<C-u>CocList outline<cr> " Search workspace symbols. nnoremap <silent> <space>s :<C-u>CocList -I symbols<cr> " Do default action for next item. nnoremap <silent> <space>j :<C-u>CocNext<CR> " Do default action for previous item. nnoremap <silent> <space>k :<C-u>CocPrev<CR> " Resume latest coc list. nnoremap <silent> <space>p :<C-u>CocListResume<CR> "============================================================================== " gui 配置 "============================================================================== if has('gui_running') set guifont=Cascadia\ Mono\ PL\ 13 endif "============================================================================== " fy 插件配置 (按需使用) "============================================================================== " vnoremap <silent> <C-T> :<C-u>Fyv<CR> " nnoremap <silent> <C-T> :<C-u>Fyc<CR> |
配置完后进入
coc.nvim 配置增强代码提示
进入
1 | :CocInstall coc-java // java 插件,有代码提示,跳转到定义,显示 doc 等功能 |
常用快捷键:
K(大写) 显示文档g +r 查看引用g +d 跳转到定义