Giter Site home page Giter Site logo

cpp-mode's Introduction

cpp-mode: A C++ IDE for vim

安装

  • vim-plug

    Plug 'chxuan/cpp-mode'

  • Vundle

    Plugin 'chxuan/cpp-mode'

使用

  • :CopyCode

    拷贝函数或变量,和:PasteCode结合使用

  • :PasteCode

    生成函数实现或变量定义,和:CopyCode结合使用

  • :GoToFunImpl

    转到函数实现,该功能可替代ycm提供的转到函数实现(因为ycm转到函数实现经常不成功)

  • :Switch

    c++头文件和实现文件切换

  • :FormatFunParam

    格式化函数参数,用于函数参数列表过多的情况

  • :GenTryCatch

    生成try-catch代码块

参考配置

请将以下配置加到 ~/.vimrc,如果不喜欢以下映射,可根据个人喜好更改。

nnoremap <leader>y :CopyCode<cr>
nnoremap <leader>p :PasteCode<cr>
nnoremap <leader>U :GoToFunImpl<cr>
nnoremap <silent> <leader>a :Switch<cr>
nnoremap <leader><leader>fp :FormatFunParam<cr>
nnoremap <leader><leader>if :FormatIf<cr>
nnoremap <leader><leader>t dd :GenTryCatch<cr>
xnoremap <leader><leader>t d :GenTryCatch<cr>

License

This software is licensed under the MIT license. © 2018 chxuan

cpp-mode's People

Contributors

chxuan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

cpp-mode's Issues

格式问题

class X {
}

这样的格式复制函数会报错
另外希望提供一个开关,粘贴也能成这种格式

:CopyCode<cr>出错

1.测试文件

//vim.h
#ifndef vim_H
#define vim_H

class Vim{
public:
    inline int func(int a);
private:
    int a;
};
#endif

2..执行<leader> y报错

    inline int func(int a);                                                                                                                  
处理 function <SNR>91_copy_code[3]..cppmode#gen_fun#copy_function[7]..<SNR>137_get_class_name[2]..<SNR>137_parse_class_name 时发生错误:      
第    1 行:                                                                                                                                  
E684: List 索引超出范围: 2                                                                                                                   
E15: 无效的表达式: matchlist(a:text, '\(\<class\>\|\<struct\>\)\s\+\(\w\+\)')[2]

3.执行<leader> p复制结果如下

0::int func(int a)
{

}

函数跳转和.h.cpp跳转遇到问题

当.h和.cpp文件不在同一个文件夹的时候,遇到两个问题
1、.h和.cpp无法互相跳转
2、可以从函数实现跳转到声明,但无法从声明跳转到实现

但如果.h和.cpp在同一个文件夹的时候,是没有问题

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.