update vim conf
This commit is contained in:
parent
29fe661959
commit
35cb03ce8f
@ -5,10 +5,13 @@
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
ctags -I __THROW --file-scope=yes --langmap=c:+.h --languages=c,c++ --links=yes --c-kinds=+p --fields=+S -R -f ~/.vim/systags /usr/include /usr/local/include
|
ctags -I __THROW --file-scope=yes --langmap=c:+.h --languages=c,c++ --links=yes --c-kinds=+p --fields=+S -R -f ~/.vim/systags /usr/include /usr/local/include
|
||||||
|
ctags -I __THROW -I __THROWNL -I __attribute_pure__ -I __nonnull -I __attribute__ --file-scope=yes --langmap=c:+.h --languages=c,c++ --links=yes --c-kinds=+p --fields=+S -R -f ~/.vim/systags /usr/include /usr/local/include /opt/ros/melodic/include
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## python
|
## python
|
||||||
|
|
||||||
``` bash
|
``` bash
|
||||||
|
|||||||
19
vim/vimrc
19
vim/vimrc
@ -4,7 +4,9 @@ call vundle#begin()
|
|||||||
|
|
||||||
Plugin 'VundleVim/Vundle.vim'
|
Plugin 'VundleVim/Vundle.vim'
|
||||||
|
|
||||||
" hightlight
|
Plugin 'https://github.com/taketwo/vim-ros.git'
|
||||||
|
|
||||||
|
"hightlight
|
||||||
|
|
||||||
Plugin 'octol/vim-cpp-enhanced-highlight'
|
Plugin 'octol/vim-cpp-enhanced-highlight'
|
||||||
let g:cpp_class_scope_highlight = 1
|
let g:cpp_class_scope_highlight = 1
|
||||||
@ -33,7 +35,7 @@ set runtimepath+=~/.vim/bundle/YouCompleteMe
|
|||||||
autocmd InsertLeave * if pumvisible() == 0|pclose|endif "离开插入模式后自动关闭预览窗口"
|
autocmd InsertLeave * if pumvisible() == 0|pclose|endif "离开插入模式后自动关闭预览窗口"
|
||||||
let g:ycm_collect_identifiers_from_tags_files = 1 " 开启 YCM基于标签引擎
|
let g:ycm_collect_identifiers_from_tags_files = 1 " 开启 YCM基于标签引擎
|
||||||
let g:ycm_collect_identifiers_from_comments_and_strings = 1 " 注释与字符串中的内容也用于补全
|
let g:ycm_collect_identifiers_from_comments_and_strings = 1 " 注释与字符串中的内容也用于补全
|
||||||
let g:syntastic_ignore_files=[".*\.py$"]
|
"let g:syntastic_ignore_files=[".*\.py$"]
|
||||||
let g:ycm_seed_identifiers_with_syntax = 1 " 语法关键字补全
|
let g:ycm_seed_identifiers_with_syntax = 1 " 语法关键字补全
|
||||||
let g:ycm_complete_in_comments = 1
|
let g:ycm_complete_in_comments = 1
|
||||||
let g:ycm_confirm_extra_conf = 0 " 关闭加载.ycm_extra_conf.py提示
|
let g:ycm_confirm_extra_conf = 0 " 关闭加载.ycm_extra_conf.py提示
|
||||||
@ -42,12 +44,23 @@ let g:ycm_key_list_previous_completion = ['<c-p>', '<Up>']
|
|||||||
let g:ycm_complete_in_comments = 1 " 在注释输入中也能补全
|
let g:ycm_complete_in_comments = 1 " 在注释输入中也能补全
|
||||||
let g:ycm_complete_in_strings = 1 " 在字符串输入中也能补全
|
let g:ycm_complete_in_strings = 1 " 在字符串输入中也能补全
|
||||||
let g:ycm_collect_identifiers_from_comments_and_strings = 1 " 注释和字符串中的文字也会被收入补全
|
let g:ycm_collect_identifiers_from_comments_and_strings = 1 " 注释和字符串中的文字也会被收入补全
|
||||||
"let g:ycm_global_ycm_extra_conf='~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py'
|
"let g:ycm_global_ycm_extra_conf='~/.vim/bundle/YouCompleteMe/third_party/ycmd/.ycm_extra_conf.py'
|
||||||
|
let g:ycm_global_ycm_extra_conf='~/.vim/.ycm_extra_conf.py'
|
||||||
let g:ycm_show_diagnostics_ui = 0 " 禁用语法检查
|
let g:ycm_show_diagnostics_ui = 0 " 禁用语法检查
|
||||||
inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<CR>" " 回车即选中当前项
|
inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<CR>" " 回车即选中当前项
|
||||||
nnoremap <c-j> :YcmCompleter GoToDefinitionElseDeclaration<CR> " 跳转到定义处
|
nnoremap <c-j> :YcmCompleter GoToDefinitionElseDeclaration<CR> " 跳转到定义处
|
||||||
let g:ycm_min_num_of_chars_for_completion=2
|
let g:ycm_min_num_of_chars_for_completion=2
|
||||||
|
|
||||||
|
"python auto complete plugin
|
||||||
|
Bundle 'davidhalter/jedi-vim'
|
||||||
|
Bundle 'ervandew/supertab'
|
||||||
|
let g:SuperTabDefaultCompletionType = "<c-n>"
|
||||||
|
|
||||||
|
" xml html auto close
|
||||||
|
Plugin 'alvan/vim-closetag'
|
||||||
|
let g:closetag_filenames = '*.html,*.xhtml,*.phtml,*.launch'
|
||||||
|
|
||||||
|
|
||||||
Plugin 'vim-airline/vim-airline'
|
Plugin 'vim-airline/vim-airline'
|
||||||
Plugin 'vim-airline-themes'
|
Plugin 'vim-airline-themes'
|
||||||
let g:airline_theme='bubblegum'
|
let g:airline_theme='bubblegum'
|
||||||
|
|||||||
102
vim/ycm_extra_conf.py
Normal file
102
vim/ycm_extra_conf.py
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
import os
|
||||||
|
import ycm_core
|
||||||
|
|
||||||
|
flags = [
|
||||||
|
'-Wall',
|
||||||
|
'-Wextra',
|
||||||
|
'-Werror',
|
||||||
|
'-fexceptions',
|
||||||
|
'-DNDEBUG',
|
||||||
|
'-std=c++11',
|
||||||
|
'-x',
|
||||||
|
'c++',
|
||||||
|
'-isystem',
|
||||||
|
'/usr/include',
|
||||||
|
'-isystem',
|
||||||
|
'/usr/local/include',
|
||||||
|
'-isystem',
|
||||||
|
'/opt/ros/' + os.getenv('ROS_DISTRO') + '/include',
|
||||||
|
'-isystem',
|
||||||
|
'/home/light/catkin_ws/devel/include',
|
||||||
|
]
|
||||||
|
|
||||||
|
compilation_database_folder = ''
|
||||||
|
|
||||||
|
if os.path.exists( compilation_database_folder ):
|
||||||
|
database = ycm_core.CompilationDatabase( compilation_database_folder )
|
||||||
|
else:
|
||||||
|
database = None
|
||||||
|
|
||||||
|
SOURCE_EXTENSIONS = [ '.cpp', '.cxx', '.cc', '.c' ]
|
||||||
|
|
||||||
|
def DirectoryOfThisScript():
|
||||||
|
return os.path.dirname( os.path.abspath( __file__ ) )
|
||||||
|
|
||||||
|
|
||||||
|
def MakeRelativePathsInFlagsAbsolute( flags, working_directory ):
|
||||||
|
if not working_directory:
|
||||||
|
return list( flags )
|
||||||
|
new_flags = []
|
||||||
|
make_next_absolute = False
|
||||||
|
path_flags = [ '-isystem', '-I', '-iquote', '--sysroot=' ]
|
||||||
|
for flag in flags:
|
||||||
|
new_flag = flag
|
||||||
|
|
||||||
|
if make_next_absolute:
|
||||||
|
make_next_absolute = False
|
||||||
|
if not flag.startswith( '/' ):
|
||||||
|
new_flag = os.path.join( working_directory, flag )
|
||||||
|
|
||||||
|
for path_flag in path_flags:
|
||||||
|
if flag == path_flag:
|
||||||
|
make_next_absolute = True
|
||||||
|
break
|
||||||
|
|
||||||
|
if flag.startswith( path_flag ):
|
||||||
|
path = flag[ len( path_flag ): ]
|
||||||
|
new_flag = path_flag + os.path.join( working_directory, path )
|
||||||
|
break
|
||||||
|
|
||||||
|
if new_flag:
|
||||||
|
new_flags.append( new_flag )
|
||||||
|
return new_flags
|
||||||
|
|
||||||
|
|
||||||
|
def IsHeaderFile( filename ):
|
||||||
|
extension = os.path.splitext( filename )[ 1 ]
|
||||||
|
return extension in [ '.h', '.hxx', '.hpp', '.hh' ]
|
||||||
|
|
||||||
|
|
||||||
|
def GetCompilationInfoForFile( filename ):
|
||||||
|
if IsHeaderFile( filename ):
|
||||||
|
basename = os.path.splitext( filename )[ 0 ]
|
||||||
|
for extension in SOURCE_EXTENSIONS:
|
||||||
|
replacement_file = basename + extension
|
||||||
|
if os.path.exists( replacement_file ):
|
||||||
|
compilation_info = database.GetCompilationInfoForFile(
|
||||||
|
replacement_file )
|
||||||
|
if compilation_info.compiler_flags_:
|
||||||
|
return compilation_info
|
||||||
|
return None
|
||||||
|
return database.GetCompilationInfoForFile( filename )
|
||||||
|
|
||||||
|
|
||||||
|
def FlagsForFile( filename, **kwargs ):
|
||||||
|
if database:
|
||||||
|
compilation_info = GetCompilationInfoForFile( filename )
|
||||||
|
if not compilation_info:
|
||||||
|
return None
|
||||||
|
|
||||||
|
final_flags = MakeRelativePathsInFlagsAbsolute(
|
||||||
|
compilation_info.compiler_flags_,
|
||||||
|
compilation_info.compiler_working_dir_ )
|
||||||
|
else:
|
||||||
|
relative_to = DirectoryOfThisScript()
|
||||||
|
final_flags = MakeRelativePathsInFlagsAbsolute( flags, relative_to )
|
||||||
|
|
||||||
|
return {
|
||||||
|
'flags': final_flags,
|
||||||
|
'do_cache': True
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user