vim-scripts / tab-manager Goto Github PK
View Code? Open in Web Editor NEWRearranges buffers into tabs
Home Page: http://www.vim.org/scripts/script.php?script_id=3536
Rearranges buffers into tabs
Home Page: http://www.vim.org/scripts/script.php?script_id=3536
This is a mirror of http://www.vim.org/scripts/script.php?script_id=3536 Sorts and rearranges all open buffers across tabs based on built-in or user-specified criteria. Configuration: The variable g:TabManager_maxFilesInTab (defaults to 5) is used to determine how many buffers to open in each tab. General usage: All of these commands optionally take a number which determines how many buffers to open per tab (new tabs get created as necessary); 0 means to lump all buffers of any given typeinto one tab. For the following examples, assume these buffers are open (doesn't matter how many tabs they currently take): /progs/com/test/Abcd.java /progs/com/test/ProgramRunner.java /progs/com/abc/Test.java /vim/plugin/TabManager.vim Rearrangetabsbyfirstletter: Quick alphabetization of buffers where all buffers with the same starting letter are put together. Only the file name is considered, not the path. So, at the end, you get three tabs: Tab 1: Abcd.java Tab 2: ProgramRunner.java Tab 3: TabManager.vim and Test.java (The tabs are sorted as are the results within each tab.) Rearrangetabsbyextension: Arranges by extension (.java or .vim, for example): Tab 1: Abcd.java, ProgramRunner.java and Test.java Tab 2: TabManager.vim Rearrangetabsbypath: Arranges by absolute file path (not taking filename into consideration): Tab 1: /progs/com/abc: Test.java Tab 2: /progs/com/test: Abcd.java and ProgramRunner.java Tab 3: /vim/plugin: TabManager.vim Tiletabs: Quick way to alphabetize the list of buffers (case sensitive) into regularly-sized (by number of buffers) tabs. Doesn't make sense to use this with 0 (all buffers in one tab), unless that's the effect you want. Rearrangetabs: The workhorse. All other other commands are defined through this. Takes the actual pattern criteria against which to match each buffer. Version 1.1: Added two new commands: Rearrangetabsbytype: If it's a Java file, returns the last word that's not a part of the extension. For example, CopyAction.java returns Action and CopyForm.java returns Form. This should probably be reworked to allow the setting of the extension upon which to filter or to not look at extensions at all. Rearrangetabsbyroot: Groups files with similarly named roots together. For example, CopyAction.java, CopyForm.java and CopyResults.jsp will end up together because they all have "Copy" as the root. Version 1.2: New variable: g:TabManager_fileTypeExtension (defaults to "java") to use when determining the Rearrangetabsbytype; can be passed to the command on the command-line as an override. Rearrangetabsbytype now takes an extension (other than the default "java" or g:TabManager_fileTypeExtension) to use when sorting the files. If only one parameter is passed, it may be either a number or the extension. If both are specified, the number must be first. Version 1.3: Rearrangetabsbyfirstletter renamed to Rearrangetabsbyfirstletters: If called with no parameters, considers the first character of the file name, as before. If called with one parameter, the specified number of characters is considered. For example, with no parameters, "Test.java" and "Touring.java" would be placed together because both start with a T. With 2 as the parameter value, they would be separated ("Te" vs. "To"). If called with 2 parameters, the first parameter is the number of windows to place in one tab, as always (0 meaning to throw them all together). Version 1.35: Takes 'ignorecase' into consideration for matching extensions, first letters and complete file paths (but not for matching roots and "types"). Version 1.4: Added new command: Movetotab: moves the current file to the specified tab; understands absolute numbers (1 for the first tab, for example) as well as: - n: next tab - p: previous tab - $: last tab Version 1.45: Added new command: Copytotab: copies the current file to the specified tab (just like Movetotab except that the original tab also contains the file). Version 1.5: Added the ability to set custom "keys" to be used when rearranging files into tabs. For example, given the following list of files: /progs/com/test/Abcd.java /progs/com/test/ProgramRunner.java /progs/com/abc/Test.java /vim/plugin/TabManager.vim /webFiles/root/test.html /webFiles/root/css/styles.css The default behaviour, when arranging by path, extension or first letters, is to always place test.html and styles.css in separate tabs. (Unless calling Tiletabs, which just tiles all windows blindly.) However, if both these files have a manually set key of, say, "web", then any other criteria will be ignored and these two files will always be placed together because they have the same key. This allows grouping some windows by functionality while continuing to group others by whatever rearrange command is actually called. Of course, different sets of windows may have different keys and they will all be grouped together accordingly. All of the standard Rearrange* commands now take an optional bang (!)--for example, Rearrangetabsbyextension!--that will, for just this rearrangement, IGNORE any local keys and treat all windows as if there were no keys. If you have multiple windows where you're editing the same buffer, they will almost always end up together after any rearrangement (unless they are split across tabs that become full). You can avoid this by setting different window-level local keys for the buffers. Added four new commands--the set and remove key commands can be combined with windo and tabdo to set or remove the same key for more than one window at a time: Settabmanagerwindowkey <key>: Sets the window-level local key for the current window to <key>. Settabmanagerbufferkey <key>: Sets the buffer-level local key for the current buffer to <key>. Removetabmanagerkey: Removes the currently set key for the current window; will remove BOTH buffer and window level keys. (Doesn't take any arguments.) Redorearrangetabs: Redoes the last tab rearrangement command (by extension, simple tiling, by first letters, etc.). Useful for incorporating new windows into the currenty "scheme". If local keys have changed, the layout may end up being different. If new windows have been added, the layout may be different, also, but that may be what you want. By default, it obeys local keys (even if the last command was called with a bang and did not). Accepts a bang (!) to ignore local keys. If you call this before you've run any actual rearrangement commands, you will most likely (deservedly) get an error. Version 1.55: Rearrangetabsbypath now also takes a second parameter which determines how many components from the path to consider. For example, given the following set of files: /progs/com/test/Abcd.java /progs/com/test/ProgramRunner.java /progs/com/abc/Test.java The default behaviour would be to create two tabs, one with Abcd.java and ProgramRunner.java; and the other with Test.java. However, if called with a parameter of 2, it will only consider the first two path components (/progs/com) and put all the files in the same tab. A value of 0 (the default) means to check the entire path, as before. New command format: Rearrangetabsbypath [number of files per tab] [number of path components to consider] Or Rearrangetabsbypath [number of path components to consider] Version 1.6 Added a new command: Rearrangetabsbypackage: Works just like Rearrangetabsbypath, except uses the package the files are in. Only useful for files that specify a package in this format: package some.package.name; (The semicolon is optional.) Files that don't have a package will fall back to the entire file path (no path component specification; the ENTIRE path will be considered.) Takes either one or two arguments: Rearrangetabsbypackage [number of files per tab] [number of path components to consider] Or Rearrangetabsbypackage [number of path components to consider]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.