aboutsummaryrefslogtreecommitdiffstats
path: root/direct_bookmark.js
diff options
context:
space:
mode:
authoranekos2011-12-10 15:01:46 +0900
committeranekos2011-12-10 15:03:00 +0900
commitbc1cf37cdbcba2e91a263ec1e19f5b6d82bc72a6 (patch)
treede6d0999e0a39e093f5a0e0fd5cfd7ef16dc5b2a /direct_bookmark.js
parentd582ffd9aad5d283e4ef132191fa2c7d5becfa73 (diff)
downloadvimperator-plugins-bc1cf37cdbcba2e91a263ec1e19f5b6d82bc72a6.tar.bz2
マッチ位置を設定できるようにした
e.g. let g:direct_sbm_tag_match="infix"
Diffstat (limited to 'direct_bookmark.js')
-rw-r--r--direct_bookmark.js17
1 files changed, 15 insertions, 2 deletions
diff --git a/direct_bookmark.js b/direct_bookmark.js
index 90cf3bf..b4b62e0 100644
--- a/direct_bookmark.js
+++ b/direct_bookmark.js
@@ -480,7 +480,9 @@ for Migemo search: require XUL/Migemo Extension
user: user,
password: password,
}).next(function(xhr){
- if(xhr.status != 200) throw "livedoor clip: failed";
+ if(xhr.status != 200) {
+ throw "livedoor clip: failed";
+ }
});
},
tags:function(user,password){
@@ -734,10 +736,21 @@ for Migemo search: require XUL/Migemo Extension
},{
literal: 0,
completer: let (lastURL, lastUserTags, onComplete, done = true) function(context, arg){
+ function matchPosition (e){
+ let m = liberator.globalVariables.direct_sbm_tag_match || 'prefix';
+ switch (m) {
+ case 'infix': return e;
+ case 'suffix': return e + "$";
+ }
+ return "^" + e;
+ }
+
function set (context, tags) {
let filter = context.filter;
var match_result = filter.match(/((?:\[[^\]]*\])*)\[?(.*)/); //[all, commited, now inputting]
- var m = new RegExp(XMigemoCore && isUseMigemo ? "^(" + XMigemoCore.getRegExp(match_result[2]) + ")" : "^" + match_result[2],'i');
+ var expr = XMigemoCore && isUseMigemo ? "(" + XMigemoCore.getRegExp(match_result[2]) + ")"
+ : match_result[2];
+ var m = new RegExp(matchPosition(expr),'i');
context.advance( match_result[1].length );