Top Related Projects
:sunflower: A Vim alignment plugin
VIM Table Mode for instant table creation.
A Filetype plugin for csv files
Quick Overview
The godlygeek/tabular
project is a Vim plugin that provides a powerful and flexible way to work with tabular data within the Vim text editor. It allows users to easily align text in columns, making it a valuable tool for tasks such as formatting code, creating tables, and manipulating data.
Pros
- Flexible Alignment: The plugin supports a wide range of alignment options, including left, right, and center alignment, as well as custom alignment patterns.
- Intuitive Interface: The plugin's commands and mappings are designed to be easy to use and integrate seamlessly with Vim's workflow.
- Customizable: Users can customize the plugin's behavior and appearance to suit their preferences and workflow.
- Robust Functionality: The plugin includes a variety of features, such as the ability to sort and filter tabular data, as well as support for various file formats.
Cons
- Steep Learning Curve: While the plugin is powerful, it may have a steeper learning curve for users who are new to Vim or tabular data manipulation.
- Dependency on Vim: The plugin is designed specifically for the Vim text editor, which may limit its usefulness for users who prefer other text editors.
- Limited Compatibility: The plugin may not be compatible with all Vim plugins or configurations, which could lead to compatibility issues.
- Potential Performance Issues: Depending on the size and complexity of the tabular data being manipulated, the plugin may experience performance issues, especially on older or less powerful systems.
Code Examples
Here are a few examples of how to use the godlygeek/tabular
plugin:
- Aligning Text in Columns:
:Tabularize /|
This command aligns the text in the current buffer based on the vertical bar (|
) character.
- Aligning Text with Custom Patterns:
:Tabularize /=
This command aligns the text in the current buffer based on the equal sign (=
) character.
- Sorting Tabular Data:
:Tabular /\|/ r1c2
This command sorts the tabular data in the current buffer based on the second column (r1c2).
- Filtering Tabular Data:
:Tabular /\|/ /^[^|]*foo[^|]*\|/
This command filters the tabular data in the current buffer to only include rows where the first column contains the word "foo".
Getting Started
To get started with the godlygeek/tabular
plugin, follow these steps:
-
Install the plugin using your preferred Vim plugin manager. For example, with Vundle, add the following line to your
.vimrc
file:Plugin 'godlygeek/tabular'
-
Load the plugin by running the following command in Vim:
:PluginInstall
-
Once the plugin is installed, you can use the following commands to work with tabular data:
Tabularize /PATTERN/
- Align the text in the current buffer based on the specified pattern.Tabular /PATTERN/ ALIGNMENT
- Align the text in the current buffer based on the specified pattern and alignment.Tabular /PATTERN/ SORT_COLUMN
- Sort the tabular data in the current buffer based on the specified column.Tabular /PATTERN/ /FILTER_PATTERN/
- Filter the tabular data in the current buffer based on the specified pattern.
-
You can also customize the plugin's behavior by adding the following lines to your
.vimrc
file:let g:tabular_loaded = 1 let g:tabular_default_format_templates = { \ '': '| %l | %*-20r | %*-20l |', \ 'markdown': '| %l | %*-20r | %*-20l |', \ 'text': '%l %*-20r %*-20l', \ }
These lines set the
Competitor Comparisons
:sunflower: A Vim alignment plugin
Pros of vim-easy-align
- More intuitive and flexible syntax for alignment
- Supports live interactive alignment with real-time preview
- Offers more advanced features like alignment around regular expressions
Cons of vim-easy-align
- Slightly steeper learning curve for advanced features
- May be overkill for simple alignment tasks
- Less widespread adoption compared to Tabular
Code comparison
vim-easy-align:
" Align around =
vipga=
" Align around 2nd occurrence of |
gaip2|
Tabular:
" Align around =
:Tabularize /=
" Align around 2nd occurrence of |
:Tabularize /|/r0c1l2
Summary
Both vim-easy-align and Tabular are powerful Vim plugins for aligning text. vim-easy-align offers more advanced features and flexibility, making it suitable for complex alignment tasks. It also provides a more interactive experience with live previews. However, this comes at the cost of a slightly steeper learning curve.
Tabular, on the other hand, is simpler to use for basic alignment tasks and has been around longer, resulting in wider adoption. It may be preferable for users who need quick, straightforward alignment without the need for advanced features.
The choice between the two largely depends on the user's specific needs and preferences. For simple alignments, Tabular might suffice, while vim-easy-align shines in more complex scenarios.
VIM Table Mode for instant table creation.
Pros of vim-table-mode
- Automatic table creation and formatting
- Real-time table adjustment as you type
- Supports various table styles (e.g., markdown, reStructuredText)
Cons of vim-table-mode
- Limited to table-specific operations
- May have a steeper learning curve for new users
Code Comparison
vim-table-mode:
" Enable table mode
:TableModeEnable
" Create a table
| Header 1 | Header 2 |
| Cell 1 | Cell 2 |
Tabular:
" Align text
:Tabularize /|
" Create a table manually
| Header 1 | Header 2 |
| Cell 1 | Cell 2 |
Key Differences
-
Functionality:
- vim-table-mode focuses specifically on table creation and manipulation
- Tabular is a general-purpose alignment tool for various text formats
-
Ease of use:
- vim-table-mode offers automatic table formatting
- Tabular requires manual alignment and table creation
-
Flexibility:
- vim-table-mode is optimized for table-related tasks
- Tabular can be used for a wider range of text alignment needs
-
Performance:
- vim-table-mode may have a slight impact on performance due to real-time adjustments
- Tabular generally has minimal performance overhead
-
Integration:
- vim-table-mode works well with markdown and other table-heavy formats
- Tabular integrates seamlessly with various text editing workflows
A Filetype plugin for csv files
Pros of csv.vim
- Specialized for CSV files with features like column sorting and hiding
- Provides visual feedback with syntax highlighting for CSV structures
- Offers advanced CSV-specific operations like sum/average of columns
Cons of csv.vim
- Limited to CSV files, less versatile for other tabular data formats
- May have a steeper learning curve due to CSV-specific commands
- Potentially slower for very large CSV files compared to Tabular
Code Comparison
csv.vim:
:CSVSort 2 " Sort CSV by second column
:CSVHiColumn 3 " Highlight third column
:CSVAnalyze sum 4 " Calculate sum of fourth column
Tabular:
:Tabularize /,/ " Align text on commas
:Tabularize /|/l1r1 " Align on | with left/right justification
:Tabularize /:/r1c1l0 " Align on : with custom spacing
Summary
csv.vim is a specialized plugin for working with CSV files in Vim, offering powerful features for CSV manipulation and analysis. It excels in CSV-specific tasks but is limited to this format. Tabular, on the other hand, is a more general-purpose alignment tool that works with various types of tabular data. It's simpler to use for basic alignment tasks but lacks the advanced CSV-specific features of csv.vim. The choice between the two depends on whether you primarily work with CSV files or need a more versatile alignment tool for different types of text.
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Tabular
Sometimes, it's useful to line up text. Naturally, it's nicer to have the computer do this for you, since aligning things by hand quickly becomes unpleasant. While there are other plugins for aligning text, the ones I've tried are either impossibly difficult to understand and use, or too simplistic to handle complicated tasks. This plugin aims to make the easy things easy and the hard things possible, without providing an unnecessarily obtuse interface. It's still a work in progress, and criticisms are welcome.
See Aligning Text with Tabular.vim for a screencast that shows how Tabular.vim works.
See doc/Tabular.txt for detailed documentation.
Installation
Vim 8.1+
No third-party package manager is required! Clone into:
.vim/pack/plugins/start
Make sure you include packloadall
in your .vimrc
.
Pathogen
mkdir -p ~/.vim/bundle
cd ~/.vim/bundle
git clone https://github.com/godlygeek/tabular.git
Once help tags have been generated (either using Pathogen's :Helptags
command, or by pointing vim's :helptags
command at the directory where you
installed Tabular), you can view the manual with :help tabular
.
See pathogen.vim for help or for package manager installation.
Top Related Projects
:sunflower: A Vim alignment plugin
VIM Table Mode for instant table creation.
A Filetype plugin for csv files
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot