aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Christian Pohle2020-07-16 22:27:58 +0200
committerMax Christian Pohle2020-07-16 22:27:58 +0200
commitc4661ec60a6cb11deb77ec290d954d9070667bf5 (patch)
treec1cd924ca39e3d0d4f8aad033f3bd4d3d9345d81
downloadvim-recently-used-c4661ec60a6cb11deb77ec290d954d9070667bf5.tar.bz2
vim-recently-used-c4661ec60a6cb11deb77ec290d954d9070667bf5.zip
Initial release as a separate plugin
-rw-r--r--README.md35
-rw-r--r--doc/tags2
-rw-r--r--doc/vim-recently-used.txt12
-rw-r--r--plugin/autoload/vim-recently-used.vim41
-rw-r--r--screenshot.pngbin0 -> 129709 bytes
5 files changed, 90 insertions, 0 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..fd849f0
--- /dev/null
+++ b/README.md
@@ -0,0 +1,35 @@
1# vim-recently-used
2
3Here comes one of my most frequently used plugins!
4
5This plugin shows a list of recently used files from the current directory when
6starting Vim. There is also a simple command `:RecentlyUsed` available to
7update the list after changing to another directory with `:cd`.
8
9![screenshot](/screenshot.png)
10
11
12## Installation
13
14This should be sufficient:
15
16 git clone https://github.com/coderonline/vim-recently-used ~/.vim/pack/coderonline/
17
18Or download the zip file and extract it under `~/.vim/pack/coderonline`.
19
20## Installation using plugin managers
21
22### vim-plug
23
24 Plug 'coderonline/vim-recently-used'
25
26### dein.vim
27
28 call dein#add('coderonline/vim-recently-used')
29
30
31## Design goals
32
33* Keep it really simple
34* Make it a one liner
35
diff --git a/doc/tags b/doc/tags
new file mode 100644
index 0000000..7a7b76f
--- /dev/null
+++ b/doc/tags
@@ -0,0 +1,2 @@
1vim-recently-used-usage vim-recently-used.txt /*vim-recently-used-usage*
2vim-recently-used.txt vim-recently-used.txt /*vim-recently-used.txt*
diff --git a/doc/vim-recently-used.txt b/doc/vim-recently-used.txt
new file mode 100644
index 0000000..851a12c
--- /dev/null
+++ b/doc/vim-recently-used.txt
@@ -0,0 +1,12 @@
1*vim-recently-used.txt* A Vim plugin to show a list with recently used files
2
3==============================================================================
4USAGE INSTRUCTIONS *vim-recently-used-usage*
5
6:RecentlyUsed
7
8 Shows a list of recently used files from the current working directory
9 in the quickfix list. This command refreshes the list in the current
10 working directory, See |:cd| and |:pwd|.
11
12vim:tw=78:ts=8:ft=help:norl:
diff --git a/plugin/autoload/vim-recently-used.vim b/plugin/autoload/vim-recently-used.vim
new file mode 100644
index 0000000..48bb5d6
--- /dev/null
+++ b/plugin/autoload/vim-recently-used.vim
@@ -0,0 +1,41 @@
1"=======================================================================================================================
2" MAX_SPLASH:
3" Shows recently used files from the current directory in a location list
4"=======================================================================================================================
5
6command RecentlyUsed call setloclist(0, [])
7 \ | :lopen
8 \ | setlocal nospell
9 \ | setlocal signcolumn=yes
10 \ | setfiletype qf
11 \ | call setloclist(0, [], 'r', {
12 \ 'title':'Recently used files in directory: '.getcwd(),
13 \ 'items':sort(map(filter(filter(map(copy(v:oldfiles[:100]),
14 \ {_, p->expand(p)}),
15 \ 'v:val =~ "'.getcwd().'/"'),
16 \ 'filereadable(v:val)'),
17 \ {_, p->{'filename': p,
18 \ 'module': printf("%s | %-*s ",
19 \ strftime("%F %H:%M",
20 \ getftime(p)),
21 \ winwidth(0) - wincol() - 22,
22 \ fnamemodify(p, ':.')
23 \ )}}),
24 \ {a1, a2 -> a1.module < a2.module})
25 \ })
26
27" autocmd VimEnter * call setloclist(0, filter(map(copy(v:oldfiles), {_, p->{'filename': expand(get(split(p, "'"), 0))}}), { val -> echo val}))
28" from the list of recent files: make absolute paths, filter out files not
29" contained in cwd and finally filter out directories and non-files...
30autocmd StdinReadPre * let s:std_in=1
31autocmd VimEnter *
32 \ if !exists("s:std_in") && empty(argv())
33 \ | execute ':RecentlyUsed"
34 \ | wincmd w'
35 \ | endif
36
37" http://vimdoc.sourceforge.net/htmldoc/quickfix.html#:caddexpr
38" for c in range(char2nr('a'), char2nr('z')) + range(char2nr('A'), char2nr('Z')) + range(0,9) | let p = getpos("'".nr2char(c)) | if (p[1] > 0) | exec "sign define mark_".nr2char(c)." text=".nr2char(c)." linehl=linenr" | exec "sign place ".c." name=mark_".nr2char(c)." line=".p[1] | endif | endfor
39" for c in range(char2nr('a'), char2nr('z')) + range(char2nr('A'), char2nr('Z')) + range(0,9) | let p = line("'".nr2char(c)) | if (p > 0) | exec "sign define mark_".nr2char(c)." text=".nr2char(c)." linehl=linenr" | exec "sign place ".c." name=mark_".nr2char(c)." line=".p | endif | endfor
40" call sign_unplace('marks') | for c in range(char2nr('a'), char2nr('z')) + range(char2nr('A'), char2nr('Z')) + range(0,9) | let p = line("'".nr2char(c)) | if (p > 0) | call sign_define("mark_".nr2char(c), { "text" : nr2char(c), "linehl": "linenr"}) | call sign_place(c, 'marks', "mark_".nr2char(c), '', {'lnum': p}) | endif | endfor
41" call sign_unplace('marks') | for c in range(char2nr('a'), char2nr('z')) + range(char2nr('A'), char2nr('Z')) + range(char2nr('0'), char2nr('9')) | let p = line("'".nr2char(c)) | if (p > 0) | call sign_define("mark_".nr2char(c), { "text" : nr2char(c), "texthl": "linenr"}) | call sign_place(c, 'marks', "mark_".nr2char(c), '', {'lnum': p}) | endif | endfor
diff --git a/screenshot.png b/screenshot.png
new file mode 100644
index 0000000..a5cc78a
--- /dev/null
+++ b/screenshot.png
Binary files differ
..