Re: text is gone
scott wrote: [...] for homework i am assigning myself the research of as many flavors of indenting as i can find -- my first objective will be to find out exactly how many options are being set with the command :set filtype plugin indent :filetype plugin indent on (note the difference in command-name and spelling) does the following: 1. Filetype detection is ON: whenever you open an existing file for editing, create a new file, or change a file's name (using e.g. ":saveas"), Vim sources any "filetype.vim" scripts in any of the directories mentioned in the 'runtimepath' option to determine the filetype. These scripts always include $VIMRUNTIME/filetype.vim from the distribution; they may include ~/.vim/filetype.vim if you have created it. Near the end of $VIMRUNTIME/filetype.vim there is a line "runtime! ftdetect/*.vim" to source additional (optional) scripts in e.g. ~/.vim/ftdetect/ 2. Filetype plugins are ON: whenever the 'filetype' is set for a file (usually as a result of step 1), the ftplugin/ subdirectory of 'runtimepath' directories are searched (in the order of the 'runtimepath' option) for a .vim script whose name (before .vim) matches the filetype. All such scripts, if any, are sourced in the order they are found. These scripts are supposed to define buffer-local options and/or buffer-local mappings and abbreviations for files of the given filetype. 3. Filetype indenting is ON: additionally, indent/ subdirectories are searched the same way ftplugin/ subdirectories were searched at step 2. These scripts are supposed to define how text in files of the given filetype must be auto-indented. In addition, if you have used ":syntax on", the 'syntax' option is set to (usually) the same value as the filetype; and syntax/ subdirectories of 'runtimepath' directories are searched for .vim scripts matching the syntax name. These scripts are supposed to define the syntax groups for files of the given syntax, and, if they create new syntax group names (which is usually the case), to define default highlight links or default highlight colors for use (if no colorscheme is already saying how these new groups must be displayed) in three kinds of terminal, namely B&W text, color text, and GUI. Depending on the filetype and on what the corresponding scripts do, all the above can be very simple (e.g. the c.vim indent plugin merely sets 'cindent' on) or very complex, including invocation of scripts for different filetypes or syntaxes in order to handle special regions of the file: for instance, the vim.vim syntax script (used for vim scripts) invokes perl, ruby, python, tcl and (in Vim 7) scheme syntaxes to handle here-documents; HTML syntax invokes CSS, javascript and VB syntaxes; C++ scripts invoke C scripts (both syntax and ftplugin); and so on. Options can also be set on a file-by-file basis if 'modeline' is TRUE and 'modelines' is nonzero, which are the 'nocompatible' default in Vim. Not every option can be set by modelines, for security reasons. Best regards, Tony.
Re: text is gone
On Thu, 2006-09-07 at 10:19 -0400, Charles E Campbell Jr wrote: > scott wrote: > >ok, so help me out here > > > >i've looked at filetype vim, and i see nothing that associates > >_.txt modules with ft=txt > > > >whether i enter my 'ai' modules with the script or by navigating > >to where they are and, with my bloody fingers typing 'gvim > >ai_200609.txt', still, inside the module, filetype is undefined > > > >are we only supposed to use vim for exotic languages? > > > >is 'text' deprecated? > > > >i thought it used to suffice to have an extension of .txt > > > >now the ground is shifting under my feet... > > - > > scott wrote again: > >excuse me > > > >this transcends ridiculous > > > >i am editing text, and i have gone around the bend to tell vim > >that i am doing so > > > >to have to create an entire "text" syntax, where NOTHING HAPPENS, > >seems against every premise that vim was built on > > > >why do i have to be surprised by 'cindent' when i am editing text? > >it is, after all, text, and i went out of my way to define these > >modules with the .txt extension, even here in linux -- specifically > >so he'd know > > > >why would cindent kick in if i'm not editing c? > > > >now you say *.txt is associated with nothing -- that goes far to > >explain why my search in filetype.vim for 'txt' was so fruitless, > >thank you > > > >i don't remember having this problem before -- before what exactly > >i'm not sure -- but i've been surprised with indenting behavior enough > >to go out of my way to turn every indenting feature off i can find, > >but still i get surprises > > > >now cindent is off, maybe i can still work...tab is easy to hit... > > > >forgive me, i have no bottom line -- no idea what i'm saying -- > >i'll shutup now > > Yep, nothing associates *.txt modules with ft=txt. That's because there > is no syntax/txt.vim highlighting, at least as distributed. What > highlighting should be done for a non-specific, arbitrary language? > Keywords? Regions? Or did you intend to mean that you used a .txt > suffix to avoid syntax highlighting, filetype plugins, etc? > > To answer your question about cindent -- are you sure you're not setting > it yourself in your .vimrc? To find out where it was last set: > >:verbose set cin? > > There's also autoindent (short form: ai). If that's on, to find out > where it was last set: > > :verbose set ai? > > Perhaps you can either remove these settings from your .vimrc if that's > where they're set or remove any plugins that are setting them. > > What do you mean by "entering your ai modules with the script"? > > Chip Campbell > it is irrelevant to my rant, but i'm glad to share -- it's a simple one line bash executable on my bin path that gets me into the current 'ai' module (think "action items"): #!/bin/bash gvim -S ~/bin/ai.vim and then ai.vim sets up the name: let s:name = '~/documents/txt/ai_' . strftime("%Y%m") . '.txt' execute "e +" s:name since i was editing ai_200609.txt having used this process, i felt obliged, in the interest of full disclosure, to mention it in the context of why filetype might not be set my 'ai' modules and vim's autoindent feature are related only in that they share a name for homework i am assigning myself the research of as many flavors of indenting as i can find -- my first objective will be to find out exactly how many options are being set with the command :set filtype plugin indent
Re: text is gone
scott wrote: >ok, so help me out here > >i've looked at filetype vim, and i see nothing that associates >_.txt modules with ft=txt > >whether i enter my 'ai' modules with the script or by navigating >to where they are and, with my bloody fingers typing 'gvim >ai_200609.txt', still, inside the module, filetype is undefined > >are we only supposed to use vim for exotic languages? > >is 'text' deprecated? > >i thought it used to suffice to have an extension of .txt > >now the ground is shifting under my feet... - scott wrote again: >excuse me > >this transcends ridiculous > >i am editing text, and i have gone around the bend to tell vim >that i am doing so > >to have to create an entire "text" syntax, where NOTHING HAPPENS, >seems against every premise that vim was built on > >why do i have to be surprised by 'cindent' when i am editing text? >it is, after all, text, and i went out of my way to define these >modules with the .txt extension, even here in linux -- specifically >so he'd know > >why would cindent kick in if i'm not editing c? > >now you say *.txt is associated with nothing -- that goes far to >explain why my search in filetype.vim for 'txt' was so fruitless, >thank you > >i don't remember having this problem before -- before what exactly >i'm not sure -- but i've been surprised with indenting behavior enough >to go out of my way to turn every indenting feature off i can find, >but still i get surprises > >now cindent is off, maybe i can still work...tab is easy to hit... > >forgive me, i have no bottom line -- no idea what i'm saying -- >i'll shutup now Yep, nothing associates *.txt modules with ft=txt. That's because there is no syntax/txt.vim highlighting, at least as distributed. What highlighting should be done for a non-specific, arbitrary language? Keywords? Regions? Or did you intend to mean that you used a .txt suffix to avoid syntax highlighting, filetype plugins, etc? To answer your question about cindent -- are you sure you're not setting it yourself in your .vimrc? To find out where it was last set: :verbose set cin? There's also autoindent (short form: ai). If that's on, to find out where it was last set: :verbose set ai? Perhaps you can either remove these settings from your .vimrc if that's where they're set or remove any plugins that are setting them. What do you mean by "entering your ai modules with the script"? Chip Campbell
Re: text is gone
scott wrote: [...] why would cindent kick in if i'm not editing c? [...] Maybe you set it yourself or some plugin set it for you. A.J.Mechelynck proposed you really good thing. Remove code that turns cindent off, restart vim and type :verbose set cindent? and you will see where this option was set last. If this would not make it clear for you who is setting cindent, then, I believe, you can post result of this command here and somebody could help you understand vim a bit better.
Re: text is gone
scott wrote: On Thu, 2006-09-07 at 08:13 +0200, A.J.Mechelynck wrote: scott wrote: ok, so help me out here i've looked at filetype vim, and i see nothing that associates _.txt modules with ft=txt whether i enter my 'ai' modules with the script or by navigating to where they are and, with my bloody fingers typing 'gvim ai_200609.txt', still, inside the module, filetype is undefined are we only supposed to use vim for exotic languages? is 'text' deprecated? i thought it used to suffice to have an extension of .txt now the ground is shifting under my feet... sc As far as I rember checking, *.txt was associated with nothing so it was edited as, basically, free text with just a single B&W set of fg/bg colors, no auto-linebreak etc. There is an autocommand in the vimrc_example.vim which sets 'textwidth' to 78 (causing auto-linebreak at column 78) for any files with "text" filetypes. If you want to detect *.txt, you can: 8< ~/.vimrc " ... runtime vimrc_example.vim au! vimrcEx FileType " ...etc. >8 8< ~/.vim/filetype.vim augroup filetypedetect " ... etc ... au BufRead,BufNewFile *.txt setf text " ... etc ... augroup END >8 then write your own scripts: ~/.vim/ftplugin/text.vim (for local options using ":setlocal" and/or mappings/abbreviations using ":map ", ":abbr " etc.), ~/.vim/syntax/text.vim (for syntax colouring if any: ":syntax" and ":hi default" commands) ~/.vim/indent/text.vim (for special indenting if any: probably ":setlocal indentexpr" to a function defined there). (on Windows, replace /.vim/ by /vimfiles/ and .vimrc by _vimrc) Best regards, Tony. excuse me this transcends ridiculous i am editing text, and i have gone around the bend to tell vim that i am doing so to have to create an entire "text" syntax, where NOTHING HAPPENS, seems against every premise that vim was built on No, no, no! You don't "have" to; you don't have to do _anything_ if freeform single-color display is OK to you for that kind of file. If you want fancy colors (e.g., odd lines with light pink background and even lines with light yellow background), fancy indenting (such as 4 kinds of bulleted lists: * - o and ยค, and 5 kinds of numbered lists: 1., 2., 3.; A., B., C.; a), b), c); I., II., III and i. ii., iii), or special mappings and options, _then_ you have to tell Vim. why do i have to be surprised by 'cindent' when i am editing text? it is, after all, text, and i went out of my way to define these modules with the .txt extension, even here in linux -- specifically so he'd know You shouldn't, because the 'cindent' default is FALSE. The C indent plugin sets it, but since it is well-behaved it uses ":setlocal", not ":set", and the indenting of your other files won't be affected. why would cindent kick in if i'm not editing c? It shouldn't. The indent/c.vim plugin (which, BTW, is not sourced unless you have ":filetype indent on") uses "setlocal cindent" which should not propagate to other files. Now if you set 'cindent' manually you should also use ":setlocal" rather than ":set", because the latter modifies not only the local setting but also the global default. And if you want to know whether 'cindent' is set, you should use ":set cindent?" (or its variants with ":setlocal" or ":setglobal") _with_ a question mark, because without one it means "set 'cindent' to TRUE", not "display its current value". now you say *.txt is associated with nothing -- that goes far to explain why my search in filetype.vim for 'txt' was so fruitless, thank you My pleasure. i don't remember having this problem before -- before what exactly i'm not sure -- but i've been surprised with indenting behavior enough to go out of my way to turn every indenting feature off i can find, but still i get surprises now cindent is off, maybe i can still work...tab is easy to hit... forgive me, i have no bottom line -- no idea what i'm saying -- i'll shutup now sc I use (in this order) runtime vimrc_example.vim (which contains "filetype plugin indent on") filetype indent off set autoindent smartindent (and 'cindent' is off by default). I may turn 'smartindent' off someday of it proves obnoxious. 'autoindent' indents each line to the same indent as the one it was broken off from (the following one for O, otherwise usually the previous one). That's good enough for vim script or HTML (which are what I code), where there may be long blocks of code with a common indent. Best regards, Tony.
Re: text is gone
Hi Scott, > > excuse me > > this transcends ridiculous > > i am editing text, and i have gone around the bend to tell vim > that i am doing so > Apparently you can just make a file like this: ~/.vim/ftdetect/txt.vim: au BufRead,BufNewFile *.txt set filetype=txt All done. See ':help new-filetype' for more infomration > > to have to create an entire "text" syntax, where NOTHING HAPPENS, > seems against every premise that vim was built on > No, you don't need to make syntax files or anything like that, all you need is the 'set filetype=txt' part. > why do i have to be surprised by 'cindent' when i am editing text? > it is, after all, text, and i went out of my way to define these > modules with the .txt extension, even here in linux -- specifically > so he'd know > > why would cindent kick in if i'm not editing c? > Perhaps because cindent is useful in languages other than c. Therefore, it won't automatically 'switch off' in other file types. However, you can switch it off manually for certain filetypes like so: ~/.vim/after/ftplugin/txt.vim set nocindent set nosmartindent set noautoindent > > i don't remember having this problem before -- before what exactly > i'm not sure -- but i've been surprised with indenting behavior enough > to go out of my way to turn every indenting feature off i can find, > but still i get surprises > Are you using one of the example .vimrc files? If so, I would recommend that you go through and disable every feature unless you are sure you want it and you know how it works. This way, you can get a 'cleaner' Vim without the bad surprises. Many Vim features require time to learn, otherwise they are just confusing and frustrating, so it's best to avoid them until you know how they work. regards, Peter Do you Yahoo!? The new TV home page features highlights, popular picks, and the best of homemade TV http://au.tv.yahoo.com/tv/
Re: text is gone
On Thu, 2006-09-07 at 08:13 +0200, A.J.Mechelynck wrote: > scott wrote: > > ok, so help me out here > > > > i've looked at filetype vim, and i see nothing that associates > > _.txt modules with ft=txt > > > > whether i enter my 'ai' modules with the script or by navigating > > to where they are and, with my bloody fingers typing 'gvim > > ai_200609.txt', still, inside the module, filetype is undefined > > > > are we only supposed to use vim for exotic languages? > > > > is 'text' deprecated? > > > > i thought it used to suffice to have an extension of .txt > > > > now the ground is shifting under my feet... > > > > sc > > > > > > As far as I rember checking, *.txt was associated with nothing so it was > edited as, basically, free text with just a single B&W set of fg/bg > colors, no auto-linebreak etc. > > There is an autocommand in the vimrc_example.vim which sets 'textwidth' > to 78 (causing auto-linebreak at column 78) for any files with "text" > filetypes. > > If you want to detect *.txt, you can: > > 8< ~/.vimrc > " ... > runtime vimrc_example.vim > au! vimrcEx FileType > " ...etc. > >8 > > 8< ~/.vim/filetype.vim > augroup filetypedetect > " ... etc ... > au BufRead,BufNewFile *.txt setf text > " ... etc ... > augroup END > >8 > > then write your own scripts: > ~/.vim/ftplugin/text.vim (for local options using ":setlocal" > and/or mappings/abbreviations using ":map ", ":abbr " etc.), > ~/.vim/syntax/text.vim (for syntax colouring if any: ":syntax" and > ":hi default" commands) > ~/.vim/indent/text.vim (for special indenting if any: probably > ":setlocal indentexpr" to a function defined there). > > (on Windows, replace /.vim/ by /vimfiles/ and .vimrc by _vimrc) > > > Best regards, > Tony. excuse me this transcends ridiculous i am editing text, and i have gone around the bend to tell vim that i am doing so to have to create an entire "text" syntax, where NOTHING HAPPENS, seems against every premise that vim was built on why do i have to be surprised by 'cindent' when i am editing text? it is, after all, text, and i went out of my way to define these modules with the .txt extension, even here in linux -- specifically so he'd know why would cindent kick in if i'm not editing c? now you say *.txt is associated with nothing -- that goes far to explain why my search in filetype.vim for 'txt' was so fruitless, thank you i don't remember having this problem before -- before what exactly i'm not sure -- but i've been surprised with indenting behavior enough to go out of my way to turn every indenting feature off i can find, but still i get surprises now cindent is off, maybe i can still work...tab is easy to hit... forgive me, i have no bottom line -- no idea what i'm saying -- i'll shutup now sc
Re: text is gone
scott wrote: ok, so help me out here i've looked at filetype vim, and i see nothing that associates _.txt modules with ft=txt whether i enter my 'ai' modules with the script or by navigating to where they are and, with my bloody fingers typing 'gvim ai_200609.txt', still, inside the module, filetype is undefined are we only supposed to use vim for exotic languages? is 'text' deprecated? i thought it used to suffice to have an extension of .txt now the ground is shifting under my feet... sc As far as I rember checking, *.txt was associated with nothing so it was edited as, basically, free text with just a single B&W set of fg/bg colors, no auto-linebreak etc. There is an autocommand in the vimrc_example.vim which sets 'textwidth' to 78 (causing auto-linebreak at column 78) for any files with "text" filetypes. If you want to detect *.txt, you can: 8< ~/.vimrc " ... runtime vimrc_example.vim au! vimrcEx FileType " ...etc. >8 8< ~/.vim/filetype.vim augroup filetypedetect " ... etc ... au BufRead,BufNewFile *.txt setf text " ... etc ... augroup END >8 then write your own scripts: ~/.vim/ftplugin/text.vim (for local options using ":setlocal" and/or mappings/abbreviations using ":map ", ":abbr " etc.), ~/.vim/syntax/text.vim (for syntax colouring if any: ":syntax" and ":hi default" commands) ~/.vim/indent/text.vim (for special indenting if any: probably ":setlocal indentexpr" to a function defined there). (on Windows, replace /.vim/ by /vimfiles/ and .vimrc by _vimrc) Best regards, Tony.
text is gone
ok, so help me out here i've looked at filetype vim, and i see nothing that associates _.txt modules with ft=txt whether i enter my 'ai' modules with the script or by navigating to where they are and, with my bloody fingers typing 'gvim ai_200609.txt', still, inside the module, filetype is undefined are we only supposed to use vim for exotic languages? is 'text' deprecated? i thought it used to suffice to have an extension of .txt now the ground is shifting under my feet... sc