Git Product home page Git Product logo

tabular's Introduction

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.

tabular's People

Contributors

clarkshaeffer avatar godlygeek avatar jblake-calx avatar lukehsiao avatar matthewfranglen avatar randomizedthinking avatar somini avatar tpope avatar wzzrd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tabular's Issues

Undefined variable: s:savecpo

Dears,

I'm having problem starting vim and 'tabular', similar to #17. I installed 'tabular' with 'Vundle' and when I start vim I have this message:

Error detected while processing ~/.vim/plugin/tabular/autoload/tabular.vim:
line  406:
E121: Undefined variable: s:savecpo
E15: Invalid expression: s:savecpo
line  407:
E108: No such variable: "s:savecpo"
Press ENTER or type command to continue

My first lines of .vimrc:

" This line should not be removed as it ensures that various options are
" properly set to work with the Vim-related packages available in Debian.
runtime! debian.vim

set nocompatible              " be iMproved, required
filetype off                  " required

" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim/
call vundle#begin('~/.vim/plugin/')

" Start plugins

" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'

" Markdown
Plugin 'godlygeek/tabular'
Plugin 'plasticboy/vim-markdown'

" End plugins

call vundle#end()            " required
filetype plugin indent on    " required

I'm using vim 8.0. I just installed 'Vundle' and 'tabular', then it is in last version.

All the best,

Mario

Characters lost

Running :Tabularize /,\zs on this text:

john,betty,wally,beth
walter,george,thomas,john
herbert,bob,petty,mick

Will produce this:

john,     etty,   ally,   beth
walter,   eorge,  homas,  john
herbert,  ob,     etty,   mick

As you can see, the first char after the commas is lost in the inner words.

Feature request: neovim optimizations

Currently :Tabularize on 130MB CSV on platform with i7-2600 CPU takes about 18 minutes utilizing 100% of one core at a time and locking vim process in the meantime .

From Neovim website:

The msgpack API enables structured communication to and from any programming language. Remote plugins run as co-processes that communicate with Neovim safely and asynchronously.

Please, consider nvim specific optimizations in the future.

Can't align code without extra space

I have following snipet:

'fareId':      fare.id,
'type':   type,
'isGood':          is_good,
'fareTime':     fare_time,

:Tab /:\zs turns this into (note two-spaces on last longest line):

'fareId':    fare.id,
'type':      type,
'isGood':    is_good,
'fareTime':  fare_time,

But :Tab /:\zs/l0 removes any spaces:

'fareId':  fare.id,
'type':    type,
'isGood':  is_good,
'fareTime':fare_time,

How I can achieve exactly one-space gap? Please help.

Would be nice...

I really like your plugin, I have been using it a lot lately.

I know you talk about this in the readme, but it would be nice if the it was possible to align by the first match of a regular expression without having to add more code to the .vim file. Maybe you could have a Tabf command in addition to the Tab command.

Thanks!

can't format a java file

first , greate project

Java source can't format use ":TAB /=" In VIM

package com.fsck.k9.activity.setup;

import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;

import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.preference.CheckBoxPreference;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceClickListener;
import android.preference.PreferenceCategory;
import android.preference.PreferenceScreen;
import android.text.TextUtils;
import android.widget.Toast;

import com.fsck.k9.K9;
import com.fsck.k9.K9.NotificationHideSubject;
import com.fsck.k9.K9.NotificationQuickDelete;
import com.fsck.k9.K9.SplitViewMode;
import com.fsck.k9.Preferences;
import com.fsck.k9.R;
import com.fsck.k9.activity.ColorPickerDialog;
import com.fsck.k9.activity.K9PreferenceActivity;
import com.fsck.k9.controller.MessagingController;
import com.fsck.k9.helper.FileBrowserHelper;
import com.fsck.k9.helper.FileBrowserHelper.FileBrowserFailOverCallback;
import com.fsck.k9.preferences.CheckBoxListPreference;
import com.fsck.k9.preferences.TimePickerPreference;

import com.fsck.k9.service.MailService;
import com.fsck.k9.view.MessageWebView;


public class Prefs extends K9PreferenceActivity {

    /**
     * Immutable empty {@link CharSequence} array
     */
    private static final CharSequence[] EMPTY_CHAR_SEQUENCE_ARRAY = new CharSequence[0];

    /*
     * Keys of the preferences defined in res/xml/global_preferences.xml
     */
    private static final String PREFERENCE_LANGUAGE = "language";
    private static final String PREFERENCE_THEME = "theme";
    private static final String PREFERENCE_MESSAGE_VIEW_THEME = "messageViewTheme";
    private static final String PREFERENCE_FIXED_MESSAGE_THEME = "fixedMessageViewTheme";
    private static final String PREFERENCE_COMPOSER_THEME = "messageComposeTheme";
    private static final String PREFERENCE_FONT_SIZE = "font_size";
    private static final String PREFERENCE_ANIMATIONS = "animations";
    private static final String PREFERENCE_GESTURES = "gestures";
    private static final String PREFERENCE_VOLUME_NAVIGATION = "volumeNavigation";
    private static final String PREFERENCE_START_INTEGRATED_INBOX = "start_integrated_inbox";
    private static final String PREFERENCE_CONFIRM_ACTIONS = "confirm_actions";
    private static final String PREFERENCE_NOTIFICATION_HIDE_SUBJECT = "notification_hide_subject";
    private static final String PREFERENCE_MEASURE_ACCOUNTS = "measure_accounts";
    private static final String PREFERENCE_COUNT_SEARCH = "count_search";
    private static final String PREFERENCE_HIDE_SPECIAL_ACCOUNTS = "hide_special_accounts";
    private static final String PREFERENCE_MESSAGELIST_CHECKBOXES = "messagelist_checkboxes";
    private static final String PREFERENCE_MESSAGELIST_PREVIEW_LINES = "messagelist_preview_lines";
    private static final String PREFERENCE_MESSAGELIST_SENDER_ABOVE_SUBJECT = "messagelist_sender_above_subject";
    private static final String PREFERENCE_MESSAGELIST_STARS = "messagelist_stars";
    private static final String PREFERENCE_MESSAGELIST_SHOW_CORRESPONDENT_NAMES = "messagelist_show_correspondent_names";
    private static final String PREFERENCE_MESSAGELIST_SHOW_CONTACT_NAME = "messagelist_show_contact_name";
    private static final String PREFERENCE_MESSAGELIST_CONTACT_NAME_COLOR = "messagelist_contact_name_color";
    private static final String PREFERENCE_MESSAGELIST_SHOW_CONTACT_PICTURE = "messagelist_show_contact_picture";
    private static final String PREFERENCE_MESSAGELIST_COLORIZE_MISSING_CONTACT_PICTURES =
            "messagelist_colorize_missing_contact_pictures";
    private static final String PREFERENCE_MESSAGEVIEW_FIXEDWIDTH = "messageview_fixedwidth_font";
    private static final String PREFERENCE_MESSAGEVIEW_VISIBLE_REFILE_ACTIONS = "messageview_visible_refile_actions";

