Thread: [Vim-latex-devel] envmacros.vim
Brought to you by:
srinathava,
tmaas
From: Mikolaj M. <mi...@wp...> - 2002-11-17 17:41:56
|
I am redirecting to devel list. On Sat, Nov 16, 2002 at 04:54:27PM -0800, Srinath Avadhanula wrote: > Hello! > I did most of this myself because I couldn't resist ;) > So the TODO which remains for envmacros.vim: > 1. EFI in menu and EFI in maps insert different things. > 2. Introduce a new setting g:Tex_UseMenuWizard in texrc to see if user > wants wizard behavior or not. > 3. Change s:Tex_change_environments to also use the > s:PromptForEnvironment function. > 4. Put a "Choose Environment" in the environments main menu (which > should shortcut to Tex_FastEnvironmentInsert()). > 5. Documentation!!! All these features are presently hidden from user. > The reason for making a seperate function is that in the future, we might > let the user choose which are the environments he most commonly uses > instead of hardcoding them into s:common_environments. Eeee, what exactly is left to do? I'd like to introduce one more feature: more intelligent F5 key. It will act: x - cursor I. Empty file 1. Empty line ---------- x --------- Asks for environment. 2. One word in line ---------- asdfx --------- Treats "asdf" as name of the environment 3. More than one word in line ---------- asdf asdfx --------- Looks for environment and try to change it. II. Non empty file (only \documentclass declaration) 1. Empty line ---------- \documentclass{article} x --------- Asks for package 2. One word in line ---------- \documentclass{article} asdfx --------- Treats "asdf" as name of the package (and checks if supported) 2. If line contains \usepackage ---------- \documentclass{article} \usepackage{asdf}x --------- Change package. Useful when changing supported packages. III. Template ---------- \documentclass{article} \begin{document} \end{document} --------- If cursor is above \begin{document} behaviour as in II, if below as in I. What do you think about it? Mikolaj |
From: Srinath A. <sr...@ee...> - 2002-11-17 18:23:04
|
Hey Mikolaj! On Sun, 17 Nov 2002, Mikolaj Machowski wrote: > > I am redirecting to devel list. > > On Sat, Nov 16, 2002 at 04:54:27PM -0800, Srinath Avadhanula wrote: > > Hello! > > I did most of this myself because I couldn't resist ;) > > So the TODO which remains for envmacros.vim: > > 1. EFI in menu and EFI in maps insert different things. > > 2. Introduce a new setting g:Tex_UseMenuWizard in texrc to see if user > > wants wizard behavior or not. > > 3. Change s:Tex_change_environments to also use the > > s:PromptForEnvironment function. > > 4. Put a "Choose Environment" in the environments main menu (which > > should shortcut to Tex_FastEnvironmentInsert()). > > 5. Documentation!!! All these features are presently hidden from user. > > Eeee, what exactly is left to do? :) Plenty. See the TODO list above. none of these are implemented yet. The _most important_ thing still unimplemented imo is number 2 above. This according to me is really really important. This setting will have to be used by each of the Tex_itemize() and such functions. For example, pressing <F5> now and choosing 'figure' asks many many questions. I would prefer just inserting a template with placeholders. > I'd like to introduce one more feature: more intelligent F5 key. It will > act: > x - cursor > I. Empty file > 1. Empty line > ---------- > > x > > --------- > Asks for environment. > 2. One word in line > ---------- > > asdfx > > --------- > Treats "asdf" as name of the environment > This is already the behavior. When there is a word, it constructs an environment from that, otherwise it prompts. Try it out... As of now, it doesn't care about whether there is stuff in the file or not. However, if we do begin caring about file content, we should look out for whether this is the main file or not. For example, if there is a main.tex.latexmain in the current directory and we are not editing main.tex, then only use behavior I, irrespective of file content. > 3. More than one word in line > ---------- > > asdf asdfx > > --------- > Looks for environment and try to change it. I dont understand this... What would be an example? > II. Non empty file (only \documentclass declaration) Shouldn't this be: If in the preamble of the main file? We could check for being in the preamble by whether we are after \documentclass but before \begin{document} > 1. Empty line > ---------- > \documentclass{article} > x > > --------- > Asks for package > 2. One word in line > ---------- > \documentclass{article} > asdfx > > --------- > Treats "asdf" as name of the package (and checks if supported) > 2. If line contains \usepackage > ---------- > \documentclass{article} > \usepackage{asdf}x > > --------- > Change package. Useful when changing supported packages. Okay. This does sound useful, but use the Tex_GetMainFileName() if you implement something like this. > III. Template > ---------- > \documentclass{article} > > \begin{document} > > \end{document} > --------- > If cursor is above \begin{document} behaviour as in II, if below as in > I. Hmmm... The template is created only once during the entire editing cycle. I dont think we need to have shortcuts for it since its highly improbable that a user will keep changing templates! Also, another idea. As of now, Carl's suggestion of having <S-F1> through <S-F4> map to commonly used environments is not implemented. A good way to do this will be to have a setting: g:Tex_CommonEnvironments in texrc and map <S-F1> through <S-F4> (note that its <S-F1>, not <F1>), to the environments in those. This way, we will have customization and if someone decides that he doesn't want these shortcuts, he can leave g:Tex_CommonEnvironments = '' So thats another TODO item... Plenty of things to choose from :) Srinath -- Srinath Avadhanula Nov 17 10:02am "I used to think that the brain was the most wonderful organ in my body. Then I realized who was telling me this." -- Emo Phillips |
From: Luc H. <her...@fr...> - 2002-11-18 01:10:51
|
Hello, * On Sun, Nov 17, 2002 at 10:23:32AM -0800, Srinath Avadhanula <sr...@ee...> wrote: > > III. Template > > ---------- > Hmmm... The template is created only once during the entire editing > cycle. I dont think we need to have shortcuts for it since its highly > improbable that a user will keep changing templates! I Agree! > Also, another idea. As of now, Carl's suggestion of having <S-F1> > through <S-F4> map to commonly used environments is not implemented. A > good way to do this will be to have a setting: > g:Tex_CommonEnvironments > > in texrc and map <S-F1> through <S-F4> (note that its <S-F1>, not <F1>), > to the environments in those. This way, we will have customization and > if someone decides that he doesn't want these shortcuts, he can leave > g:Tex_CommonEnvironments = '' I don't like the idea of having <xx-Fd> keys messed up with anything. So leaving an option to disable this feature is a good idea. Otherwise, I should be able to provide you a more advanced templates mecanism completly independant of any LaTeX considerations. -- Luc Hermitte |
From: Srinath A. <sr...@ee...> - 2002-11-18 03:36:57
|
> > to the environments in those. This way, we will have customization and > > if someone decides that he doesn't want these shortcuts, he can leave > > g:Tex_CommonEnvironments = '' > > I don't like the idea of having <xx-Fd> keys messed up with anything. So > leaving an option to disable this feature is a good idea. > Yes... disabling this feature will simply mean leaving g:Tex_CommonEnvironments = '' > Otherwise, I should be able to provide you a more advanced templates > mecanism completly independant of any LaTeX considerations. What new functionality will these provide? Srinath -- Srinath Avadhanula Nov 17 7:34pm New crypt. See /usr/news/crypt. |
From: Luc H. <her...@fr...> - 2002-11-18 11:29:19
|
* On Sun, Nov 17, 2002 at 07:36:27PM -0800, Srinath Avadhanula <sr...@ee...> wrote: > > Otherwise, I should be able to provide you a more advanced templates > > mecanism completly independant of any LaTeX considerations. > > What new functionality will these provide? As I said, it will be independant of the type of the buffers manipulated ; ie one plugin (made of 3-4 files) for latex, vimL, C++, xslt, ... It is based on mu-template [BTW, I have some features in mind that I want to provide and then I will contact Gergely Kontra in case he is still maintening (t)his plugin]. Otherwise, the other features are: - Empty lines coming from '¡...¡' or '¿...¿' are purged - A template skeleton can be reindented after it has been loaded - The templates can be placed in any directory from {runtimepath}/template or $VIMTEMPLATE (list of directories) Useful for shared projects or installations - Several options permit to deactivate some automatic and undesirable behaviours when needed - I've defined a mapping (i_CTRL-R_TAB) that will search for template files matching: "template.{&ft}-{<cWORD>}" or "{&ft}/template.{cWORD}" ; in case there are several choices, a dialog will ask the user which template to insert ; cf xslt/ and tex/ templates in mu-template.tar.gz in my http://hermitte.free.fr/vim/ressources/ directory. i_CTRL-R_SPACE will work instead with the keyword preceding the position of the cursor. i_CTRL-R_xxx mappings can be changed to anything we want from outside the plugin thanks to the <Plug> mecanism. - It supports markers from my version of bracketing.base.vim, Robert Kelly IV's markjump or your placeholders from imaps.vim The current 0.26 version is functional and so far I have only one "bug" left (my vim windows blinks one time ; ie I got one flash in insert mode -- not critical, but undesired). I haven't written the documentation yet. But as you will notice, it is not complicated to use. Check the templates skeletons I propose for examples. -- Luc Hermitte |
From: Mikolaj M. <mi...@wp...> - 2002-11-19 17:51:18
|
On Sun, Nov 17, 2002 at 10:23:32AM -0800, Srinath Avadhanula wrote: > However, if we do begin caring about file content, we should look out > for whether this is the main file or not. For example, if there is a > main.tex.latexmain in the current directory and we are not editing > main.tex, then only use behavior I, irrespective of file content. Simpler is just checking if in current file is \documentclass declaration. > > 3. More than one word in line > > ---------- > > > > asdf asdfx > > > > --------- > > Looks for environment and try to change it. > I dont understand this... What would be an example? a. ---------- \begin{quote} asdf asdfx \end{quote} --------- After <F5> you will get: You are inside quote environment. Do you want to change it to: b. ---------- \begin{quote} asdfx \end{quote} --------- After <F5> ---------- \begin{quote} \begin{asdf} x \end{asdf} \end{quote} --------- > > II. Non empty file (only \documentclass declaration) > Shouldn't this be: If in the preamble of the main file? We could check > for being in the preamble by whether we are after \documentclass but > before \begin{document} Yes. But what if there is no \begin{document} line? > > 1. Empty line > > ---------- > > \documentclass{article} > > x > > > > --------- > > Asks for package > > 2. One word in line > > ---------- > > \documentclass{article} > > asdfx > > > > --------- > > Treats "asdf" as name of the package (and checks if supported) > > 2. If line contains \usepackage > > ---------- > > \documentclass{article} > > \usepackage{asdf}x > > > > --------- > > Change package. Useful when changing supported packages. > Okay. This does sound useful, but use the Tex_GetMainFileName() if you > implement something like this. OK. > > III. Template > > ---------- > > \documentclass{article} > > > > \begin{document} > > > > \end{document} > > --------- > > If cursor is above \begin{document} behaviour as in II, if below as in > > I. > Hmmm... The template is created only once during the entire editing > cycle. I dont think we need to have shortcuts for it since its highly > improbable that a user will keep changing templates! But sometimes you want to change package, add one. m. |