怎么做简单的视频网站,北京哪里有教怎么做网站的,深圳个人形象设计,广东网站设计招工.Termux配置Vim C开发环境#xff0c;打造基于终端命令行的IDE
主要利用VimCoc插件#xff0c;配置C的代码提示等功能。
Termux换源
打开termux#xff0c;输入termux-change-repo
找到mirrors.tuna.tsinghua.edu.cn#xff0c;清华源#xff0c;空格选中#xff0c;回…Termux配置Vim C开发环境打造基于终端命令行的IDE
主要利用VimCoc插件配置C的代码提示等功能。
Termux换源
打开termux输入termux-change-repo
找到mirrors.tuna.tsinghua.edu.cn清华源空格选中回车确认 Termux配置ssh
有了ssh后就可以方便的在PC或者其它平台上使用ssh工具远程termux终端了
# 安装
apt install open-ssh
# 启动sshd默认端口为8022
sshd
# 关闭sshd
pkill sshd
# 查看sshd是否运行
ps aux | grep sshd默认没有密码使用passwd命令配置密码
ssh user192.168.0.11 -p 8022user用户名可以用whoami命令查看一般termux用户名为u0_xxxx
软件包管理简介
termux使用pkg管理软件包并且可以使用apt别名
例如更新仓库和软件
pkg update
apt update
pkg upgrade
apt upgrade两个命令都可以apt命令对使用过Debian的人非常友好。以下全部使用apt
安装命令就是
apt install xxx安装基础软件
vim编辑器clangC编译器并且提供了g别名cmake管理C项目配置git源码仓库工具nodejsC开发很少用到nodejs主要是为vim插件提供运行环境python3提供环境
apt install vim clang cmake git nodejs python3Vim基础配置
主要配置缩进、tab空格、文件编码、行号等可以根据自己的需求配置
配置项非常少很基础
vim .vimrc编辑.vimrc文件将以下内容输入 vim base config
set nocompatible
syntax on
set showmode
set showcmd
set encodingutf-8
set t_Co256
filetype indent on
set softtabstop4
set tabstop4
set shiftwidth4
set expandtab
set autoindent
set number
set cursorline安装Vim插件
VimPlug用来管理Vim插件之后的插件都需要用它来安装vim-code-darkVsCode主题
VimPlug插件管理
VimPlug主页提供了安装方法
复制下面的命令到终端并执行
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim安装完成后编辑.vimrc文件添加如下代码段 plugin
call plug#begin()Plug xxxcall plug#end()中间的Plug xxx就是代表安装xxx插件每个插件一行
每当想安装新的插件时先编辑vimrc再重新进入vim命令模式输入:PlugInstall就会安装插件
卸载插件时编辑vimrc删除插件那一行然后进入vim命令模式输入:PlugClean不在列表里的插件就会被清理
:PlugUpdate更新插件
:PlugUpgrade更新VimPlug本身
VsCode颜色主题
Vim自己的高亮不好看我选择了VsCode主题
Plug tomasiser/vim-code-dark添加上述代码重新打开vim并运行PlugInstall出现Finishing … Done!且插件名称后面显示100%时说明安装成功 再次编辑vimrc添加如下代码
colorscheme codedark再次打开vim时已经变为VsCode主题 Coc代码提示
参考Coc主页安装方式如下
Plug neoclide/coc.nvim, {branch: release}同样运行:PlugInstall就可以安装Coc依赖于NodeJs
Coc是类似VimPlug的管理工具具体的语言支持还需要安装语言包
其插件列表可以在CocWiki看到
注意这里的插件指的是Coc插件他们往往都按照coc-xxx命名例如coc-clangd、coc-json等
安装插件需要使用:CocInstall命令例如
CocInstall coc-json coc-tsserverCoc也需要配置配置很多我也没看明白官网给了一个示例主要是配置快捷键补全等功能。
对于C开发环境需要的Coc插件有
coc-clangd提供C语言服务支持coc-cmake提供cmake支持
coc-clangd
安装coc-clangd依赖于clangd在termux中使用apt install clang来安装
:ConInstall coc-clangd安装完成后可以编辑一个cpp文件尝试效果Tab用来选择候选项Enter用来确认
对于多文件项目或者CMake项目插件需要读取compile_commands.json文件这个文件需要在编译时生成。
CMake在构建项目时生成该文件指令为
cmake -S . -B build -DCMAKE_BUILD_TYPEDebug -DCMAKE_EXPORT_COMPILE_COMMANDSTRUE-S指定源代码文件夹-B指定输出目录-DCMAKE_BUILD_TYPE设置构建类型-DCMAKE_EXPORT_COMPILE_COMMANDS指定生成compile_commands.json文件 coc-cmake
依赖cmake lsp
pip install cmake-language-server:CocInstall coc-cmake然后就可以使用了
括号补全
使用auto-pairs插件
Plug jiangmiao/auto-pairs无需任何配置
代码格式化
使用vim-clang-format插件参考其主页安装
依赖于clang-format在Termux下安装clang就行
Plug rhysd/vim-clang-format安装完成后可以参考如下代码或者ClangFormat主页配置格式化风格
let g:clang_format#code_styleWebKit格式化命令为:ClangFormat
为了方便把CtrlShifti映射为该命令在常规模式下有效
nnoremap C-S-i :ClangFormatCR缩进参考线
indentLine插件
Plug Yggdroot/indentLine无需配置 最终vimrc源码 vim base config
set nocompatible
syntax on
set showmode
set showcmd
set encodingutf-8
set t_Co256
filetype indent on
set softtabstop4
set tabstop4
set shiftwidth4
set expandtab
set autoindent
set number
set cursorline vim plug
call plug#begin()Plug tomasiser/vim-code-dark
Plug neoclide/coc.nvim, {branch: release}
Plug jiangmiao/auto-pairs
Plug rhysd/vim-clang-format
Plug Yggdroot/indentLinecall plug#end() vscode theme
colorscheme codedarkClang Format
let g:clang_format#code_styleWebKit
nnoremap C-S-i :ClangFormatCR Coc Config Use tab for trigger completion with characters ahead and navigateNOTE: Theres always complete item selected by default, you may want to enableno select by suggest.noselect: true in your configuration fileNOTE: Use command :verbose imap tab to make sure tab is not mapped byother plugin before putting this into your config
inoremap silentexpr TAB\ coc#pum#visible() ? coc#pum#next(1) :\ CheckBackspace() ? \Tab :\ coc#refresh()
inoremap exprS-TAB coc#pum#visible() ? coc#pum#prev(1) : \C-h Make CR to accept selected completion item or notify coc.nvim to formatC-gu breaks current undo, please make your own choice
inoremap silentexpr CR coc#pum#visible() ? coc#pum#confirm()\: \C-gu\CR\c-rcoc#on_enter()\CRfunction! CheckBackspace() abortlet col col(.) - 1return !col || getline(.)[col - 1] ~# \s
endfunction Use c-space to trigger completion
if has(nvim)inoremap silentexpr c-space coc#refresh()
elseinoremap silentexpr c- coc#refresh()
endif Use [g and ]g to navigate diagnosticsUse :CocDiagnostics to get all diagnostics of current buffer in location list
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 ShowDocumentation()CRfunction! ShowDocumentation()if CocAction(hasProvider, hover)call CocActionAsync(doHover)elsecall feedkeys(K, in)endif
endfunction Highlight the symbol and its references when holding the cursor
autocmd CursorHold * silent call CocActionAsync(highlight) Symbol renaming
nmap leaderrn Plug(coc-rename) Formatting selected code
xmap leaderf Plug(coc-format-selected)
nmap leaderf Plug(coc-format-selected)augroup mygroupautocmd! Setup formatexpr specified filetype(s)autocmd FileType typescript,json setl formatexprCocAction(formatSelected) Update signature help on jump placeholderautocmd User CocJumpPlaceholder call CocActionAsync(showSignatureHelp)
augroup end Applying code actions to the selected code blockExample: leaderaap for current paragraph
xmap leadera Plug(coc-codeaction-selected)
nmap leadera Plug(coc-codeaction-selected) Remap keys for applying code actions at the cursor position
nmap leaderac Plug(coc-codeaction-cursor)Remap keys for apply code actions affect whole buffer
nmap leaderas Plug(coc-codeaction-source)Apply the most preferred quickfix action to fix diagnostic on the current line
nmap leaderqf Plug(coc-fix-current) Remap keys for applying refactor code actions
nmap silent leaderre Plug(coc-codeaction-refactor)
xmap silent leaderr Plug(coc-codeaction-refactor-selected)
nmap silent leaderr Plug(coc-codeaction-refactor-selected) Run the Code Lens action on the current line
nmap leadercl Plug(coc-codelens-action) Map function and class text objectsNOTE: 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) Remap C-f and C-b to scroll float windows/popups
if has(nvim-0.4.0) || has(patch-8.2.0750)nnoremap silentnowaitexpr C-f coc#float#has_scroll() ? coc#float#scroll(1) : \C-fnnoremap silentnowaitexpr C-b coc#float#has_scroll() ? coc#float#scroll(0) : \C-binoremap silentnowaitexpr C-f coc#float#has_scroll() ? \c-rcoc#float#scroll(1)\cr : \Rightinoremap silentnowaitexpr C-b coc#float#has_scroll() ? \c-rcoc#float#scroll(0)\cr : \Leftvnoremap silentnowaitexpr C-f coc#float#has_scroll() ? coc#float#scroll(1) : \C-fvnoremap silentnowaitexpr C-b coc#float#has_scroll() ? coc#float#scroll(0) : \C-b
endif Use CTRL-S for selections rangesRequires textDocument/selectionRange support of language server
nmap silent C-s Plug(coc-range-select)
xmap silent C-s Plug(coc-range-select) Add :Format command to format current buffer
command! -nargs0 Format :call CocActionAsync(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! -nargs0 OR :call CocActionAsync(runCommand, editor.action.organizeImport) Add (Neo)Vims native statusline supportNOTE: Please see :h coc-status for integrations with external plugins thatprovide custom statusline: lightline.vim, vim-airline
set statusline^%{coc#status()}%{get(b:,coc_current_function,)} Mappings for CoCListShow all diagnostics
nnoremap silentnowait spacea :C-uCocList diagnosticscrManage extensions
nnoremap silentnowait spacee :C-uCocList extensionscrShow commands
nnoremap silentnowait spacec :C-uCocList commandscrFind symbol of current document
nnoremap silentnowait spaceo :C-uCocList outlinecrSearch workspace symbols
nnoremap silentnowait spaces :C-uCocList -I symbolscrDo default action for next item
nnoremap silentnowait spacej :C-uCocNextCRDo default action for previous item
nnoremap silentnowait spacek :C-uCocPrevCRResume latest coc list
nnoremap silentnowait spacep :C-uCocListResumeCR 文章转载自: http://www.morning.jxdhc.cn.gov.cn.jxdhc.cn http://www.morning.rwpjq.cn.gov.cn.rwpjq.cn http://www.morning.gpkjx.cn.gov.cn.gpkjx.cn http://www.morning.szzxqc.com.gov.cn.szzxqc.com http://www.morning.jbtzx.cn.gov.cn.jbtzx.cn http://www.morning.dqzcf.cn.gov.cn.dqzcf.cn http://www.morning.ywpwq.cn.gov.cn.ywpwq.cn http://www.morning.fygbq.cn.gov.cn.fygbq.cn http://www.morning.cpnlq.cn.gov.cn.cpnlq.cn http://www.morning.jghty.cn.gov.cn.jghty.cn http://www.morning.qrwnj.cn.gov.cn.qrwnj.cn http://www.morning.psxcr.cn.gov.cn.psxcr.cn http://www.morning.rybr.cn.gov.cn.rybr.cn http://www.morning.phnbd.cn.gov.cn.phnbd.cn http://www.morning.dyzbt.cn.gov.cn.dyzbt.cn http://www.morning.qkwxp.cn.gov.cn.qkwxp.cn http://www.morning.mtrrf.cn.gov.cn.mtrrf.cn http://www.morning.bdzps.cn.gov.cn.bdzps.cn http://www.morning.rdzgm.cn.gov.cn.rdzgm.cn http://www.morning.npxht.cn.gov.cn.npxht.cn http://www.morning.msmtf.cn.gov.cn.msmtf.cn http://www.morning.jxfmn.cn.gov.cn.jxfmn.cn http://www.morning.lwtfx.cn.gov.cn.lwtfx.cn http://www.morning.rxnr.cn.gov.cn.rxnr.cn http://www.morning.tjcgl.cn.gov.cn.tjcgl.cn http://www.morning.sqhtg.cn.gov.cn.sqhtg.cn http://www.morning.gryzk.cn.gov.cn.gryzk.cn http://www.morning.gbkkt.cn.gov.cn.gbkkt.cn http://www.morning.mpbgy.cn.gov.cn.mpbgy.cn http://www.morning.rbylq.cn.gov.cn.rbylq.cn http://www.morning.xqndf.cn.gov.cn.xqndf.cn http://www.morning.lyhry.cn.gov.cn.lyhry.cn http://www.morning.pmdzd.cn.gov.cn.pmdzd.cn http://www.morning.kpbgp.cn.gov.cn.kpbgp.cn http://www.morning.qjlnh.cn.gov.cn.qjlnh.cn http://www.morning.kdjtt.cn.gov.cn.kdjtt.cn http://www.morning.mjbnp.cn.gov.cn.mjbnp.cn http://www.morning.qnhcx.cn.gov.cn.qnhcx.cn http://www.morning.gypcr.cn.gov.cn.gypcr.cn http://www.morning.sblgt.cn.gov.cn.sblgt.cn http://www.morning.njstzsh.com.gov.cn.njstzsh.com http://www.morning.qwnqt.cn.gov.cn.qwnqt.cn http://www.morning.plqsc.cn.gov.cn.plqsc.cn http://www.morning.xcfmh.cn.gov.cn.xcfmh.cn http://www.morning.ffrys.cn.gov.cn.ffrys.cn http://www.morning.zphlb.cn.gov.cn.zphlb.cn http://www.morning.hwzzq.cn.gov.cn.hwzzq.cn http://www.morning.jtqxs.cn.gov.cn.jtqxs.cn http://www.morning.krjyq.cn.gov.cn.krjyq.cn http://www.morning.nfks.cn.gov.cn.nfks.cn http://www.morning.rfkyb.cn.gov.cn.rfkyb.cn http://www.morning.dxxnq.cn.gov.cn.dxxnq.cn http://www.morning.lbrrn.cn.gov.cn.lbrrn.cn http://www.morning.c7625.cn.gov.cn.c7625.cn http://www.morning.gmswp.cn.gov.cn.gmswp.cn http://www.morning.gmyhq.cn.gov.cn.gmyhq.cn http://www.morning.wwnb.cn.gov.cn.wwnb.cn http://www.morning.hmfxl.cn.gov.cn.hmfxl.cn http://www.morning.ydxwj.cn.gov.cn.ydxwj.cn http://www.morning.mxdiy.com.gov.cn.mxdiy.com http://www.morning.nkjxn.cn.gov.cn.nkjxn.cn http://www.morning.tsqpd.cn.gov.cn.tsqpd.cn http://www.morning.lmmyl.cn.gov.cn.lmmyl.cn http://www.morning.sh-wj.com.cn.gov.cn.sh-wj.com.cn http://www.morning.fglth.cn.gov.cn.fglth.cn http://www.morning.wtcd.cn.gov.cn.wtcd.cn http://www.morning.lyhrg.cn.gov.cn.lyhrg.cn http://www.morning.dtrzw.cn.gov.cn.dtrzw.cn http://www.morning.xqndf.cn.gov.cn.xqndf.cn http://www.morning.pszw.cn.gov.cn.pszw.cn http://www.morning.krhkn.cn.gov.cn.krhkn.cn http://www.morning.jzlkq.cn.gov.cn.jzlkq.cn http://www.morning.kfstq.cn.gov.cn.kfstq.cn http://www.morning.zmwd.cn.gov.cn.zmwd.cn http://www.morning.tbcfj.cn.gov.cn.tbcfj.cn http://www.morning.lgpzq.cn.gov.cn.lgpzq.cn http://www.morning.zqfz.cn.gov.cn.zqfz.cn http://www.morning.spkw.cn.gov.cn.spkw.cn http://www.morning.rrqgf.cn.gov.cn.rrqgf.cn http://www.morning.fdlyh.cn.gov.cn.fdlyh.cn