    private static final String PREFERENCE_MESSAGEVIEW_RETURN_TO_LIST = "messageview_return_to_list";
    private static final String PREFERENCE_MESSAGEVIEW_SHOW_NEXT = "messageview_show_next";
    private static final String PREFERENCE_QUIET_TIME_ENABLED = "quiet_time_enabled";
    private static final String PREFERENCE_QUIET_TIME_STARTS = "quiet_time_starts";
    private static final String PREFERENCE_QUIET_TIME_ENDS = "quiet_time_ends";
    private static final String PREFERENCE_NOTIF_QUICK_DELETE = "notification_quick_delete";

    private static final String PREFERENCE_MESSAGEVIEW_MOBILE_LAYOUT = "messageview_mobile_layout";
    private static final String PREFERENCE_AUTOFIT_WIDTH = "messageview_autofit_width";
    private static final String PREFERENCE_BACKGROUND_OPS = "background_ops";
    private static final String PREFERENCE_GALLERY_BUG_WORKAROUND = "use_gallery_bug_workaround";
    private static final String PREFERENCE_DEBUG_LOGGING = "debug_logging";
    private static final String PREFERENCE_SENSITIVE_LOGGING = "sensitive_logging";

    private static final String PREFERENCE_ATTACHMENT_DEF_PATH = "attachment_default_path";
    private static final String PREFERENCE_BACKGROUND_AS_UNREAD_INDICATOR = "messagelist_background_as_unread_indicator";
    private static final String PREFERENCE_THREADED_VIEW = "threaded_view";
    private static final String PREFERENCE_FOLDERLIST_WRAP_NAME = "folderlist_wrap_folder_name";
    private static final String PREFERENCE_SPLITVIEW_MODE = "splitview_mode";

    private static final int ACTIVITY_CHOOSE_FOLDER = 1;

    // Named indices for the mVisibleRefileActions field
    private static final int VISIBLE_REFILE_ACTIONS_DELETE = 0;
    private static final int VISIBLE_REFILE_ACTIONS_ARCHIVE = 1;
    private static final int VISIBLE_REFILE_ACTIONS_MOVE = 2;
    private static final int VISIBLE_REFILE_ACTIONS_COPY = 3;
    private static final int VISIBLE_REFILE_ACTIONS_SPAM = 4;

    private ListPreference mLanguage;
    private ListPreference mTheme;
    private CheckBoxPreference mFixedMessageTheme;
    private ListPreference mMessageTheme;
    private ListPreference mComposerTheme;
    private CheckBoxPreference mAnimations;
    private CheckBoxPreference mGestures;
    private CheckBoxListPreference mVolumeNavigation;
    private CheckBoxPreference mStartIntegratedInbox;
    private CheckBoxListPreference mConfirmActions;
    private ListPreference mNotificationHideSubject;
    private CheckBoxPreference mMeasureAccounts;
    private CheckBoxPreference mCountSearch;
    private CheckBoxPreference mHideSpecialAccounts;
    private ListPreference mPreviewLines;
    private CheckBoxPreference mSenderAboveSubject;
    private CheckBoxPreference mCheckboxes;
    private CheckBoxPreference mStars;
    private CheckBoxPreference mShowCorrespondentNames;
    private CheckBoxPreference mShowContactName;
    private CheckBoxPreference mChangeContactNameColor;
    private CheckBoxPreference mShowContactPicture;
    private CheckBoxPreference mColorizeMissingContactPictures;
    private CheckBoxPreference mFixedWidth;
    private CheckBoxPreference mReturnToList;
    private CheckBoxPreference mShowNext;
    private CheckBoxPreference mMobileOptimizedLayout;
    private CheckBoxPreference mAutofitWidth;
    private ListPreference mBackgroundOps;
    private CheckBoxPreference mUseGalleryBugWorkaround;
    private CheckBoxPreference mDebugLogging;
    private CheckBoxPreference mSensitiveLogging;
    private CheckBoxPreference mWrapFolderNames;
    private CheckBoxListPreference mVisibleRefileActions;

    private CheckBoxPreference mQuietTimeEnabled;
    private com.fsck.k9.preferences.TimePickerPreference mQuietTimeStarts;
    private com.fsck.k9.preferences.TimePickerPreference mQuietTimeEnds;
    private ListPreference mNotificationQuickDelete;
    private Preference mAttachmentPathPreference;

    private CheckBoxPreference mBackgroundAsUnreadIndicator;
    private CheckBoxPreference mThreadedView;
    private ListPreference mSplitViewMode;


