forked from Shougo/denite.nvim
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request Shougo#799 from uplus/add_path_sorter
Add sorter/path
- Loading branch information
Showing
2 changed files
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# ============================================================================ | ||
# FILE: sorter/path.py | ||
# AUTHOR: uplus <uplus.e10 at gmail.com> | ||
# DESCRIPTION: Simple filter to sort candidates by ascii order of path | ||
# License: MIT license | ||
# ============================================================================ | ||
|
||
from denite.base.filter import Base | ||
from denite.util import Nvim, UserContext, Candidates | ||
|
||
|
||
class Filter(Base): | ||
|
||
def __init__(self, vim: Nvim) -> None: | ||
super().__init__(vim) | ||
|
||
self.name = 'sorter/path' | ||
self.description = 'sort candidates by ascii order of path' | ||
|
||
def filter(self, context: UserContext) -> Candidates: | ||
return sorted(context['candidates'], key=lambda x: x['action__path']) |