~ubuntu-branches/ubuntu/maverick/vim/maverick

« back to all changes in this revision

Viewing changes to src/ex_docmd.c

  • Committer: Bazaar Package Importer
  • Author(s): Steve Langasek
  • Date: 2009-05-04 11:13:42 UTC
  • mfrom: (1.1.8 upstream) (0.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090504111342-60miqybsixdpc345
Tags: 2:7.2.148-2ubuntu1
* Merge from Debian unstable, remaining changes:
  - debian/runtime/vimrc: "syntax on" is a sane default for non-tiny vim.
  - runtime/syntax/debcontrol.vim:
    + Add "metapackages" to the list of valid sections.
  - runtime/syntax/grub.vim:
    + Add Ubuntu-specific 'quiet' keyword.
  - Drop vim-lesstif package and lesstif2-dev build-dependency.
  - Enable Python interpreter on basic builds.
  - Disable autoindent, line-wrapping, and backup files by default.
* Dropped changes, merged in Debian:
  - Add jaunty, karmic to the list of valid suites.
  - runtime/syntax/debsources.vim:
    + Add "jaunty" to debsourcesDistrKeyword
  - Create a .pot file for translations.
* Drop gutsy from the list of valid distro series, it's been EOLed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3683
3683
        case CMD_highlight:
3684
3684
            set_context_in_highlight_cmd(xp, arg);
3685
3685
            break;
 
3686
#ifdef FEAT_CSCOPE
 
3687
        case CMD_cscope:
 
3688
            set_context_in_cscope_cmd(xp, arg);
 
3689
            break;
 
3690
#endif
3686
3691
#ifdef FEAT_LISTCMDS
3687
3692
        case CMD_bdelete:
3688
3693
        case CMD_bwipeout:
5124
5129
            }
5125
5130
 
5126
5131
            vim_free(cmd->uc_rep);
5127
 
            cmd->uc_rep = 0;
 
5132
            cmd->uc_rep = NULL;
 
5133
#if defined(FEAT_EVAL) && defined(FEAT_CMDL_COMPL)
 
5134
            vim_free(cmd->uc_compl_arg);
 
5135
            cmd->uc_compl_arg = NULL;
 
5136
#endif
5128
5137
            break;
5129
5138
        }
5130
5139
 
5183
5192
    {EXPAND_AUGROUP, "augroup"},
5184
5193
    {EXPAND_BUFFERS, "buffer"},
5185
5194
    {EXPAND_COMMANDS, "command"},
 
5195
#if defined(FEAT_CSCOPE)
 
5196
    {EXPAND_CSCOPE, "cscope"},
 
5197
#endif
5186
5198
#if defined(FEAT_EVAL) && defined(FEAT_CMDL_COMPL)
5187
5199
    {EXPAND_USER_DEFINED, "custom"},
5188
5200
    {EXPAND_USER_LIST, "customlist"},
5482
5494
    return OK;
5483
5495
}
5484
5496
 
 
5497
/*
 
5498
 * ":command ..."
 
5499
 */
5485
5500
    static void
5486
5501
ex_command(eap)
5487
5502
    exarg_T   *eap;
5913
5928
    char_u      *q;
5914
5929
 
5915
5930
    char_u      *start;
5916
 
    char_u      *end;
 
5931
    char_u      *end = NULL;
 
5932
    char_u      *ksp;
5917
5933
    size_t      len, totlen;
5918
5934
 
5919
5935
    size_t      split_len = 0;
5930
5946
 
5931
5947
    /*
5932
5948
     * Replace <> in the command by the arguments.
 
5949
     * First round: "buf" is NULL, compute length, allocate "buf".
 
5950
     * Second round: copy result into "buf".
5933
5951
     */
5934
5952
    buf = NULL;
5935
5953
    for (;;)
5936
5954
    {
5937
 
        p = cmd->uc_rep;
5938
 
        q = buf;
 
5955
        p = cmd->uc_rep;    /* source */
 
5956
        q = buf;            /* destination */
5939
5957
        totlen = 0;
5940
 
        while ((start = vim_strchr(p, '<')) != NULL
5941
 
               && (end = vim_strchr(start + 1, '>')) != NULL)
 
5958
 
 
5959
        for (;;)
5942
5960
        {
 
5961
            start = vim_strchr(p, '<');
 
5962
            if (start != NULL)
 
5963
                end = vim_strchr(start + 1, '>');
 
5964
            if (buf != NULL)
 
5965
            {
 
5966
                ksp = vim_strchr(p, K_SPECIAL);
 
5967
                if (ksp != NULL && (start == NULL || ksp < start || end == NULL)
 
5968
                        && ((ksp[1] == KS_SPECIAL && ksp[2] == KE_FILLER)
 
5969
# ifdef FEAT_GUI
 
5970
                            || (ksp[1] == KS_EXTRA && ksp[2] == (int)KE_CSI)
 
5971
# endif
 
5972
                            ))
 
5973
                {
 
5974
                    /* K_SPECIAL han been put in the buffer as K_SPECIAL
 
5975
                     * KS_SPECIAL KE_FILLER, like for mappings, but
 
5976
                     * do_cmdline() doesn't handle that, so convert it back.
 
5977
                     * Also change K_SPECIAL KS_EXTRA KE_CSI into CSI. */
 
5978
                    len = ksp - p;
 
5979
                    if (len > 0)
 
5980
                    {
 
5981
                        mch_memmove(q, p, len);
 
5982
                        q += len;
 
5983
                    }
 
5984
                    *q++ = ksp[1] == KS_SPECIAL ? K_SPECIAL : CSI;
 
5985
                    p = ksp + 3;
 
5986
                    continue;
 
5987
                }
 
5988
            }
 
5989
 
 
5990
            /* break if there no <item> is found */
 
5991
            if (start == NULL || end == NULL)
 
5992
                break;
 
5993
 
5943
5994
            /* Include the '>' */
5944
5995
            ++end;
5945
5996
 
7807
7858
{
7808
7859
    vim_free(prev_dir);
7809
7860
    prev_dir = NULL;
 
7861
 
 
7862
    vim_free(globaldir);
 
7863
    globaldir = NULL;
7810
7864
}
7811
7865
#endif
7812
7866
 
7829
7883
    else
7830
7884
#endif
7831
7885
    {
 
7886
#ifdef FEAT_AUTOCMD
 
7887
        if (allbuf_locked())
 
7888
            return;
 
7889
#endif
7832
7890
        if (vim_strchr(p_cpo, CPO_CHDIR) != NULL && curbufIsChanged()
7833
7891
                                                             && !eap->forceit)
7834
7892
        {
8753
8811
                else if (*dirnow != NUL
8754
8812
                        && (ssop_flags & SSOP_CURDIR) && globaldir != NULL)
8755
8813
                {
8756
 
                    if (mch_chdir((char *)globaldir) == OK)
 
8814
                    if (mch_chdir((char *)globaldir) == 0)
8757
8815
                        shorten_fnames(TRUE);
8758
8816
                }
8759
8817