    public static void actionPrefs(Context context) {
        Intent i = new Intent(context, Prefs.class);
        context.startActivity(i);
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        addPreferencesFromResource(R.xml.global_preferences);

        mLanguage = (ListPreference) findPreference(PREFERENCE_LANGUAGE);
        List<CharSequence> entryVector = new ArrayList<CharSequence>(Arrays.asList(mLanguage.getEntries()));
        List<CharSequence> entryValueVector = new ArrayList<CharSequence>(Arrays.asList(mLanguage.getEntryValues()));
        String supportedLanguages[] = getResources().getStringArray(R.array.supported_languages);
        HashSet<String> supportedLanguageSet = new HashSet<String>(Arrays.asList(supportedLanguages));
        for (int i = entryVector.size() - 1; i > -1; --i) {
            if (!supportedLanguageSet.contains(entryValueVector.get(i))) {
                entryVector.remove(i);
                entryValueVector.remove(i);
            }
        }
        initListPreference(mLanguage, K9.getK9Language(),
                           entryVector.toArray(EMPTY_CHAR_SEQUENCE_ARRAY),
                           entryValueVector.toArray(EMPTY_CHAR_SEQUENCE_ARRAY));

        mTheme = setupListPreference(PREFERENCE_THEME, themeIdToName(K9.getK9Theme()));
        mFixedMessageTheme = (CheckBoxPreference) findPreference(PREFERENCE_FIXED_MESSAGE_THEME);
        mFixedMessageTheme.setChecked(K9.useFixedMessageViewTheme());
        mMessageTheme = setupListPreference(PREFERENCE_MESSAGE_VIEW_THEME,
                themeIdToName(K9.getK9MessageViewThemeSetting()));
        mComposerTheme = setupListPreference(PREFERENCE_COMPOSER_THEME,
                themeIdToName(K9.getK9ComposerThemeSetting()));

        findPreference(PREFERENCE_FONT_SIZE).setOnPreferenceClickListener(
        new Preference.OnPreferenceClickListener() {
            public boolean onPreferenceClick(Preference preference) {
                onFontSizeSettings();
                return true;
            }
        });

        mAnimations = (CheckBoxPreference)findPreference(PREFERENCE_ANIMATIONS);
        mAnimations.setChecked(K9.showAnimations());

        mGestures = (CheckBoxPreference)findPreference(PREFERENCE_GESTURES);
        mGestures.setChecked(K9.gesturesEnabled());

        mVolumeNavigation = (CheckBoxListPreference)findPreference(PREFERENCE_VOLUME_NAVIGATION);
        mVolumeNavigation.setItems(new CharSequence[] {getString(R.string.volume_navigation_message), getString(R.string.volume_navigation_list)});
        mVolumeNavigation.setCheckedItems(new boolean[] {K9.useVolumeKeysForNavigationEnabled(), K9.useVolumeKeysForListNavigationEnabled()});

        mStartIntegratedInbox = (CheckBoxPreference)findPreference(PREFERENCE_START_INTEGRATED_INBOX);
        mStartIntegratedInbox.setChecked(K9.startIntegratedInbox());

        mConfirmActions = (CheckBoxListPreference) findPreference(PREFERENCE_CONFIRM_ACTIONS);

        boolean canDeleteFromNotification = MessagingController.platformSupportsExtendedNotifications();
        CharSequence[] confirmActionEntries = new CharSequence[canDeleteFromNotification ? 4 : 3];
        boolean[] confirmActionValues = new boolean[canDeleteFromNotification ? 4 : 3];
        int index = 0;

        confirmActionEntries[index] = getString(R.string.global_settings_confirm_action_delete);
        confirmActionValues[index++] = K9.confirmDelete();
        confirmActionEntries[index] = getString(R.string.global_settings_confirm_action_delete_starred);
        confirmActionValues[index++] = K9.confirmDeleteStarred();
        if (canDeleteFromNotification) {
            confirmActionEntries[index] = getString(R.string.global_settings_confirm_action_delete_notif);
            confirmActionValues[index++] = K9.confirmDeleteFromNotification();
        }
        confirmActionEntries[index] = getString(R.string.global_settings_confirm_action_spam);
        confirmActionValues[index++] = K9.confirmSpam();

        mConfirmActions.setItems(confirmActionEntries);
        mConfirmActions.setCheckedItems(confirmActionValues);

        mNotificationHideSubject = setupListPreference(PREFERENCE_NOTIFICATION_HIDE_SUBJECT,
                K9.getNotificationHideSubject().toString());

        mMeasureAccounts = (CheckBoxPreference)findPreference(PREFERENCE_MEASURE_ACCOUNTS);
        mMeasureAccounts.setChecked(K9.measureAccounts());

        mCountSearch = (CheckBoxPreference)findPreference(PREFERENCE_COUNT_SEARCH);
        mCountSearch.setChecked(K9.countSearchMessages());

        mHideSpecialAccounts = (CheckBoxPreference)findPreference(PREFERENCE_HIDE_SPECIAL_ACCOUNTS);
        mHideSpecialAccounts.setChecked(K9.isHideSpecialAccounts());


        mPreviewLines = setupListPreference(PREFERENCE_MESSAGELIST_PREVIEW_LINES,
                                            Integer.toString(K9.messageListPreviewLines()));

        mSenderAboveSubject = (CheckBoxPreference)findPreference(PREFERENCE_MESSAGELIST_SENDER_ABOVE_SUBJECT);
        mSenderAboveSubject.setChecked(K9.messageListSenderAboveSubject());
        mCheckboxes = (CheckBoxPreference)findPreference(PREFERENCE_MESSAGELIST_CHECKBOXES);
        mCheckboxes.setChecked(K9.messageListCheckboxes());

        mStars = (CheckBoxPreference)findPreference(PREFERENCE_MESSAGELIST_STARS);
        mStars.setChecked(K9.messageListStars());

        mShowCorrespondentNames = (CheckBoxPreference)findPreference(PREFERENCE_MESSAGELIST_SHOW_CORRESPONDENT_NAMES);
        mShowCorrespondentNames.setChecked(K9.showCorrespondentNames());

        mShowContactName = (CheckBoxPreference)findPreference(PREFERENCE_MESSAGELIST_SHOW_CONTACT_NAME);
        mShowContactName.setChecked(K9.showContactName());

        mShowContactPicture = (CheckBoxPreference)findPreference(PREFERENCE_MESSAGELIST_SHOW_CONTACT_PICTURE);
        mShowContactPicture.setChecked(K9.showContactPicture());

        mColorizeMissingContactPictures = (CheckBoxPreference)findPreference(
                PREFERENCE_MESSAGELIST_COLORIZE_MISSING_CONTACT_PICTURES);
        mColorizeMissingContactPictures.setChecked(K9.isColorizeMissingContactPictures());

        mBackgroundAsUnreadIndicator = (CheckBoxPreference)findPreference(PREFERENCE_BACKGROUND_AS_UNREAD_INDICATOR);
        mBackgroundAsUnreadIndicator.setChecked(K9.useBackgroundAsUnreadIndicator());

        mChangeContactNameColor = (CheckBoxPreference)findPreference(PREFERENCE_MESSAGELIST_CONTACT_NAME_COLOR);
        mChangeContactNameColor.setChecked(K9.changeContactNameColor());

        mThreadedView = (CheckBoxPreference) findPreference(PREFERENCE_THREADED_VIEW);
        mThreadedView.setChecked(K9.isThreadedViewEnabled());

        if (K9.changeContactNameColor()) {
            mChangeContactNameColor.setSummary(R.string.global_settings_registered_name_color_changed);
        } else {
            mChangeContactNameColor.setSummary(R.string.global_settings_registered_name_color_default);
        }
        mChangeContactNameColor.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
            public boolean onPreferenceChange(Preference preference, Object newValue) {
                final Boolean checked = (Boolean) newValue;
                if (checked) {
                    onChooseContactNameColor();
                    mChangeContactNameColor.setSummary(R.string.global_settings_registered_name_color_changed);
                } else {
                    mChangeContactNameColor.setSummary(R.string.global_settings_registered_name_color_default);
                }
                mChangeContactNameColor.setChecked(checked);
                return false;
            }
        });

        mFixedWidth = (CheckBoxPreference)findPreference(PREFERENCE_MESSAGEVIEW_FIXEDWIDTH);
        mFixedWidth.setChecked(K9.messageViewFixedWidthFont());

        mReturnToList = (CheckBoxPreference) findPreference(PREFERENCE_MESSAGEVIEW_RETURN_TO_LIST);
        mReturnToList.setChecked(K9.messageViewReturnToList());

        mShowNext = (CheckBoxPreference) findPreference(PREFERENCE_MESSAGEVIEW_SHOW_NEXT);
        mShowNext.setChecked(K9.messageViewShowNext());

        mMobileOptimizedLayout = (CheckBoxPreference) findPreference(PREFERENCE_MESSAGEVIEW_MOBILE_LAYOUT);
        if (!MessageWebView.isSingleColumnLayoutSupported()) {
            PreferenceCategory prefs = (PreferenceCategory) findPreference("messageview_preferences");
            prefs.removePreference(mMobileOptimizedLayout);
        } else {
            mMobileOptimizedLayout.setChecked(K9.mobileOptimizedLayout());
        }

        mAutofitWidth = (CheckBoxPreference) findPreference(PREFERENCE_AUTOFIT_WIDTH);
        mAutofitWidth.setChecked(K9.autofitWidth());

        mQuietTimeEnabled = (CheckBoxPreference) findPreference(PREFERENCE_QUIET_TIME_ENABLED);
        mQuietTimeEnabled.setChecked(K9.getQuietTimeEnabled());

        mQuietTimeStarts = (TimePickerPreference) findPreference(PREFERENCE_QUIET_TIME_STARTS);
        mQuietTimeStarts.setDefaultValue(K9.getQuietTimeStarts());
        mQuietTimeStarts.setSummary(K9.getQuietTimeStarts());
        mQuietTimeStarts.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
            public boolean onPreferenceChange(Preference preference, Object newValue) {
                final String time = (String) newValue;
                mQuietTimeStarts.setSummary(time);
                return false;
            }
        });

        mQuietTimeEnds = (TimePickerPreference) findPreference(PREFERENCE_QUIET_TIME_ENDS);
        mQuietTimeEnds.setSummary(K9.getQuietTimeEnds());
        mQuietTimeEnds.setDefaultValue(K9.getQuietTimeEnds());
        mQuietTimeEnds.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
            public boolean onPreferenceChange(Preference preference, Object newValue) {
                final String time = (String) newValue;
                mQuietTimeEnds.setSummary(time);
                return false;
            }
        });

        mNotificationQuickDelete = setupListPreference(PREFERENCE_NOTIF_QUICK_DELETE,
                K9.getNotificationQuickDeleteBehaviour().toString());
        if (!MessagingController.platformSupportsExtendedNotifications()) {
            PreferenceScreen prefs = (PreferenceScreen) findPreference("notification_preferences");
            prefs.removePreference(mNotificationQuickDelete);
            mNotificationQuickDelete = null;
        }

        mBackgroundOps = setupListPreference(PREFERENCE_BACKGROUND_OPS, K9.getBackgroundOps().toString());
        // In ICS+ there is no 'background data' setting that apps can chose to ignore anymore. So
        // we hide that option for "Background Sync".
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
            CharSequence[] oldEntries = mBackgroundOps.getEntries();
            CharSequence[] newEntries = new CharSequence[3];
            // Use "When 'Auto-sync' is checked" instead of "When 'Background data' & 'Auto-sync'
            // are checked" as description.
            newEntries[0] = getString(R.string.background_ops_auto_sync_only);
            newEntries[1] = oldEntries[2];
            newEntries[2] = oldEntries[3];

            CharSequence[] oldValues = mBackgroundOps.getEntryValues();
            CharSequence[] newValues = new CharSequence[3];
            newValues[0] = oldValues[1];
            newValues[1] = oldValues[2];
            newValues[2] = oldValues[3];

            mBackgroundOps.setEntries(newEntries);
            mBackgroundOps.setEntryValues(newValues);

            // Since ConnectivityManager.getBackgroundDataSetting() always returns 'true' on ICS+
            // we map WHEN_CHECKED to ALWAYS.
            if (K9.getBackgroundOps() == K9.BACKGROUND_OPS.WHEN_CHECKED) {
                mBackgroundOps.setValue(K9.BACKGROUND_OPS.ALWAYS.toString());
                mBackgroundOps.setSummary(mBackgroundOps.getEntry());
            }
        }

        mUseGalleryBugWorkaround = (CheckBoxPreference)findPreference(PREFERENCE_GALLERY_BUG_WORKAROUND);
        mUseGalleryBugWorkaround.setChecked(K9.useGalleryBugWorkaround());

        mDebugLogging = (CheckBoxPreference)findPreference(PREFERENCE_DEBUG_LOGGING);
        mSensitiveLogging = (CheckBoxPreference)findPreference(PREFERENCE_SENSITIVE_LOGGING);

        mDebugLogging.setChecked(K9.DEBUG);
        mSensitiveLogging.setChecked(K9.DEBUG_SENSITIVE);

        mAttachmentPathPreference = findPreference(PREFERENCE_ATTACHMENT_DEF_PATH);
        mAttachmentPathPreference.setSummary(K9.getAttachmentDefaultPath());
        mAttachmentPathPreference
        .setOnPreferenceClickListener(new OnPreferenceClickListener() {
            @Override
            public boolean onPreferenceClick(Preference preference) {
                FileBrowserHelper
                .getInstance()
                .showFileBrowserActivity(Prefs.this,
                                         new File(K9.getAttachmentDefaultPath()),
                                         ACTIVITY_CHOOSE_FOLDER, callback);

                return true;
            }

            FileBrowserFailOverCallback callback = new FileBrowserFailOverCallback() {

                @Override
                public void onPathEntered(String path) {
                    mAttachmentPathPreference.setSummary(path);
                    K9.setAttachmentDefaultPath(path);
                }

                @Override
                public void onCancel() {
                    // canceled, do nothing
                }
            };
        });

        mWrapFolderNames = (CheckBoxPreference)findPreference(PREFERENCE_FOLDERLIST_WRAP_NAME);
        mWrapFolderNames.setChecked(K9.wrapFolderNames());

        mVisibleRefileActions = (CheckBoxListPreference) findPreference(PREFERENCE_MESSAGEVIEW_VISIBLE_REFILE_ACTIONS);
        CharSequence[] visibleRefileActionsEntries = new CharSequence[5];
        visibleRefileActionsEntries[VISIBLE_REFILE_ACTIONS_DELETE] = getString(R.string.delete_action);
        visibleRefileActionsEntries[VISIBLE_REFILE_ACTIONS_ARCHIVE] = getString(R.string.archive_action);
        visibleRefileActionsEntries[VISIBLE_REFILE_ACTIONS_MOVE] = getString(R.string.move_action);
        visibleRefileActionsEntries[VISIBLE_REFILE_ACTIONS_COPY] = getString(R.string.copy_action);
        visibleRefileActionsEntries[VISIBLE_REFILE_ACTIONS_SPAM] = getString(R.string.spam_action);

        boolean[] visibleRefileActionsValues = new boolean[5];
        visibleRefileActionsValues[VISIBLE_REFILE_ACTIONS_DELETE] = K9.isMessageViewDeleteActionVisible();
        visibleRefileActionsValues[VISIBLE_REFILE_ACTIONS_ARCHIVE] = K9.isMessageViewArchiveActionVisible();
        visibleRefileActionsValues[VISIBLE_REFILE_ACTIONS_MOVE] = K9.isMessageViewMoveActionVisible();
        visibleRefileActionsValues[VISIBLE_REFILE_ACTIONS_COPY] = K9.isMessageViewCopyActionVisible();
        visibleRefileActionsValues[VISIBLE_REFILE_ACTIONS_SPAM] = K9.isMessageViewSpamActionVisible();

        mVisibleRefileActions.setItems(visibleRefileActionsEntries);
        mVisibleRefileActions.setCheckedItems(visibleRefileActionsValues);

        mSplitViewMode = (ListPreference) findPreference(PREFERENCE_SPLITVIEW_MODE);
        initListPreference(mSplitViewMode, K9.getSplitViewMode().name(),
                mSplitViewMode.getEntries(), mSplitViewMode.getEntryValues());
    }

    private static String themeIdToName(K9.Theme theme) {
        switch (theme) {
            case DARK: return "dark";
            case USE_GLOBAL: return "global";
            default: return "light";
        }
    }

    private static K9.Theme themeNameToId(String theme) {
        if (TextUtils.equals(theme, "dark")) {
            return K9.Theme.DARK;
        } else if (TextUtils.equals(theme, "global")) {
            return K9.Theme.USE_GLOBAL;
        } else {
            return K9.Theme.LIGHT;
        }
    }

    private void saveSettings() {
        SharedPreferences preferences = Preferences.getPreferences(this).getPreferences();

        K9.setK9Language(mLanguage.getValue());

        K9.setK9Theme(themeNameToId(mTheme.getValue()));
        K9.setUseFixedMessageViewTheme(mFixedMessageTheme.isChecked());
        K9.setK9MessageViewThemeSetting(themeNameToId(mMessageTheme.getValue()));
        K9.setK9ComposerThemeSetting(themeNameToId(mComposerTheme.getValue()));

        K9.setAnimations(mAnimations.isChecked());
        K9.setGesturesEnabled(mGestures.isChecked());
        K9.setUseVolumeKeysForNavigation(mVolumeNavigation.getCheckedItems()[0]);
        K9.setUseVolumeKeysForListNavigation(mVolumeNavigation.getCheckedItems()[1]);
        K9.setStartIntegratedInbox(!mHideSpecialAccounts.isChecked() && mStartIntegratedInbox.isChecked());
        K9.setNotificationHideSubject(NotificationHideSubject.valueOf(mNotificationHideSubject.getValue()));

        int index = 0;
        K9.setConfirmDelete(mConfirmActions.getCheckedItems()[index++]);
        K9.setConfirmDeleteStarred(mConfirmActions.getCheckedItems()[index++]);
        if (MessagingController.platformSupportsExtendedNotifications()) {
            K9.setConfirmDeleteFromNotification(mConfirmActions.getCheckedItems()[index++]);
        }
        K9.setConfirmSpam(mConfirmActions.getCheckedItems()[index++]);

        K9.setMeasureAccounts(mMeasureAccounts.isChecked());
        K9.setCountSearchMessages(mCountSearch.isChecked());
        K9.setHideSpecialAccounts(mHideSpecialAccounts.isChecked());
        K9.setMessageListPreviewLines(Integer.parseInt(mPreviewLines.getValue()));
        K9.setMessageListCheckboxes(mCheckboxes.isChecked());
        K9.setMessageListStars(mStars.isChecked());
        K9.setShowCorrespondentNames(mShowCorrespondentNames.isChecked());
        K9.setMessageListSenderAboveSubject(mSenderAboveSubject.isChecked());
        K9.setShowContactName(mShowContactName.isChecked());
        K9.setShowContactPicture(mShowContactPicture.isChecked());
        K9.setColorizeMissingContactPictures(mColorizeMissingContactPictures.isChecked());
        K9.setUseBackgroundAsUnreadIndicator(mBackgroundAsUnreadIndicator.isChecked());
        K9.setThreadedViewEnabled(mThreadedView.isChecked());
        K9.setChangeContactNameColor(mChangeContactNameColor.isChecked());
        K9.setMessageViewFixedWidthFont(mFixedWidth.isChecked());
        K9.setMessageViewReturnToList(mReturnToList.isChecked());
        K9.setMessageViewShowNext(mShowNext.isChecked());
        K9.setMobileOptimizedLayout(mMobileOptimizedLayout.isChecked());
        K9.setAutofitWidth(mAutofitWidth.isChecked());
        K9.setQuietTimeEnabled(mQuietTimeEnabled.isChecked());

        boolean[] enabledRefileActions = mVisibleRefileActions.getCheckedItems();
        K9.setMessageViewDeleteActionVisible(enabledRefileActions[VISIBLE_REFILE_ACTIONS_DELETE]);
        K9.setMessageViewArchiveActionVisible(enabledRefileActions[VISIBLE_REFILE_ACTIONS_ARCHIVE]);
        K9.setMessageViewMoveActionVisible(enabledRefileActions[VISIBLE_REFILE_ACTIONS_MOVE]);
        K9.setMessageViewCopyActionVisible(enabledRefileActions[VISIBLE_REFILE_ACTIONS_COPY]);
        K9.setMessageViewSpamActionVisible(enabledRefileActions[VISIBLE_REFILE_ACTIONS_SPAM]);

        K9.setQuietTimeStarts(mQuietTimeStarts.getTime());
        K9.setQuietTimeEnds(mQuietTimeEnds.getTime());
        K9.setWrapFolderNames(mWrapFolderNames.isChecked());

        if (mNotificationQuickDelete != null) {
            K9.setNotificationQuickDeleteBehaviour(
                    NotificationQuickDelete.valueOf(mNotificationQuickDelete.getValue()));
        }

        K9.setSplitViewMode(SplitViewMode.valueOf(mSplitViewMode.getValue()));
        K9.setAttachmentDefaultPath(mAttachmentPathPreference.getSummary().toString());
        boolean needsRefresh = K9.setBackgroundOps(mBackgroundOps.getValue());
        K9.setUseGalleryBugWorkaround(mUseGalleryBugWorkaround.isChecked());

        if (!K9.DEBUG && mDebugLogging.isChecked()) {
            Toast.makeText(this, R.string.debug_logging_enabled, Toast.LENGTH_LONG).show();
        }
        K9.DEBUG = mDebugLogging.isChecked();
        K9.DEBUG_SENSITIVE = mSensitiveLogging.isChecked();

        Editor editor = preferences.edit();
        K9.save(editor);
        editor.commit();

        if (needsRefresh) {
            MailService.actionReset(this, null);
        }
    }

    @Override
    protected void onPause() {
        saveSettings();
        super.onPause();
    }

    private void onFontSizeSettings() {
        FontSizeSettings.actionEditSettings(this);
    }

    private void onChooseContactNameColor() {
        new ColorPickerDialog(this, new ColorPickerDialog.OnColorChangedListener() {
            public void colorChanged(int color) {
                K9.setContactNameColor(color);
            }
        },
        K9.getContactNameColor()).show();
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        switch (requestCode) {
        case ACTIVITY_CHOOSE_FOLDER:
            if (resultCode == RESULT_OK && data != null) {
                // obtain the filename
                Uri fileUri = data.getData();
                if (fileUri != null) {
                    String filePath = fileUri.getPath();
                    if (filePath != null) {
                        mAttachmentPathPreference.setSummary(filePath.toString());
                        K9.setAttachmentDefaultPath(filePath.toString());
                    }
                }
            }
            break;
        }

        super.onActivityResult(requestCode, resultCode, data);
    }
}

