On Monday, November 25, 2013 5:40:15 AM UTC-6, BPJ wrote: > I need help with the following. I've googled for half an hour > > but don't seem to be able to formulate the questions correctly. > > As usual it's probably in the help but I don't know where to look! > >
In the future please start two separate threads if you have two questions. > > * How to call an external script from inside a function without > > affecting anything inside Vim, but getting its error message > > if any, preferably in a window without polluting any important > > existing window. > The system() function will return (as a string) the output of an external command without modifying any text in buffers. After system() runs the error code returned is in v:shell_error. See :help system() > > > * How to open a specific file in a specific window of the > > current tab from inside a function, given the path to that > > file as a string argument. There are three windows like this, > > and I wan't to open two other files in a and c, so I guess > > I'll also need to know how to identify those windows, with a > > on the left as well as the mirror image with a on the right: > > > > +--+--+ > > | |b | > > |a +--+ > > | |c | > > +--+--+ > Each window inside Vim is assigned a number. Window numbers start at 1 in the topmost leftmost window and always increase as you go down or right. So in this example 'a' will have window number 1, b will have 2, and c will have 3. To open a specific file in a specific window, you will need 2 or 3 steps: 1. Jump to the desired window 2. Open the file 3. [optional] jump back to the previous window For example, to edit "myfile.txt" in window 3 and then return to the previous window: 3wincmd w | e myfile.txt | wincmd p You can build such a string with a few :execute commands if you need to calculate file names or window numbers from variables. -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
