又见炊烟升起

导航

=我的软件常用配置

git

//git配置:
git config --global user.name "nisy"
git config --global user.email "nsynet@qq.com"
//新生成SSH-key【替换成你自己的邮箱】

ssh-keygen -t rsa -C "nsynet@qq.com"
生成后,会在当前用户的目录下,生成一个.ssh隐藏目录,目录中会有【id_rsa】和【id_rsa.pub】两个文件,一个是私钥,一个是公钥。你现在就可以复制使用了

vscode

** 点击变量无法跳转道定义处:
原因:你在装完C++插件的时候,vscode往往会提醒你安装 clang。
​解决: 你不能跳转的关键是你没有把 C_Cpp: IntelliSenseEngine 的开关打开,没有配置 C/C++:Edit Configurations(JSON)。

** vscode标题栏怎么显示项目完整路径-百度经验 (baidu.com)
jingyan.baidu.com/article/fdbd42770b4d8af99e3f4885.html
** VSCode关闭右侧预览功能
关闭方法:点击文件-首选项-设置,搜索"editor.minimap.enabled",默认值为打钩,我们只需要把钩去掉即可
** 搜索到末尾不需要从头开始,关闭如下开关:
image

vim

//.vimrc配置


" ==============vim基本配置==============
set nocompatible
set backspace=indent,eol,start
set guifont=Monospace\ 14
set nu!             " 显示行号
syntax enable
syntax on
colorscheme desert

set autowrite   " 自动保存

set foldmethod=marker
set foldlevel=100  " 启动vim时不要自动折叠代码
set textwidth=80
set formatoptions+=t
set cindent
set smartindent
set noerrorbells
set showmatch
set nobackup 
set noswapfile
" set cursorline

" disable 
noremap <Up> <Nop>
noremap <Down> <Nop>
noremap <Left> <Nop>
noremap <Right> <Nop>

" remap control + arrow key to select windows
noremap <C-Down>  <C-W>j
noremap <C-Up>    <C-W>k
noremap <C-Left>  <C-W>h
noremap <C-Right> <C-W>l
noremap <C-J> <C-W>j
noremap <C-K> <C-W>k
noremap <C-H> <C-W>h
noremap <C-L> <C-W>l

" ==============YCM==============
let g:ycm_server_python_interpreter='/usr/bin/python'
let g:ycm_global_ycm_extra_conf='~/.vim/.ycm_extra_conf.py'
  " YCM 查找定义
let mapleader=','
nnoremap <leader>gl :YcmCompleter GoToDeclaration<CR>
nnoremap <leader>gf :YcmCompleter GoToDefinition<CR>
nnoremap <leader>gg :YcmCompleter GoToDefinitionElseDeclaration<CR>
let g:ycm_collect_identifiers_from_tags_files = 1

set completeopt=menu,menuone   
let g:ycm_add_preview_to_completeopt = 0  " 关闭函数原型提示

let g:ycm_show_diagnostics_ui = 0 " 关闭诊断信息
let g:ycm_server_log_level = 'info'
let g:ycm_min_num_identifier_candidate_chars = 2  " 两个字符触发 补全
let g:ycm_collect_identifiers_from_comments_and_strings = 1 " 收集
let g:ycm_complete_in_strings=1

noremap <c-z> <NOP>
let g:ycm_key_invoke_completion = '<c-z>'   " YCM 里触发语义补全有一个快捷键
let g:ycm_max_num_candidates = 15  " 候选数量

let g:ycm_semantic_triggers =  {
			\ 'c,cpp,python,java,go,erlang,perl': ['re!\w{2}'],
			\ 'cs,lua,javascript': ['re!\w{2}'],
			\ }


" ===========gutentags=============
" 搜索工程目录的标志,碰到这些文件/目录名就停止向上一级目录递归
let g:gutentags_project_root = ['.root', '.svn', '.git', '.hg', '.project', '.gitignore']

" 添加ctags额外参数,会让tags文件变大
" let g:gutentags_ctags_extra_args = ['--fields=+niazlS', '--extra=+q']
 let g:gutentags_ctags_extra_args = ['--fields=+lS']
" let g:gutentags_ctags_extra_args += ['--c++-kinds=+px']
" let g:gutentags_ctags_extra_args += ['--c-kinds=+px']

if isdirectory("kernel/") && isdirectory("mm/")
	let g:gutentags_file_list_command = 'find arch/arm/ mm/ kernel/ include/ init/ lib/'
endif
	

" =======echodoc 显示函数参数===========
" ctags -R --fields=+lS .


