Opciones en VIM

Opciones en VIM

      • 2,741
      • mensajes
      • miembro desde
      • 15/07/05
    #1 Opciones en VIM

    Buenas gente, no se si alguien usa vim pero se y tengo entendido que a los propios archivos que editas en vim les podes poner un header que contiene opciones de vim y se setean automaticamente cuando abris el archivo, lo se porque en algunos codigos fuente de proyectos en los que trabaje lo usaban pero ahora no recuerdo como se hacia ni que opciones les podias poner ni como era la sintaxis...

    Busque en google y en la doc de vim pero no encontre mucha data, alguien sabe como hacerlo???

    Es decir por ejemplo yo tengo un archivo por ejemplo

    main.c // Supongamos que es codigo fuente de C

    y le pongo un header o encabezado con asteriscos o algo (Es lo que no recuerdo como se hace) donde le especifico opciones de vim como si quiero syntax highlighting, si quiero que me remueva tabs, cuantos espacios quiero en suplantacion de un tab, etc....

    Saludos
    Pablo

  1. ¿Este tema te pareció interesante? Compártelo!

    ¿No es lo que buscabas? Intenta buscar un tema similar

    2 comentarios / 1670 Visitas

      • 708
      • mensajes
      • miembro desde
      • 11/03/06
    25/04/2008
    #2 Re: Opciones en VIM

    yo no conosco si esta feature exsite o no
    se que podes crear tipos de archivo
    onda, los *.c y le pones opciones de higlight y CREO otras cosas.
    tenes que tener activado la caracteristica en el vimrc y despues le agregas "plugins" para los tipos de archivo.

    en gentoo tenes un archivo que es supuestamente un sintax higlight para los archivos de config de fluxbox pero que tambien cambia el folding

      • 2,741
      • mensajes
      • miembro desde
      • 15/07/05
    25/04/2008
    #3 Re: Opciones en VIM

    Al final encontre lo que eran y son modelines que basicamente el vim si tenes la opcion activada o un numero mayor a cero de modelines lo que hace es al abrir un archivo busca en las primeras N lineas o en las ultimas N lineas por estas modelines y toma configuraciones de ahi haciendo set de opciones sobreescribiendo las que ya tiene cargadas...

    Esto es de la ayuda de vim:


    *modeline* *vim:* *vi:* *ex:* *E520*
    There are two forms of modelines. The first form:
    [text]{white}{vi:|vim:|ex:}[white]{options}

    [text] any text or empty
    {white} at least one blank character ( or )
    {vi:|vim:|ex:} the string "vi:", "vim:" or "ex:"
    [white] optional white space
    {options} a list of option settings, separated with white space or ':',
    where each part between ':' is the argument for a ":set"
    command

    Example:
    vi:noai:sw=3 ts=6

    The second form (this is compatible with some versions of Vi):

    [text]{white}{vi:|vim:|ex:}[white]se[t] {options}:[text]

    [text] any text or empty
    {white} at least one blank character ( or )
    {vi:|vim:|ex:} the string "vi:", "vim:" or "ex:"
    [white] optional white space
    se[t] the string "set " or "se " (note the space)
    {options} a list of options, separated with white space, which is the
    argument for a ":set" command
    : a colon
    [text] any text or empty

    Example:
    /* vim: set ai tw=75: */

    The white space before {vi:|vim:|ex:} is required. This minimizes the chance
    that a normal word like "lex:" is caught. There is one exception: "vi:" and
    "vim:" can also be at the start of the line (for compatibility with version
    3.0). Using "ex:" at the start of the line will be ignored (this could be
    short for "example:").


    *modeline-local*
    The options are set like with ":setlocal": The new value only applies to the
    buffer that contains the window. Although it's possible to set global options
    from a modeline, this is unusual. If you have two windows open and the files
    in it set the same global option to a different value, the result depends on
    which one was opened last.


    *modeline-version*
    If the modeline is only to be used for some versions of Vim, the version
    number can be specified where "vim:" is used:
    vim{vers}: version {vers} or later
    vim<{vers}: version before {vers}
    vim={vers}: version {vers}
    vim>{vers}: version after {vers}
    {vers} is 600 for Vim 6.0 (hundred times the major version plus minor).

    Lo que todavia no pude lograr es que me las tome a mi, pero basicamente es eso....

    Saludos
    Pablo
    For example, to use a modeline only for Vim 6.0 and later:
    /* vim600: set foldmethod=marker: */
    To use a modeline for Vim before version 5.7:
    /* vim<570: set sw=4: */
    There can be no blanks between "vim" and the ":".