Code Monkey home page Code Monkey logo

unite-outline's Introduction

unite-outline

Note: I am Shougo(unite plugin author). This plugin created by h1mesuke originally. He is great VimL programmer. But he has not maintained this plugin in several years. And I cannot contact with him. So I have maintained it instead. To add features to this plugin is hard. I cannot extend it. Pull requests are well come.

Introduction

unite-outline is a unite.vim's source which provides your Vim's buffer with the outline view. It parses the current buffer's content and extracts headings from the buffer. And then it shows the list of the headings using unite.vim's interface. When you select a heading from the list, you can jump to the corresponding location in the buffer.

The methods for extracting headings can be implemented for each individual filetypes. You can customize them as you like with Vim script and can also create new ones for unsupported filetypes.

Install

Install the distributed files into your Vim script directory which is usually $HOME/.vim, or $HOME/vimfiles on Windows.

You can show the heading list of the current buffer with ":Unite outline" command if you succeeded the installation (and unite-outline supports the filetype of the buffer).

C, C++, Java, etc

Usage

To show the heading list of the current buffer, execute |:Unite| command with "outline" as a source parameter.

:Unite outline

unite-outline parses the current buffer's content and extracts headings from the buffer. And then it shows the list of the headings with unite.vim's interface. When you select a heading from the list, you can jump to the corresponding location of the buffer.

See :help unite-outline for more details.

Extending

The easiest way to extend this plugin is if your language is supported by ctags. If this is the case, add an entry to the lang_info dictionary in:

./autoload/unite/sources/outline/modules/ctags.vim

The --ctags-options field in the dictionary gets passed to ctags and specifies the things ctags will report, the other fields control how unite-outline organizines the items that ctags returns.

Finally, add an outline_info dictionary in a file named after your filetype:

./autoload/unite/sources/outline/defaults/{FILETYPE}.vim

See the other filetypes already in autoload/unite/sources/outline/defaults for examples of what those files look like. Good luck!

Screenshots

See unite-outline's wiki.

unite-outline's People

Contributors

adolenc avatar aereal avatar alfred-sa avatar chemzqm avatar crazymaster avatar ecsousa avatar freitass avatar h1mesuke avatar hamaco avatar kenchan avatar locksfree avatar naoina avatar oliveruv avatar rhysd avatar roylez avatar sgrj avatar shougo avatar syngan avatar taqenoqo avatar tf-kurokky avatar thinca avatar tmsanrinsha avatar todesking avatar townk avatar tueda avatar ujihisa avatar ukstudio avatar wolf-dog avatar ypresto avatar zhaocai 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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

unite-outline's Issues

add outline to python

Hi,

could you point me to documentation or give me a hint how to add new outline "keywords"?
E.g. within Python, I would like to jump to certain comments.
The comments would start like this:
#- SEC:Tst
and the outline could show it like: SEC:Tst
Does this work?
Thanks!

jade -> pug

"jade" has been renamed to "pug".
Is it enough to only rename "outline/defaults/jade.vim" to "pug.vim"?

Error detected while processing function unite#view#_set_syntax

Just installed Unite and this plugin, I get:

Error detected while processing function unite#view#_set_syntax:
line 45:
E731: using Dictionary as a String
E412: Not enough arguments: ":highlight link uniteSource__Outline"

and I can not figure out what is the source :)

Annoying errors when update via neobundle

Hello.

Every time, when I try to update vim plugins with command:

 Unite -log -wrap neobundle/update:all

I get the following error for unite-outline:

screenshot 2015-10-09 09 15 37

This error occurred only under linux, on windows everything is ok.

Problem with using outline for viml

When I open an outline in a vim file I get the follow error when I enter insert mode to filter:

Error detected while processing function unite#handlers#_on_cursor_moved_i..<SNR>159_check_redraw..unite#redraw..unite#view#_redraw..unite#candidates#_recache..<SNR>15
0_recache_candidates_loop..unite#helper#call_source_filters..unite#helper#call_filter..117..<SNR>147_List_mark:
line    7:
E121: Undefined variable: v:val