Feature Request: Ignore lines not containing the delimiter character

A lot of the occasions where I use Tabularize are those where a set of lines with the character I want to align at are interleaved with ones that don't. These can be comments or other things. Consider e.g. this LaTeX code:

\toprule
A & B & C \\
\midrule
foo & bar & baz \\
oof & rab & zab

I want to align all lines at the & character, but this will be messed up by the ones which don't contain it.

tabularize whole file, but each block separately?

Say my file is

this is a long field, 12345678,3333333333,44444444444
this is also long,134145231451,112412341,3142341341241

short,1,2,3,7,8
short,4,5,6,7,8

I have two blocks here and the second is more tight. The question (or feature request) is can I have each block separately aligned? I mean in one command both blocks.

Add help tag for :Tabularize

When searching for help for the command that this library provides the following error message is shown:

E149: Sorry, no help for :Tabularize

It would be good to link to the documentation.

"Unrecognized command '='"

Haven't used Tabular for a while, but just gave it a try today. Coming across the exact error in the title.

I would:

  • Select text using the visual line selection
  • Press :
  • Type Tab

I am using NeoVim version 0.2.2 on Linux.

Put [split char] in 1st column, with no padding.

(title may not make sense....)

some_text,_and_some_more
yes,_but_no

:Tab /,

