Skip to content

Commit

Permalink
Add switchWithCurrentTab option.
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiop committed Oct 28, 2018
1 parent f849ce4 commit ba75249
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
4 changes: 4 additions & 0 deletions README.md
Expand Up @@ -17,3 +17,7 @@ This is very initial version. Lot of features in Atom's zentabs are not implemen
- `zentabs.applyLimitFor`
- apply the maximum amount of tabs for window|editorGroup
- Default: window

- `zentabs.switchWithCurrentTab`
- once limit of maximum tab is reached, switch the newly opened file with current active tab instead of the older one
- Default: false
12 changes: 10 additions & 2 deletions package.json
Expand Up @@ -34,8 +34,16 @@
"type": "string",
"default": "window",
"description": "apply the maximum amount of tabs for window|editorGroup",
"enum": ["window", "editorGroup"]
}
"enum": [
"window",
"editorGroup"
]
},
"zentabs.switchWithCurrentTab": {
"type": "boolean",
"default": false,
"description": "once limit of maximum tab is reached, switch the newly opened file with current active tab instead of the older one"
}
}
}
},
Expand Down
6 changes: 5 additions & 1 deletion src/HistoryRepository.ts
Expand Up @@ -29,7 +29,11 @@ export class HistoryRepository {
getItemToTrim(item: HistoryItem): HistoryItem | undefined {
const items = this.getItems(item.group);
if (items.length > this.max) {
if (vscode.workspace.getConfiguration('zentabs').get('switchWithCurrentTab')) {
return items.splice(1, 1)[0];
} else {
return items.pop();
}
}
}
}
}

0 comments on commit ba75249

Please sign in to comment.