this doesn't happen for me when using this in python.

"Funcref required" during initialization

:Unite outline

[unite.vim] /home/.../.vim/bundle/unite-outline/autoload/unite/sources/outline/modules/util.vim, line 56
[unite.vim] Vim(call):E718: Funcref required
[unite.vim] Error occurred in source initialization!
[unite.vim] Source name is /home/.../.vim/bundle/unite-outline/autoload/unite/sources/outline.vim
[unite.vim] Invalid source name "outline" is detected.
[unite.vim] unite.vim: Invalid source

Switching order of Util_get_indent_level and Util_get_indent_level makes the error occur at the first "call s:Util.function(...)".

Regretfully, VimL isn't exactly my cup of tea, so I cannot debug this myself.

unite: 282486e981c5027a8
unite-outline: 5b14dd6
vim: 7.4.1583

error message print when open vim but no file opened

[unite.vim] function unite#view#_set_syntax..unite#helper#call_hook..166_Source_Hooks_on_syntax, line 3
[unite.vim] Vim(if):E121: Undefined variable: state
[unite.vim] Error occurred in calling hook "on_syntax"!
[unite.vim] Source name is outline
Press ENTER or type command to continue

Support javascript ES6 class, functions

Hey, I noticed there was some improvements on this, but it still dont work quite well.

unite_outline_es6_class

As You can see, almost nothing was detected. So this is my humble feature request :)
So, can we support JS ES6 syntax?

Error dectected

As title, after upgrade the plugin, I cound not use unite-outline anymore. Error info is here
uo

C is not supported

ctags.exe path is $VIM\thirds\ctags.exe

let g:unite_source_outline_ctags_program = $VIM.'\thirds\ctags.exe'

will show:
Sorry, C is not supported.

Undefined variable: g:unite_data_directory

This error still happens for me:

Error detected while processing ~/.vim/bundle/unite-outline/autoload/unite/sources/outline.vim:
line   52:
E121: Undefined variable: g:unite_data_directory
E15: Invalid expression: g:unite_data_directory . '/outline'

It was first reported here: h1mesuke#45

It seems g:unite_data_directory isn't defined by unite in my setup.

Override ctags binary

Hi!
Is it possible to override ctags' binary's name for one filetype?

I'm trying to make outline work with Go, and ctags does not support it - however there's gotags project, which generates ctags-compatible data.

Technically it kinda works now, however struct members and interface internals are not visible.

can not work in neovim

my options in ~/.config/nvim/init.vim