some_text_,and_some_more
yes
______,_but_no

but I'd like to end up with

some_text ,_and_some_more
yes,_______but_no

(sheesh, how do I put this in a fixed font?)
(fsck. pretend _ are spaces)

Restrict automatic region search to lines with same indent as current

Let's say you have a nested Ruby hash:

    :foo => {
      :one => 1,
      :two => 2,
      :three => 3,
    }

If your cursor is on the inner hash and you want to align on the =>, Tabular will also align the :foo line on the outer hash. It would be great if the Tabular command would accept a parameter to restrict this search to lines that have the same indent as the current one (according to indent()), without having to select/specify an explicit region. Or maybe there is a way to do this already and I missed it in the docs?

Tabular resets the cursor position to the beginning of the line

After running :Tabularize, the cursor is at the beginning of the line.

It would be nice if it was in the same logical position, so that running :Tabularize /= on

barfarbaz = foo
x = C

becomes

barfarbaz = foo
x         = C

with the cursor being on C in both cases. I hope you can understand what I mean.

Could you describe the license?

I want to do a package for ArchLinux.
It is required to describe what's your script's license.

For example:

AGPL@ Artistic2.0/ EPL/ GPL@ LGPL2.1/ PerlArtistic/ W3C/
AGPL3/ CCPL/ FDL@ GPL2/ LGPL3/ PHP/ ZPL/
Apache/ CDDL/ FDL1.2/ GPL3/ LPPL/ PSF/
APACHE@ CPL/ FDL1.3/ LGPL@ MPL/ RUBY/

