Skip to content

Commit 77da115

Browse files
committed
Merge branch 'akstrfn-some_refactoring'
2 parents e0d56a6 + 742c016 commit 77da115

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+2047
-896
lines changed

CHANGELOG.org

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
This log is kept according to the [[http://keepachangelog.com/][Keep a CHANGELOG]] manifesto
55
** 0.6.0 :unreleased:
66
*** Added
7+
- Introduced sphinx documentation to Python modules. (PR #237)
78
- Add =Python3= support. (closes issue #226, merge PR #231)
89
- Implementing agenda overview for current buffer. (merges PR #229)
910
- =g:org_aggressive_conceal=, if value =1=, will conceal all simple format
@@ -17,6 +18,7 @@
1718
- Add export as LaTeX beamer slides (merges PR #206)
1819
- Keybinding to create plainlist item directly. (closes issue #190)
1920
*** Changed
21+
- Revamped TODO keyword cycling rules. (PR #237)
2022
- In [[syntax/org.vim][syntax/org.vim]], changed `\@<=' with computational faster `\zs'
2123
- Using =<localleader>c[n/N]= to create new plainlist item following
2224
current plainlist item. Now these keybindings will unconditionally

README.org

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818
[[https://github.com/jceb/vim-orgmode/blob/master/examples/mylife.org][file:examples/mylife.gif]]
1919

2020
** Features
21-
vim-orgmode is still very young but already quite usable. Here is a short
22-
list of the already supported features:
21+
Currently vim-orgmode does not support all ormode features but is quite
22+
usable. Short list of the already supported features:
2323

24-
- Proper syntax highlighting
24+
- Syntax highlighting
2525
- Cycle visibility of headings (folding)
2626
- Navigate between headings
2727
- Edit the structure of the document: add, move, promote, denote headings
@@ -33,8 +33,6 @@
3333
- Basic date handling
3434
- Export to other formats (via Emacs' Org-Mode)
3535

36-
More features are coming...
37-
3836
* Installation and Usage
3937
Installation and usage instructions are found in the file [[doc/orgguide.txt][doc/orgguide.txt]].
4038

doc/orgguide.txt

Lines changed: 34 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -75,32 +75,32 @@ line tools*.
7575

7676
------------------------------------------------------------------------------
7777
Preface~
78-
vim-orgmode is a file type plugin for keeping notes, maintaining TODO
79-
lists, and doing project planning with a fast and effective plain-text
80-
system. It is also an authoring and publishing system.
78+
vim-orgmode is a file type plugin for keeping notes, maintaining TODO
79+
lists, and doing project planning with a fast and effective plain-text
80+
system. It is also an authoring and publishing system.
8181

82-
This document is a copy of the orgmode-guide for emacs
83-
(http://orgmode.org/) with modifications for vim. It contains all basic
84-
features and commands, along with important hints for customization.
82+
This document is a copy of the orgmode-guide for emacs
83+
(http://orgmode.org/) with modifications for vim. It contains all basic
84+
features and commands, along with important hints for customization.
8585

86-
To start create a new file with the extension ".org".
86+
To start create a new file with the extension ".org".
8787

8888
------------------------------------------------------------------------------
8989
Features~
90-
vim-orgmode is still very young but already quite usable. Here is a short
91-
list of the already supported features:
90+
Currently vim-orgmode does not support all ormode features but is quite
91+
usable. Short list of the already supported features:
9292

93-
- Cycle visibility of headings
93+
- Syntax highlighting
94+
- Cycle visibility of headings (folding)
9495
- Navigate between headings
9596
- Edit the structure of the document: add, move, promote, denote headings
9697
and more
9798
- Hyperlinks within vim-orgmode and outside (files, webpages, etc.)
9899
- TODO list management
99100
- Tags for headings
101+
- Lists in alphanumeric and bullet item notation and checkbox support
100102
- Basic date handling
101-
- Export (via emacs)
102-
103-
More features are coming...
103+
- Export to other formats (via emacs)
104104

105105
------------------------------------------------------------------------------
106106
Default mappings~
@@ -204,7 +204,7 @@ Inline markup~
204204

205205
Note:
206206
- /italic/ is rendered as reverse in most terms (works fine in gVim, though)
207-
- +strike-through+ doesn't work on Vim / gVim
207+
- +strike-through+ doesn't work on Vim / GVim
208208
- the non-standard `code' markup is also supported
209209
- =code= and ~verbatim~ are also supported as block-level markup, see below.
210210

@@ -222,27 +222,24 @@ INSTALLATION AND UPGRADE *orgguide-installation*
222222
>
223223
:so %
224224
<
225-
226225
ATTENTION: All .pyc files of former versions of vim-orgmode need to be
227226
deleted beforehand!
228227

229228
Add the following line to your .vimrc file to ensure that filetype plugins
230229
are loaded properly:
231230
>
232-
filetype plugin indent on
231+
filetype plugin indent on
233232
<
233+
Installation can also be done with plugin managers that automatically pull
234+
dependencies i.e. vim-plug (https://github.com/junegunn/vim-plug), dein.vim
235+
(https://github.com/Shougo/dein.vim).
234236

235-
Please install the Universal Text Linking
236-
(http://www.vim.org/scripts/script.php?script_id=293) add-on, otherwise
237-
hyperlinks won't work. Other plugins that integrate well with vim orgmode
238-
are listed in the following section.
239-
240-
Note: If you want to insert timestamp by using a calendar, you should
241-
install calendar(https://github.com/mattn/calendar-vim) to
242-
enable this feature.
237+
NOTE: For some functionality vim-orgmode relies on external plugins which
238+
are mentioned in suggested plugins.
243239

244240
------------------------------------------------------------------------------
245241
Suggested plugins~
242+
246243
Universal Text Linking~
247244
(http://www.vim.org/scripts/script.php?script_id=293) general support for
248245
text linking. The hyperlinks feature of vim-orgmode depends on this
@@ -284,7 +281,8 @@ Suggested plugins~
284281

285282
SyntaxRange~
286283
(http://www.vim.org/scripts/script.php?script_id=4168)
287-
Use proper syntax highlighting for code blocks such as: >
284+
Use proper syntax highlighting for code blocks such as:
285+
>
288286
#+BEGIN_SRC cpp
289287
int i = 1;
290288
#+END_SRC
@@ -311,6 +309,7 @@ Outlines~
311309

312310
------------------------------------------------------------------------------
313311
Headlines~
312+
314313
Headlines define the structure of an outline tree. The headlines in
315314
vim-orgmode start with one or more stars, on the left margin. For example:
316315
>
@@ -333,6 +332,7 @@ Headlines~
333332

334333
------------------------------------------------------------------------------
335334
Text objects~
335+
336336
Vim offers a mighty feature called |text-objects|. A text object is bound to
337337
a certain character sequence that can be used in combination with all kinds
338338
of editing and selection tasks.
@@ -547,6 +547,7 @@ Internal links~
547547

548548
------------------------------------------------------------------------------
549549
External links~
550+
550551
|utl| supports links to files and websites. Others can be added by extending
551552
utl (see |utl-smartSamples|). External links are URL-like locators. They
552553
start with a short identifying string followed by a colon. There can be no
@@ -566,6 +567,7 @@ External links~
566567

567568
------------------------------------------------------------------------------
568569
Handling links~
570+
569571
vim-orgmode provides methods to create a link in the correct syntax, to
570572
insert it into an org file, and to follow the link.
571573

@@ -684,7 +686,7 @@ Multi-state workflows~
684686
of which subsequence should be used for a given entry. The example also
685687
shows how to define keys for fast access of a particular state, by
686688
adding a letter in parenthesis after each keyword - you will be prompted
687-
for the key after pressing ,d.
689+
for the key after pressing <LocalLeader>d.
688690

689691
*orgguide-<LocalLeader>d*
690692
<LocalLeader>d prompt for fast access of a todo state
@@ -832,7 +834,7 @@ Timestamps~
832834
A timestamp is a specification of a date (possibly with a time or a range of
833835
times) in a special format, either <2003-09-16 Tue> or <2003-09-16 Tue
834836
09:39> or <2003-09-16 Tue 12:00-12:30>. A timestamp can appear anywhere in
835-
the headline or body of an org tree entry. Its presence causes entries to
837+
the headline or body of an org tree entry. Its presence causes entries to
836838
be shown on specific dates in the agenda (see section |orgguide-agenda|). We
837839
distinguish:
838840

@@ -902,8 +904,11 @@ Creating timestamps~
902904
When vim-orgmode prompts for a date/time, it will accept any string
903905
containing some date and/or time information, and intelligently interpret
904906
the string, deriving defaults for unspecified information from the current
905-
date and time. See the manual for more information on how exactly the
906-
date/time prompt works.
907+
date and time.
908+
Example~
909+
If the current date is <2016-06-14 Tue>, entering +3 at the prompt will
910+
insert the date <2016-06-17 Fri>, entering sat will insert date
911+
<2016-06-18 Sat>
907912

908913
You can also select a date in the pop-up calendar.
909914
NOTE: The plugin 'calendar' should be installed for this feature.

ftplugin/org.vim

Lines changed: 24 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,18 @@
66
" @Revision : 0.4
77
" vi: ft=vim:tw=80:sw=4:ts=4:fdm=marker
88

9-
if ! (has('python3') || has('python')) || v:version < 703
9+
if v:version > 702
10+
if has('python3')
11+
let s:py_version = 'python3 '
12+
let s:py_env = 'python3 << EOF'
13+
elseif has('python')
14+
let s:py_version = 'python '
15+
let s:py_env = 'python << EOF'
16+
else
17+
echoerr "Unable to start orgmode. Orgmode depends on Vim >= 7.3 with Python support complied in."
18+
finish
19+
endif
20+
else
1021
echoerr "Unable to start orgmode. Orgmode depends on Vim >= 7.3 with Python support complied in."
1122
finish
1223
endif
@@ -31,11 +42,7 @@ if ! exists('b:did_ftplugin')
3142

3243
" register keybindings if they don't have been registered before
3344
if exists("g:loaded_org")
34-
if has('python3')
35-
python3 ORGMODE.register_keybindings()
36-
else
37-
python ORGMODE.register_keybindings()
38-
endif
45+
exe s:py_version . 'ORGMODE.register_keybindings()'
3946
endif
4047
endif
4148

@@ -71,40 +78,20 @@ endif
7178

7279
" Menu and document handling {{{1
7380
function! <SID>OrgRegisterMenu()
74-
if has('python3')
75-
python3 ORGMODE.register_menu()
76-
else
77-
python ORGMODE.register_menu()
78-
endif
81+
exe s:py_version . 'ORGMODE.register_menu()'
7982
endfunction
8083

8184
function! <SID>OrgUnregisterMenu()
82-
if has('python3')
83-
python3 ORGMODE.unregister_menu()
84-
else
85-
python ORGMODE.unregister_menu()
86-
endif
85+
exe s:py_version . 'ORGMODE.unregister_menu()'
8786
endfunction
8887

89-
if has('python3')
90-
function! <SID>OrgDeleteUnusedDocument(bufnr)
91-
python3 << EOF
92-
b = int(vim.eval('a:bufnr'))
93-
if b in ORGMODE._documents:
94-
del ORGMODE._documents[b]
95-
EOF
96-
endfunction
97-
98-
else
99-
10088
function! <SID>OrgDeleteUnusedDocument(bufnr)
101-
python << EOF
89+
exe s:py_env
10290
b = int(vim.eval('a:bufnr'))
10391
if b in ORGMODE._documents:
10492
del ORGMODE._documents[b]
10593
EOF
10694
endfunction
107-
endif
10895

10996
" show and hide Org menu depending on the filetype
11097
augroup orgmode
@@ -115,8 +102,7 @@ augroup END
115102

116103
" Start orgmode {{{1
117104
" Expand our path
118-
if has('python3')
119-
python3 << EOF
105+
exec s:py_env
120106
import vim, os, sys
121107

122108
for p in vim.eval("&runtimepath").split(','):
@@ -129,30 +115,9 @@ for p in vim.eval("&runtimepath").split(','):
129115
from orgmode._vim import ORGMODE, insert_at_cursor, get_user_input, date_to_str
130116
ORGMODE.start()
131117

132-
from Date import Date
133118
import datetime
134119
EOF
135120

136-
else
137-
138-
python << EOF
139-
import vim, os, sys
140-
141-
for p in vim.eval("&runtimepath").split(','):
142-
dname = os.path.join(p, "ftplugin")
143-
if os.path.exists(os.path.join(dname, "orgmode")):
144-
if dname not in sys.path:
145-
sys.path.append(dname)
146-
break
147-
148-
from orgmode._vim import ORGMODE, insert_at_cursor, get_user_input, date_to_str
149-
ORGMODE.start()
150-
151-
from Date import Date
152-
import datetime
153-
EOF
154-
endif
155-
156121
" 3rd Party Plugin Integration {{{1
157122
" * Repeat {{{2
158123
try
@@ -182,20 +147,20 @@ endif
182147
fun CalendarAction(day, month, year, week, dir)
183148
let g:org_timestamp = printf("%04d-%02d-%02d Fri", a:year, a:month, a:day)
184149
let datetime_date = printf("datetime.date(%d, %d, %d)", a:year, a:month, a:day)
185-
exe "py selected_date = " . datetime_date
150+
exe s:py_version . "selected_date = " . datetime_date
186151
" get_user_input
187152
let msg = printf("Inserting %s | Modify date", g:org_timestamp)
188-
exe "py modifier = get_user_input('" . msg . "')"
153+
exe s:py_version . "modifier = get_user_input('" . msg . "')"
189154
" change date according to user input
190-
exe "py print modifier"
191-
exe "py newdate = Date._modify_time(selected_date, modifier)"
192-
exe "py newdate = date_to_str(newdate)"
155+
exe s:py_version . "print modifier"
156+
exe s:py_version . "newdate = Date._modify_time(selected_date, modifier)"
157+
exe s:py_version . "newdate = date_to_str(newdate)"
193158
" close Calendar
194159
exe "q"
195160
" goto previous window
196161
exe "wincmd p"
197-
exe "py timestamp = '" . g:org_timestamp_template . "' % newdate"
198-
exe "py insert_at_cursor(timestamp)"
162+
exe s:py_version . "timestamp = '" . g:org_timestamp_template . "' % newdate"
163+
exe s:py_version . "insert_at_cursor(timestamp)"
199164
" restore calendar_action
200165
let g:calendar_action = g:org_calendar_action_backup
201166
endf

0 commit comments

Comments
 (0)