Giter VIP home page Giter VIP logo

vim-cide's Introduction

Table of Content

Description

Powerful searching and navigation plugin that makes VIM an IDE based on GNU find, ripgrep( rg ), and cscope.

Features

  • Text search in multiple files based on rg

    • Support literal or regex based patterns

    • Support user specified file types

    • Configurable search options (case-sensitive, whole-word, regex, recursive)

  • cscope wrapper

    • Find all references to a symbol

    • Find all callers of a symbol (function only)

    • Find all callees of a symbol (function only)

  • Call-tree generator

    • Caller tree of a symbol

    • Callee tree of a symbol

  • Search history

    • The history of all search requests (cscope or rg) is preserved and displayed in QHistory buffer

    • The last browsed position (selected item in the QResult window) of each search is preserved; it makes the navigation between multiple search results much easier

  • Integrated find utility

    • Integrated GNU find utility and preview; sort by modified time, file size, file names, and containing folders; open by associated programs

Highlights

Traditional grep-like search is one dimensional, and the subsequent grep results overwrites the previous one. This plugin essentially implements a two-level navigation tree

  • The first level is the history of past search requests displayed in the QHistory window (as shown in the screenshot), in which the user can easily trace back what keywords/symbols have been searched earlier

  • The second level is the traditional grep/cscope results displayed in the QResult window, where the user can navigate among the results of a particular search

  • The user can easily navigate across the two levels

This approach is especially useful for studying and navigation inside a large or unfamiliar code base.

Example work flow

  • Start a search with option configuration

    • <Leader>g to search a symbol with rg, configure file types, base directory, and other options (case, whole-word, etc.)

    • <Leader>s to search a symbol with cscope

  • Search with last configured options

    • <Leader>l
  • Navigate between search results inside the 'QResult' window

    • Double-click items in "QResulst" (search result) window to view the corresponding code
  • Navigate between history search requests

    • Double-click items in "QHistory" (Search History) window for previous search results

Default Keymaps

Global hotkeys

Note the default key is '\'

Keymap Command Description
<Leader>s :Isymb<CR> Find symbol with
<Leader>d :Idefi<CR> Find global definition
<Leader>c :Icall<CR> Find callees
<Leader>b :Icaby<CR> Find callers
<Leader>f :Ifile<CR> Find files by name
<Leader>i :Iincl<CR> Find include files
<Leader>l :Ilast<CR> Find with last grep options
<Leader>g :Igrep<CR> Find with grep ( rg )
<Leader>r :Icallertree<CR> Draw caller tree of current symbol
<Leader>e :Icalleetree<CR> Draw callee tree of current symbol

Hotkeys in the "Find Window"

Keymap Description
? help message
<Double-Click> Preview
v Preview and move to the next file
v Preview and move to the previous file
g View in gvim
x Open file with associated program
<Ctrl-Right> Increase column width for file name field
<Ctrl-Left> Decrease column width for file name field
<Leader><Leader>t Sort by file time in decreased order
<Leader><Leader>T Sort by file time in increased order
<Leader><Leader>s Sort by file size in decreased order
<Leader><Leader>S Sort by file size in increased order
<Leader><Leader>n Sort by file name in decreased order
<Leader><Leader>N Sort by file name in increased order
<Leader><Leader>f Sort by folder name in decreased order
<Leader><Leader>F Sort by folder name in increased order

Installation

Dependencies

Manual installation

Vundle installation

  • Prerequisite: install Vundle from https://github.com/VundleVim/Vundle.vim

  • Insert the following line in .vimrc (or _vimrc), after "Plugin 'VundleVim/Vundle.vim'", and before "call vundle#end()"

    Plugin 'tristar2001/vim-cide'
  • Execute :PluginInstall

Configuration

  • The following global variables can be configured from .vimrc or _vimrc .

Note this step is optional. And it's usually needed when any of the following commands (like find.exe) is not present in any searchable path.

" C-IDE configuration
if has("win32")
    let g:cide_shell_find     = 'C:/Program Files/Git/usr/bin/find.exe'
    let g:cide_shell_sort     = 'C:/Program Files/Git/usr/bin/sort.exe'
    let g:cide_shell_date     = 'date /T'
else
    " let g:cide_shell_find   = 'find'
    " let g:cide_shell_sort   = 'sort'
    " let g:cide_shell_date   = 'date +\"%a %D %T.%3N\"'
endif
let g:cide_shell_cscope       = 'cscope'
let g:cide_shell_grep         = 'rg'
let g:cide_grep_filespecs     = ["-tcxx", "-tcpp", "-tc", "-tvim", "-tmatlab", '-g "*"']

Screenshots

main

main

vim-cide's People

Contributors

tristar2001 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

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.