:global + Tabularize == awesome

On a lark, I just tried the command below. It didn't work, but I really wish it did.

Sample text:

foo -- bar
1
adsfasdf -- bottle
3
wombat -- baz

Hypothetical command:

:g/\w+ --/Tabularize /--/l1c0r1

Intended result:

foo      --    bar
1
adsfasdf -- bottle
3
wombat   --    baz

Conceptually, the idea is that when used with :global, :Tabularize should only pay attention to the lines matched by global. This would be quite useful for things such as:

  • Aligning N-th column comments through an entire source code file
  • Any "broken block" type of alignment task where visual alignment across similar but non-adjacent lines in a file is desired.

If I get the copious free time and the above is actually possible, I'll turn this into a pull request. Beyond that, the idea seemed useful enough that I'm recording it here in case someone other than me nails it down first.

Beautify Function Signatures Expression

Hi. Thanks for sharing this awesome plugin, I really enjoy it.

Here is my problem. I've been coding a library in C, and very often I have to put a lot of function signatures somewhere. To help me see things, I want to acomplish the following

view

The most important are the parameters. I want them to be organized with their names to the right and their types to the left, with some space from '(', ',' and ')'.
I've been using this expression: Tabularize /[()], in selected text, and I always get this
view2

which is not what I need. And things get even uglier with more than 2 parameters.

So, I need the right expression rather than /[()], and I really sucks in regex, so I would love some help.

OBS: The function's name goes inside parenthesis, because they are actually pointers to functions inside a struct definition.

Ignore character in strings

It would be nice if there was a way for Tabular to ignore the search character when it is found in a string. For example

insert into my_table (there, are, four, commas, here)
values ('but if', 1, 'of my strings has the array type:', '{1,2,3,4,5,6,7,8,9}', 'then everything is messed up');

Or am I missing something? I imagine that this is not trivial...

my issue: this project is dead, right?

There have been no accepted pull requests for five years, no replies to any issues for a similar length of time,

However, only three years ago a readme was edited, so that's life, right?

Aligning nested objects

Hi,

I've been looking around the docs but could not find a way to do this. Say I have a nested javascript object, such as this:

var collection = {
  title: "Star Wars",
  author: "George Lucas & others",
  episodes: {
    "IV": "A New Hope",
    "V": "The Empire Strikes Back",
    "VI": "Revenge of the Sith"
  }
}

What is the fastest way to align the colons taking into account the nesting, so it becomes like this?

var collection = {
  title   : "Star Wars",
  author  : "George Lucas & others",
  episodes: {
    "IV": "A New Hope",
    "V" : "The Empire Strikes Back",
    "VI": "Revenge of the Sith"
  }
}

The only way I've found so far is manually selecting every sub-object, but that's a bit painful with lots of nesting / lots of individual objects.

Unwanted spaces added at each invocation

Starting with a buffer containing:

a |
|

and running Tab /|, I get:

a |
  |

as expected. But running it again on the same buffer, I get:

a  |
   |

Each successive run adds a new space:

a   |
    |

etc.

If all lines contain nothing or all contain something before the |, everything behaves as expected.

It puts space on place when there is no need in it

For example:

Some code in ruby
item = FactoryGirl.create(:item, :target => upload, :user => user, :project => project)
item = FactoryGirl.create(:item, :target = > upload, :user = > user, :project = > project)

the assignment was aligned perfectly but there is space in hashes. => was spitted into =[space]>.

several Tabularize over the same range

I did not succeed going over the same range with two reg-exps.
I want to tabularize the same text with different delimiters for each or several columns.
I.e. the first comma, the first | etc... (they can appear everywhere so it does not matter if they interfere)

Install instructions or vimball