NeoBundleFetch 'Shougo/neobundle.vim'
"NeoBundle 'Shougo/vimproc' "{{{3
NeoBundle 'Shougo/vimproc', { 
    \ 'build' : {
    \     'windows' : 'tools\\update-dll-mingw',
    \     'cygwin' : 'make -f make_cygwin.mak',
    \     'mac' : 'make -f make_mac.mak',
    \     'unix' : 'make -f make_unix.mak',
    \    },
    \ }  "}}}3
NeoBundle 'Shougo/unite.vim' 
NeoBundle 'Shougo/unite-help'
NeoBundle 'tacroe/unite-mark'
NeoBundle 'Shougo/deoplete.nvim'
NeoBundle 'Shougo/unite-outline'
if neobundle#tap('unite-outline') "{{{4
nnoremap <silent> <leader>fo :<C-u>Unite -vertical outline<CR>
endif
"}}}4

as above , unite.vim unite-mark deoplete.nvim all works except unite-outline

When i press fo, errmsg is:

[unite.vim] Invalid source name "outline" is detected.
[unite.vim] unite.vim: Invalid source

to make sure it installed, i input command:

neobundle#tap('unite-outline')

it echo 1. As a result, what should i do to make it work ?

特定の形式の候補が表示されない

特定の形式の候補が表示されない問題になりました。

MacVimKaoriya パッチ891
unite,unite-outline,vimprocそれどれ最新にアップデートしています。

手元にあるファイルの内unite-outlineで対応しているファイルで試してみた結果を下記にまとめます。

候補が表示される形式
.vim
.go
.lua
.md

候補が表示されない形式
.cs
.cpp

Outline not working for Java/C/C++ files

I updated all my plugins to the latest version and Unite Outline stop working for Java, C and C++ files.

To check that this is an actual problem I wiped out my .vimrc and all my plugins with the following exception:

pathogen
unite
newmru
unite-outline

My .vimrc contains only the following lines:

set nocompatible
set shellslash
runtime libs/pathogen/autoload/pathogen.vim
execute pathogen#infect('bundle/{}', 'libs/{}', 'quarantined/{}')

If I issue a :Unite outline on a .java, .c or .cpp file I get nothing. Am I missing something here?

php match function error

some code:

<?php 
class Test{
    public function bindClass($class, $alias = false) {
    }
}
?>

unite-outline output:
tm 20150216012617

Strange behavior with class methods

In this example, I will use python but I have noticed the same behavior in java files as well.

For example, in a python file if we have a method foo() inside a class called A and we start typing foo, unite-outline will display:
A : class
foo ( )
! foo ( )
Pressing enter puts you into normal mode inside the unite buffer and does nothing.

Also, when we have two methods that start the same way inside a class, like getFoo() and getBar(), once we type something that is different from the common substring the cursor will return to the start of the line and clear it on the next letter typed.
In the example if we type "get" everything will be fine, once we type "getf" the specified behavior will happen. It will also happen if we type "f" or "b".

After using preview action, quitting Unite will close the original buffer for certain files

Steps to reproduce

  1. get my minimal vimrc and bundle config here, unpack anywhere you like*;
  2. start Vim with vim -u /path/to/config.min/vimrc.vim;
  3. :e one of the test files in the unpacked data directory;
  4. start Unite with :Unite outline;
  5. select an outline item and preview it with 'p';
  6. close the Unite window with 'Q' or <C-g>.

Expected result
Focus is returned to the edited buffer.

Actual result
The edited buffer is closed and removed from the buffer list.

Notes
This only happens in certain source files, not all – which is why I included two I have found subject to the bug in the archive. As you can see, one is VimL, the other Ruby; the only thing I could find they have in common as far as unite-outline is concerned, and that is not present in files not affected by the bug, is that they have multiple outline entries in CamelCase. However, writing a bare bones Ruby file with a CamelCase class nested in a CamelCase module and doing steps 4. to 6. did not trigger the bug, so that similarity might be misleading (or there might be a subtle edge case affecting only certain CamelCase combinations).

Also note that, as expected, using -auto-preview triggers the same bug.

* I found the unite-outline source does not return any candidates if I use vim -u NONE -c 'set rtp+=/path/to/unite.vim,/path/to/unite-outline' -c 'runtime plugin/unite.vim', hence the need for a somewhat heavier config. Sorry for that.

mocha/jasmine support help

I'd like to be able modify the javascript outliner to see mocha/jasmine style test definitions - is the easiest way to do that to modify the javascript.vim definition?

Example for handling newlines in outlines?

Clojure definitions can contain newlines, but I can't figure out how to handle these. The following regex can match everything I need, the defining function, name, possibly a docstring and arguments.

'^\((def\S*\s\S*\_s*\(\"[^\"]*\"\)\=\_s*\(\[.*\])\)\=\)'

When searching for it in Vim it correctly highlights the first three lines of for instance:

(defn foo
  "Docstring"
  [x y]
  x)

But unite-outline only shows (and passes to create-heading as far as I can tell) the first line. How do you get output like `(defn foo "Docstring" [x y])" with unite-outline?

Unite-outline with ctags doesn't work on Windows 7

Hi Shougo,

I've installed Shougo/unite.vim, Shougo/unite-outline, and Exuberant ctags properly. On my Ubuntu desktop, all work fine. But on my Windows 7 laptop, the :Unite outline command only works for file types that don't need ctags, e.g., python, but for C file type, the output buffer of outline shows nothing but a leading > sign, with the status line showing "Extract headings...done."

The ctags should has no problem, since I can use ctags -R command to generate the tags file, and I can use C-] jumping in vim.

A possible reason of the failure is that, I do not use vimfiles directory to store my plugins. Instead, I created a .vim folder in my $HOME, and added the following lines in $MYVIMRC file:

if has("win32")
    let $MYVIMRC='~/.vim/vimrc'
endif

filetype off
set rtp+=$HOME/.vim/bundle/Vundle.vim

Oh, by the way, I use Vundle to manage my plugins.

Any suggestion would be appreciated.

Thanks!

Best Regards
Ben

Use * match will echo some error.

use * match will echom:

Error detected while processing /root/.vim/bundle/unite.vim/autoload/unite.vim:
line  205:
E127: Cannot redefine function unite#redraw: It is in use

sn

`Unite outline -auto-preview` shows errors

minimal vimrc

if has('vim_starting')
  set nocompatible
  set runtimepath+=~/.vimbundles/neobundle.vim
endif

call neobundle#begin(expand('~/.vimbundles'))

let g:neobundle#enable_name_conversion = 1
NeoBundle 'Shougo/unite.vim'
NeoBundle 'Shougo/unite-outline'
call neobundle#end()

filetype plugin indent on

how to produce

with the vimrc above,

  • :e! .vimbundles/unite-outline/autoload/unite/filters/outline_formatter.vim
  • :Unite outline -auto-preview

It also happens files besides .vim (such as .scala or .clj)

error I get

[unite.vim] function <SNR>28_call_unite[33]..unite#start[1]..unite#start#standard[93]..unite#view#_init_cursor[67]..unite#handlers#_on_cursor_moved[58]..unite#view#_do_auto_preview[9]..unite#action#do[62]..<SNR>54_Action_preview
[14]..unite#take_action[1]..unite#action#take[21]..<SNR>54_Action_preview[14]..unite#take_action[1]..unite#action#take[21]..<SNR>54_Action_preview[14]..unite#take_action[1]..unite#action#take[21]..<SNR>54_Action_preview[14]..uni
te#take_action[1]..unite#action#take[21]..<SNR>54_Action_preview[14]..unite#take_action[1]..unite#action#take[21]..<SNR>54_Action_preview[14]..unite#take_action[1]..unite#action#take[21]..<SNR>54_Action_preview[14]..unite#take_a
ction[1]..unite#action#take[21]..<SNR>54_Action_preview[14]..unite#take_action[1]..unite#action#take[21]..<SNR>54_Action_preview[14]..unite#take_action[1]..unite#action#take[21]..<SNR>54_Action_preview[14]..unite#take_action[1].
.unite#action#take[21]..<SNR>54_Action_preview[14]..unite#take_action[1]..unite#action#take[21]..<SNR>54_Action_preview[14].
[unite.vim] Vim(call):E132: Function call depth is higher than 'maxfuncdepth'
[unite.vim] Error occurred while executing "preview" action!

\section* in LaTeX

How could I generate the outline of sections without numbering (\section*) in LaTeX?

Syntax highlighting is lost

When I use this -no-split when opening unite-outline my syntax highlighting is lost.

When using this, I have highlighting in both preview window and when the buffer is opened, after selecting an item in the list.

nnoremap [unite]o :Unite -start-insert -auto-preview outline<cr>

When using this:

nnoremap [unite]o :Unite -start-insert -no-split -auto-preview outline<cr>

I get not syntax highlighting in preview or when the buffer is opened, after selecting an item in the list.

Any ideas why?

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.