" ======ALE静态语法检测========
let g:ale_sign_column_always = 1
let g:ale_sign_error = '✗'
let g:ale_sign_warning = 'w'
let g:ale_statusline_format = ['✗ %d', '⚡ %d', '✔ OK']
let g:ale_echo_msg_format = '[%linter%] %code: %%s'
let g:ale_lint_on_text_changed = 'normal'
let g:ale_lint_on_insert_leave = 1
"let g:airline#extensions#ale#enabled = 1
let g:ale_c_gcc_options = '-Wall -O2 -std=c99'
let g:ale_cpp_gcc_options = '-Wall -O2 -std=c++14'
let g:ale_c_cppcheck_options = ''
let g:ale_cpp_cppcheck_options = ''

" ========airline状态栏=========  
let g:airline#extensions#tabline#enabled = 1
let g:airline_section_b = '%-0.10{getcwd()}'
let g:airline_section_c = '%t'
let g:airline#extensions#tagbar#enabled = 1
let g:airline_section_y = ''

"--------------------------------------------------------------------------------
" cscope:建立数据库:cscope -Rbq;  F5 查找c符号; F6 查找字符串;   F7 查找函数定义; F8 查找函数谁调用了,
"--------------------------------------------------------------------------------
if has("cscope")
  set csprg=/usr/bin/cscope
  set csto=1
  set cst
  set nocsverb
  " add any database in current directory
  if filereadable("cscope.out")
      cs add cscope.out
  endif
  set csverb
endif


:set cscopequickfix=s-,c-,d-,i-,t-,e-

nmap <C-_>s :cs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>g :cs find g <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>c :cs find c <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>t :cs find t <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>e :cs find e <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>f :cs find f <C-R>=expand("<cfile>")<CR><CR>
nmap <C-_>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
nmap <C-_>d :cs find d <C-R>=expand("<cword>")<CR><CR>


"nmap <C-_>s :cs find s <C-R>=expand("<cword>")<CR><CR>
"F5 查找c符号; F6 查找字符串;   F7 查找函数定义; F8 查找函数谁调用了,
nmap <silent> <F5> :cs find s <C-R>=expand("<cword>")<CR><CR> :botright copen<CR><CR> 
nmap <silent> <F6> :cs find t <C-R>=expand("<cword>")<CR><CR> :botright copen<CR><CR>
"nmap <silent> <F7> :cs find g <C-R>=expand("<cword>")<CR><CR> 
nmap <silent> <F7> :cs find c <C-R>=expand("<cword>")<CR><CR> :botright copen<CR><CR>


 "--------------------------------------------------------------------------------
"  自动加载ctags: ctags -R
if filereadable("tags")
      set tags=tags
endif

"--------------------------------------------------------------------------------
" global:建立数据库
"--------------------------------------------------------------------------------
if filereadable("GTAGS")
	set cscopetag
	set cscopeprg=gtags-cscope
	cs add GTAGS
	au BufWritePost *.c,*.cpp,*.h silent! !global -u &
endif

word

//word中关闭自动校正,避免把输入的代码篡改了:【文件】->【选项】->【校对】,关闭所有选项.

source insight

//一般汉字注释需要在公司内约定好是使用UTF-8还是GB2312编码,否则出现乱码时需要手动切换:
source insight 4 中文乱码问题:菜单栏中【File】->【Reload As Encoding...】->【Chinese Simplified (GB2312)】->选择后,点击load,问题解决!
//source insight 中常常有汉字乱码的情况,虽然source insight中可以改编码方式,但是有时unicode,有时ANSI的cp936编码,来回切换很麻烦,可以使用notepad++打开相关代码,在状态栏会现实“CTF-8”或者“ANSI”,然后通过菜单栏的"编码"->"转为UTF-8编码"来切换。

//关闭整个工程的overview窗口 解决方法:Options -> Perferences ->Dispaly 把Overviews (based on file type) 的勾去掉即可

//避免在一个文件中循环地搜索:CTRL+F,去掉 Wrap Around 的勾选
//在C程序里,如果遇到行末没有分号的语句,如IF, WHILE, SWITCH等, 写到该行末按回车,则新行自动相对上一行缩进两列。

Option->File type options->Auto Indient中,Auto Indient Type有三种类型None,Simple,Smart。个人推荐选用Simple类型。

everything 搜索文件名

//everything 加排除文件夹:
C:\Users\nisy\AppData\Roaming\Microsoft\Windows\Recent
或者排除文件类型中加 *.lnk

其他

//WPS中如果写文档拷贝的代码,其英文的双引号会默认自动被替换成中文的双引号,很讨厌,需要在这里关闭掉:
image

posted on 2022-10-16 22:42  ni_sy  阅读(3)  评论(0编辑  收藏  举报