Since this is more complex then just a plugin/Tabular.vim file, I think it would be nice to either have a README with recommended install instructions or a .vba "vimball" distribution for easy install.

On nearest tab border aligning

It will be great if Tabular can align not only on fixed space count (after/before) but align on tab borders some kind of :Tab /=/ltrt

Before:

abc=cde
abcdf=asd

Now:

abc = cde
abcdf = asd

It will be great:
abc = cde
abcdf = asd

Provide Vim 8-compatible package download?

With Vim 8+ natively supporting packages (:help packages) and pathogen deprecating itself, would it be possible to provide a version of this for download that uses the new directory layout? It should be easy to make a script that moves the directories around and makes a zipfile, if you don't want to change the layout of this repo. Or you could do the work in a packages branch :)

Option to not count lines which do not have the delimiter into the first field length

Consider file contents:

bundle edit_line append_groups_starting(v) {
vars:
  "index"        slist => getindices("$(v)");

classes:
  "add_$(index)"     not => groupexists("$(index)"),
                 comment => "Class created if group does not exist";

insert_lines:
  "$($(v)[$(index)])",
         comment => "Append users into a group file format",
      ifvarclass => "add_$(index)";
}

If you want to :Tabularize all the content's on delimiter '=>' it will count eg. the whole first line as first column and format all the rest accordingly.

It would be very usefull to say 'Tabularize by => but completely omit/ignore lines which does not contain the delimiter'

How can you add multiple seporator chars?

This:

{{"4\r", 3},
 {"OK\r", 3},
 {"#STN: ", 3},
 {"#NITZ:", 3},
 {"+CREG: 0,1\r\n0\r", 3},
 {"+CGREG: 0,1\r\n0\r", 3},
 {"+CMTI: \"SM\" 3},,", 3},
 {"no\" 3},,\"", 3},
 {"#SGACT: 1,0\r", 3},
 {"#SGACT: 1,1\r", 3},
 {"200 OK", 3},
 {"1\r", 3},
 {"0\r", 3},
 {"3\r", 3}}

should be like

{{"4\r",                3},
 {"OK\r",               3},
 {"#STN: ",             3},
 {"#NITZ:",             3},
 {"+CREG: 0,1\r\n0\r",  3},
 {"+CGREG: 0,1\r\n0\r", 3},
 {"+CMTI: \"SM\" 3},,", 5},
 {"no\" 3},,\"",        5},
 {"#SGACT: 1,0\r",      3},
 {"#SGACT: 1,1\r",      3},
 {"200 OK",             3},
 {"1\r",                3},
 {"0\r",                3},
 {"3\r",                3}}

I know I can do :Tab /,\zs, but the extra comments inside the strings mess it up. So I really need ", as delimiters not just the ,.

Justify-to option

Seems like by default the justification starts counting from the left, sometimes its needed to be from the right but after to read the doc I don't see a way to do it.

For example:

arr1, arr2, arr3, arr4,
arr2, arr3, arr4,
arr3, arr4,
arr1, arr2, arr3, arr4,

As you can see on this example it is a list of items which should be justified to the right, like this:

> arr1, arr2, arr3, arr4,
>       arr2, arr3, arr4,
>             arr3, arr4,
> arr1, arr2, arr3, arr4,

Feature request: handle RestructuredText & Markdown according to spec

I still find it somewhat difficult to use vim-tabular when creating Markdown tables, and especially with RestructuredText tables. The main problem, I think, is how to handle the "separator rows". Each form has its own quirks. I imagine most of the code for making this work in is there, but I'm not sure.

In RST, you make a table like so:

+------------+----------+----------+ 
| Header 1   | Header 2 | Header 3 | 
+============+==========+==========+ 
| body row 1 | column 2 | column 3 | 
+------------+----------+----------+ 
| body row 2 | column 2 | column 3 | 
+------------+----------+----------+ 

In this case, using :Tabularize /[|+] seems to work ok, but the --- and === rows do not get filled in.

The alter form for RST is like so:

Header 1    Header 2  Header 3  
=========== ========= =========
body row 1  column 2  column 3  
body row 2  column 2  column 3  

The issue here is that columns are determined by the === header row, not the content of the columns themselves. In both cases column width is determined by the header rows.

In markdown tables are done like so:

| Header 1   | Header 2   | Header 3  | 
|============|============|===========|
| body row 1 | column 2   | column 3  | 
| body row 2 | column 2   | column 3  | 

