更换国内源 & 更新
|
|
安装软件
|
|
配置
配置Zsh: oh-my-zsh
将默认bash更换为zsh:
|
|
安装oh-my-zsh
:
|
|
配置代理: proxychains
Proxychains
可以使任何程序通过代理上网,给终端环境下的命令带来了很多便利。
修改/etc/proxychains.conf
末尾行:
|
|
为(此处假设10808为Clash或V2Ray的代理端口):
|
|
终端命令使用代理:
|
|
VIM配置
更换最新的Vim发行仓库并更新Vim
|
|
VIM-Plug插件管理器
|
|
coc.nvim
(1) 安装coc依赖
|
|
插件安装,在vim命令模式下输入:
|
|
(2) C/C++程序生成 compile_commands.json
-
对采用
cmake
编译的程序,例如FlameMaster
1 2 3 4
# Recompile with `-DCMAKE_EXPORT_COMPILE_COMMANDS=1 option` cmake ../Repository -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=1 cmake --build . --parallel --target install --config Release cp compile_commands.json ../Repository/
-
对直接采用
make
编译的程序,例如OpenFOAM
参考 教程.
对较低版本的OpenFOAM,修改 OpenFOAM-2.3.1/wmake/wmake:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
+#------------------------------------------------------------------------------ +# check if bear is installed and we are not already running under bear +#------------------------------------------------------------------------------ + +if [ -z "${RUNNING_UNDER_BEAR}" ] ; then + if ! bear --version > /dev/null ; then + echo "WARNING: bear is not installed -> There will be no compile_commands.json output." 1>&2 + elif printf '%s\n%s\n' "bear 3.0.0" "$(bear --version)" | sort -V -C ; then + #bear version >= 3.0.0 + export RUNNING_UNDER_BEAR=true + mkdir -p $FOAM_LIBBIN + bear --append --output $FOAM_LIBBIN/../compile_commands.json -- wmake $@ + exit $? + elif printf '%s\n%s\n' "bear 2.0.0" "$(bear --version)" | sort -V -C ; then + #bear version >= 2.0.0 + export RUNNING_UNDER_BEAR=true + mkdir -p $FOAM_LIBBIN + bear --append -o $FOAM_LIBBIN/../compile_commands.json wmake $@ + exit $? + else + echo "WARNING: bear version is below 2.0.0 -> There will be no compile_commands.json output." 1>&2 + fi +fi
在
OpenFOAM-2.3.1/bin/tools
中添加vscode-settings
。Generate VSCode setting files:
1 2 3 4 5 6 7
cd $WM_PROJECT_DIR mkdir .vscode ./bin/tools/vscode-setting > .vscode/settings.json # Clean OpenFOAM installation wclean all # Re-build ./Allwmake
创建软链接:
VIM
/coc.nvim
:1 2
cd $WM_PROJECT_DIR ln -s ~/OpenFOAM/OpenFOAM-2.3.1/platforms/linux64GccDPOpt/compile_commands.json ./compile_commands.json
(4) 附录:
coc-settings.json
(位于~/.vim
下):1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
{ "languageserver": { "ccls": { "command": "ccls", "filetypes": ["c", "cc", "cpp", "c++", "objc", "objcpp"], "rootPatterns": [".ccls", "compile_commands.json", ".git/", ".root"], "initializationOptions": { "cache": { "directory": ".cache/ccls" }, "highlight": {"lsRanges": true } } }, "fortran": { "command": "fortls", "filetypes": ["fortran"], "rootPatterns": [".fortls", ".git/"] } }