Running `:Tabularize /| works well enough, but again the header separator does not get filled out.

Is there a solution to handle these cases already, or would it be a lot of work to build in add-ons for these special table syntaxes?

After right alignment, l (left) align ignored on before comma

See the bug on # 3 below.
#1.

command: :Tab /,/l0
text:

Some short phrase,some other phrase
A much longer phrase here,and another long phrase
Something inbetween here,and another long phrase

result:

Some short phrase        ,some other phrase
A much longer phrase here,and another long phrase
Something inbetween here ,and another long phrase

#2.

command: :Tab /,/r0
text:

Some short phrase        ,some other phrase
A much longer phrase here,and another long phrase
Something inbetween here ,and another long phrase

result:

        Some short phrase,      some other phrase
A much longer phrase here,and another long phrase
 Something inbetween here,and another long phrase

#3 (the bug, why doesn't this look like result from # 1?).

command: :Tab /,/l0
text:

        Some short phrase,      some other phrase
A much longer phrase here,and another long phrase
 Something inbetween here,and another long phrase

result (bug!):

        Some short phrase,some other phrase
A much longer phrase here,and another long phrase
 Something inbetween here,and another long phrase

Extra space after tabulation

Hi Matt,

Thanks for creating this great plugin!

I'm wondering why this plugin is adding so much extra space around the results? Here is what I mean. Let's say I have the following text and I'm tabulating it on a space:

a bb ccc dddd e
h e l l o

I run :Tabularize / (with a space after / ) and the result that I get is the following with three spaces between each literal:

a   bb   ccc   dddd   e
h   e    l     l      o

I'm having hard time understanding why is there such an excessive spacing in the result.

The result that I'm expecting is the following:

a bb ccc dddd e
h e  l   l    o

I'd appreciate any insight into this.

Peter

some issues with aligning spaces

xxxx abcd();
xxxx efgh();
xxxxxxx  tabluar();
xxxxxxx  align_test();

how should i do to align the above text as below (there are 4 spaces at the beginning of each line):

xxxx     abcd();
xxxx     efgh();
xxxxxxx  tabluar();
xxxxxxx  align_test();

Manual missing for GTabularize

It took me a while to find this functionality in the source: GTabularize.
Why not include it in the doc?

GTabularize /pattern[/format] {{{2
GTabularize name

Align text on only matching lines, either using the given pattern, or the
command associated with the given name. Mnemonically, this is similar to
the :global command, which takes some action on all rows matching a pattern
in a range. This command is different from normal :Tabularize in 3 ways:

  1. If a line in the range does not match the pattern, it will be left
    unchanged, and not in any way affect the outcome of other lines in the
    range (at least, normally - but Pipelines can and will still look at
    non-matching rows unless they are specifically written to be aware of
    tabular#DoGTabularize() and handle it appropriately).
  2. No automatic range determination - :Tabularize automatically expands
    a single-line range (or a call with no range) to include all adjacent
    matching lines. That behavior does not make sense for this command.
  3. If called without a range, it will act on all lines in the buffer (like
    :global) rather than only a single line

Ignoring lines when accounting for padding

Suppose I have a document like the following

Present Tense
===============================================================================
Avoir
  - Conjugations
    - I have                   : J'ai
    - He has                   : Il a
    - They have                : Ils ont
Present Tense
===============================================================================
Etc... : more stuff

How do I tabularize on the ":" all at once? I would like to have the colons be the same across the entire file. If I do it all at once by selecting the entire document, I get something looking like the following

Present Tense
===============================================================================
Avoir
  - Conjugations
    - I have                                                                    : J'ai
    - He has                                                                    : Il a
    - They have                                                                 : Ils ont

No matching autocommands error with neovim

When opening neovim with your plugin the "No matching autocommands\n Press ENTER or type command to continue" error shows up no matter if I open an existing file or start from scratch. After I pressed Enter everything seems to be working fine (especially tabular).
My vimrc.txt is not the shortest, but I tracked the problem down to this plugin.
Runnning on
Ubuntu 14.04
nvim --version NVIM 0.1.3-dev
latest tabular version

On standard vim no error shows up.
Thanks for the amazing plugin - a great time saver.
Please let me know how I can help resolving this issue.

Align comments to comply with google cpplint

Any way to enter a command to format comments to be compliant to googles cpplint?

selection_086

Top section is not compliant, to comply 5 changes are required.

  1. keep this comment at the same level
  2. Add a space after //
  3. add minimum of two spaced between code and comment
  4. align comments
  5. add space after //

[Question] Align second line to the first line

return this.description == rd.description
    && this.exampleUrl == rd.example

What I try is how to align with (rn this) with (&&

rn this.description == rd.description
&& this.exampleUrl == rd.example

Align

I tried
:'<,'>Tabularize /.*...this
but looks like it's not work.

Why : (

Incorrectly Formatted Table when | characters are included in the table entries

I realize that there is no way for Tabularize to distinguish regular | characters that should be treated as text vs. table delimiters.

But, maybe adding some quote / wrapper (parenthesis, brackets, etc.) detection would allow proper formatting of this table, for instance:

# What Tabular does
|  Binding  |         Command                             |
| --------- | --------------------------------------------|
| `<C-w>    |`                                            | Max out the width of the current split      |

# Proper formatting
|  Binding  |         Command                             |
| --------- | --------------------------------------------|
| `<C-w>|`  | Max out the width of the current split      |

My implementation suggestion would be parsing each line for certain punctuation (like ", ', `, etc.) and keeping track of matching pairs with a stack. Push when you see a "left" character and pop when there's a matching right character. If you hit a | and the stack isn't empty, it's not a table delimiter.

mapping Tabular plugin not working for '{'

Consider this map:

nnoremap <leader>a :Tabularize<CR>

And this sample text:

fe =>
feoefij =>
feon =>

fe =
feoefij =
feon =

fe {
feoefij {
feon {

When I put the cursor on any block and a Tabular aligns the = and the =>, but not {. Strangely if, on the last block, in normal mode I :Tabularize the { are aligned. Why did the map fail?

Using vim-tabular/stable,now 1.0-3 all in Debian.

doesn't work in visual block mode

This would be nice if you had something like the following:

defaults = defaultConfig { var = "value"
                         , otherVar  = "otherValue"
                         , something = "val"
                         }

and you just want to tab out the rightmost = signs

How to install without pathogen

Not all users can use pathogen because it depends on vim's ability to execute commands in the shell. Many web hosted accounts provide only jailshell access, which prohibits this.

Perhaps you could provide some instruction on how to install this completely awesome vim plugin without pathogen?

Thanks so much for your work on this! It's a MUST HAVE vim plugin!

s:savecpo errors when using with Pathogen

Vim 7.3.409
Latest pathogen and tabular straight from Github.

My config calls pathogen on the 'plugin' directory, where I have my vim plugin submodules. cpoptions is not set in my vimrc.

I get the following error when I run vim:

Error detected while processing /home/daniel/projects/vimrc/plugin/tabular/autoload/tabular.vim:
line  406:
E121: Undefined variable: s:savecpo
E15: Invalid expression: s:savecpo
line  407:
E108: No such variable: "s:savecpo"
Press ENTER or type command to continue

:Tabularize seems to work as normal, but this error is a bit aggravating. Any solution that I'm maybe overlooking?

EDIT: Setting cpoptions did not change behavior.

EDIT2: Commenting out lines 406 and 407 causes the error message to go away. Testing Tabular again under these circumstances did not seem to result in any side-effects.

string on left and number align right

Hi guys,

thank you for your vim plugin. As data expert, I'm spending my life on csv files and probably use your plugin 20 times per day. However I have request to you:

could it be possible to align by default any number on right and any string on the left (which is the default behaviour) ?

Here is a quick example:

WORD          | COUNT | SUM      
Edinburgh     | 9     | 2092235  
London        | 12    | 3339260  
New York      | 11    | 3588090  
San Francisco | 14    | 3293475  
Sidney        | 2     | 181000   
Singapore     | 4     | 913725   
Tokyo         | 5     | 963925   
TOTAL         | 57    | 14371710 

It would save me a lot of time to directly format it like the following:

WORD          | COUNT | SUM      
Edinburgh     |     9 |  2092235  
London        |    12 |  3339260  
New York      |    11 |  3588090  
San Francisco |    14 |  3293475  
Sidney        |     2 |   181000   
Singapore     |     4 |   913725   
Tokyo         |     5 |   963925   
TOTAL         |    57 | 14371710 

Tabular aligns all character occurrences on the same line

Running <Leader> + a + = on…

first_name = models.CharField(max_length=50)
last_name = models.CharField(max_length=50)
birth_date = models.DateField()

generates…

first_name = models.CharField(max_length = 50)
last_name  = models.CharField(max_length = 50)
birth_date = models.DateField()

I'd like to align only the first = occurrence…

first_name = models.CharField(max_length=50)
last_name  = models.CharField(max_length=50)
birth_date = models.DateField()

Align to Nearest Tabstop

I don't think its possible to align to nearest tabstop without first counting characters of the longest line, manually. So I propose this:

  :Tabularize /,/r1tc1lt1

    abc     , d  , ghi
      a     , b
      a     , b  ,  c
    ---s....-s-.s-s---

Legend:

  • -: character
  • s: space
  • .: tab

Where tab is appropriate number of spaces if expandtab.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.