Re: Some basic Vim commands
Julius Hamilton wrote: > I can jump to the beginning of some text on a line that begins with > whitespace with v, w, h, d. Is there a single command to delete all initial > whitespace on a line? I'd typically do that in either of two ways: : {range} s/^[ TAB]*// With a {range} like ".", ".+2", "1,.", ".,$" or "'a,'e" (my standard begin and end range marks). Or without using ex mode commands "^" to jumpt to first non-whitespace on the line and then "d0" to delete to first column. > I then wanted to jump over a few words to the next number (in brackets). Is > there any command to the effect of "find the next number"? Save search pattern then use next: /[0-9]/ n > Then I wanted to say: take this word and the next two words, and send them > down 3 newlines. Would there be a way to do that? I'm unclear in particular what this is asking for. Maybe "d3w3jp" ? Elijah -- -- 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 vim_use+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/4FN1Td0cb7zfYm%40panix5.panix.com.
Re: Some basic Vim commands
On Sat, Apr 17, 2021 at 4:48 PM Julius Hamilton wrote: > > I was curious: > > I can jump to the beginning of some text on a line that begins with > whitespace with v, w, h, d. Is there a single command to delete all initial > whitespace on a line? > > I then wanted to jump over a few words to the next number (in brackets). Is > there any command to the effect of "find the next number"? > > Then I wanted to say: take this word and the next two words, and send them > down 3 newlines. Would there be a way to do that? > > Thanks very much, > Julius To go to he first nonblank on the current line: ^ To go to the first charcter of any kind on the current line: 0 To jump to the next v w h or d at the start of a word: /\<[vwhd] To delete all initial whitespace on the current line: :s/^\s*// To delete all final whitespace on all lines: :%s/\s*$// To go to the next digit: /\d To go to the next digit immediately after an opening bracket: /(\zs\d You may want to study the following helpfiles for explanations about the above and about other similar questions: :help pattern.txt :help motion.txt Best regards, Tony. -- -- 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 vim_use+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAJkCKXsVO0iUDTRw8ROktiGuAg5fS4rQc3Xy_ggnF6zW%2B10bLA%40mail.gmail.com.
Re: Why vimdiff <() <() reset when terminal is switched?
Here is what I have. I have tried to remove ~/.vim/ftdetect ~/.vim/bundle-available ~/.vim/after ~/.vim/plugin. The problem is not gone. When I try to remove ~/.vim, the problem is gone. It is very hard to debug this problem. Could this problem be due to some interaction between two plugins? $ cat ~/plugins.txt 1: /Applications/MacVim.app/Contents/Resources/vim/vimrc 2: ~/.vimrc 3: ~/.vim/autoload/pathogen.vim 4: ~/.vim/filetype.vim 5: /Applications/MacVim.app/Contents/Resources/vim/runtime/filetype.vim 6: ~/.vim/ftdetect/bug.vim 7: ~/.vim/ftdetect/json.vim 8: ~/.vim/ftdetect/markdown.vim 9: ~/.vim/ftdetect/sage.vim 10: ~/.vim/bundle-available/jade/ftdetect/jade.vim 11: ~/.vim/bundle-available/Nvim-R/ftdetect/r.vim 12: ~/.vim/bundle-available/R-Vim-runtime/ftdetect/r_file_types.vim 13: ~/.vim/bundle-available/vim-jq/ftdetect/jq.vim 14: ~/.vim/bundle-available/vim-jst/ftdetect/jst.vim 15: ~/.vim/bundle-available/vim-perl/ftdetect/mason-in-html.vim 16: ~/.vim/bundle-available/vim-perl/ftdetect/perl11.vim 17: ~/.vim/bundle-available/vim-racket/ftdetect/racket.vim 18: ~/.vim/bundle-available/vim-scala/ftdetect/scala.vim 19: ~/.vim/bundle-available/vim-solidity/ftdetect/solidity.vim 20: ~/.vim/after/filetype.vim 21: /Applications/MacVim.app/Contents/Resources/vim/runtime/ftplugin.vim 22: /Applications/MacVim.app/Contents/Resources/vim/runtime/indent.vim 23: /Applications/MacVim.app/Contents/Resources/vim/runtime/syntax/syntax.vim 24: /Applications/MacVim.app/Contents/Resources/vim/runtime/syntax/synload.vim 25: /Applications/MacVim.app/Contents/Resources/vim/runtime/syntax/syncolor.vim 26: ~/.vim/plugin/a.vim 27: ~/.vim/plugin/AnsiEscPlugin.vim 28: ~/.vim/plugin/cecutil.vim 29: ~/.vim/plugin/dbext.vim 30: ~/.vim/plugin/head.vim 31: ~/.vim/plugin/IndentAnything.vim 32: ~/.vim/plugin/LargeFile.vim 33: ~/.vim/plugin/matchit.vim 34: ~/.vim/plugin/pydoc.vim 35: ~/.vim/plugin/rails.vim 36: ~/.vim/plugin/screen.vim 37: ~/.vim/plugin/Tabular.vim 38: ~/.vim/plugin/vimim.vim 39: ~/.vim/bundle-available/cscope/plugin/cscope_maps.vim 40: ~/.vim/bundle-available/diffchar/plugin/diffchar.vim 41: ~/.vim/bundle-available/LanguageTool/plugin/LanguageTool.vim 42: ~/.vim/bundle-available/nerdtree/plugin/NERD_tree.vim 43: ~/.vim/bundle-available/nerdtree/autoload/nerdtree.vim 44: ~/.vim/bundle-available/nerdtree/lib/nerdtree/path.vim 45: ~/.vim/bundle-available/nerdtree/lib/nerdtree/menu_controller.vim 46: ~/.vim/bundle-available/nerdtree/lib/nerdtree/menu_item.vim 47: ~/.vim/bundle-available/nerdtree/lib/nerdtree/key_map.vim 48: ~/.vim/bundle-available/nerdtree/lib/nerdtree/bookmark.vim 49: ~/.vim/bundle-available/nerdtree/lib/nerdtree/tree_file_node.vim 50: ~/.vim/bundle-available/nerdtree/lib/nerdtree/tree_dir_node.vim 51: ~/.vim/bundle-available/nerdtree/lib/nerdtree/opener.vim 52: ~/.vim/bundle-available/nerdtree/lib/nerdtree/creator.vim 53: ~/.vim/bundle-available/nerdtree/lib/nerdtree/flag_set.vim 54: ~/.vim/bundle-available/nerdtree/lib/nerdtree/nerdtree.vim 55: ~/.vim/bundle-available/nerdtree/lib/nerdtree/ui.vim 56: ~/.vim/bundle-available/nerdtree/lib/nerdtree/event.vim 57: ~/.vim/bundle-available/nerdtree/lib/nerdtree/notifier.vim 58: ~/.vim/bundle-available/nerdtree/autoload/nerdtree/ui_glue.vim 59: ~/.vim/bundle-available/nerdtree/nerdtree_plugin/exec_menuitem.vim 60: ~/.vim/bundle-available/nerdtree/nerdtree_plugin/fs_menu.vim 61: ~/.vim/bundle-available/RST-Tables/plugin/rst_table.vim 62: ~/.vim/bundle-available/vim-cython/plugin/cython.vim 63: ~/.vim/bundle-available/vim-diff-enhanced/plugin/EnhancedDiff.vim 64: ~/.vim/bundle-available/vim-indent-guides/plugin/indent_guides.vim 65: ~/.vim/bundle-available/vim-indent-guides/autoload/indent_guides.vim 66: ~/.vim/bundle-available/vim-latex-suite/plugin/filebrowser.vim 67: ~/.vim/bundle-available/vim-latex-suite/plugin/imaps.vim 68: ~/.vim/bundle-available/vim-latex-suite/plugin/libList.vim 69: ~/.vim/bundle-available/vim-latex-suite/plugin/remoteOpen.vim 70: ~/.vim/bundle-available/vim-latex-suite/plugin/SyntaxFolds.vim 71: ~/.vim/bundle-available/vim-pandoc/plugin/pandoc.vim 72: ~/.vim/bundle-available/vim-pandoc-syntax/plugin/pandoc-syntax-check.vim 73: ~/.vim/bundle-available/vim-scala/plugin/scala.vim 74: /Applications/MacVim.app/Contents/Resources/vim/runtime/plugin/getscriptPlugin.vim 75: /Applications/MacVim.app/Contents/Resources/vim/runtime/plugin/gzip.vim 76: /Applications/MacVim.app/Contents/Resources/vim/runtime/plugin/logiPat.vim 77: /Applications/MacVim.app/Contents/Resources/vim/runtime/plugin/manpager.vim 78: /Applications/MacVim.app/Contents/Resources/vim/runtime/plugin/matchparen.vim 79: /Applications/MacVim.app/Contents/Resources/vim/runtime/plugin/netrwPlugin.vim 80: /Applications/MacVim.app/Contents/Resources/vim/runtime/plugin/rrhelper.vim 81: /Applications/MacVim.app/Contents/Resources/vim/runtime/plugin/spellfile.vim 82:
Re: Automating paragraphs (was Re: Dump help pages)
On 2021-04-17 06:30, Julius Hamilton wrote: > Would you mind providing a simple outline of a function which would > terminate on some basic condition, such as, the next line is a blank > newline? I will read those docs. The first step is for you to clarify your criteria. Then :help :function, :help if, and so on, to turn your intentions into code. Or you may not need code as such in your function. :help / tells you how to do searches based on all sorts of criteria, and any Vim command can be included in a function. > I use Vim in Termux, an Android terminal emulator app. I don't know if I > have buttons such as F9. I will investigate it. However, is there a way > to check what non-F keys are free to be mapped to something? Thanks very > much. :help :map I would suggest you not set a goal of reading all the help documents; I believe even experienced Vim users could find that overwhelming. (I know I would.) A much more reasonable goal is to read appropriate _portions_ that answer your questions. And when you're reading something for which you have immediate use, you're much more likely to retain what you read. There is also Google, of course. Just a day or two ago I couldn't think what term to query via :help, so I googled my query and got an answer immediately. -- Stan Brown Tehachapi, CA, USA https://BrownMath.com https://OakRoadSystems.com -- -- 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 vim_use+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/3b0e07a3-6474-e8d6-4378-b54d7ec85f13%40fastmail.fm.
How allow TAB at begining of a line, but expand it to spaces?
Hi, If I use the above at the modeline, it will expand all TABs in a line. But I just want to keep the TAB at the beginning of a line. Could anybody show me how to modify the line to get this behavior? Thanks. vim: set expandtab tabstop=2 shiftwidth=2 softtabstop=-1 fileencoding=utf-8: -- -- 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 vim_use+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/444bff07-7b41-4cd1-9cc8-707364707353n%40googlegroups.com.
Some basic Vim commands
I was curious: I can jump to the beginning of some text on a line that begins with whitespace with v, w, h, d. Is there a single command to delete all initial whitespace on a line? I then wanted to jump over a few words to the next number (in brackets). Is there any command to the effect of "find the next number"? Then I wanted to say: take this word and the next two words, and send them down 3 newlines. Would there be a way to do that? Thanks very much, Julius -- -- 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 vim_use+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAGrXgp3-dqe%2B9UaxMSxi3voAimByQyk%2BzM8Lvih%3DSJj%3DA4XgAw%40mail.gmail.com.
Re: Editing mathematics documents
On Sat, Apr 17, 2021 at 3:43 PM Julius Hamilton wrote: > > I have a question related to editing documents inside Vim. If anyone might > have any tips, I'd really appreciate hearing them. > > I'd like to edit PDFs which contain mathematical symbols, not to publish the > papers myself, as I could with Latex, but just as a form of note-taking. > > I'm curious, could Vim open a PDF as raw textual data? Or is the source text > of a PDF sealed off, and inaccessible? > > And if it could, could it support mathematical formula? Not as a markup > language, but as a kind of textual object you could actually stick the cursor > into and manipulate a bit, such as extracting the top of a quotient and > putting it somewhere else, or an expression to the right of an integral > symbol, for example. > > Or, is there any tool that could do this? Perhaps Emacs? > > Thanks very much, > Julius IIUC PDF files are like books, not meant to be edited (which is one reason while enterprises use them: to avoid text counterfeiting). Again IIUC, it is possible to edit them by using the appropriate Adobe tool, which is not for free, but even with this tool you may need to know the edit password set by the file's creator. OTOH, for simple mathematical formulæ (in ordinary text) you may want to install Dr. Chip Campbell's math menu & keymap http://www.drchip.org/astronaut/vim/#MATH ; and for complex formulæ you may want to use one of the flavours of the Teχ language — maybe XəTeχ which is Unicode-aware and can write PDF but IIUC not read it. In HTML, I think you could also avail yourself of the MathML language (which can be embedded in HTML), provided that the target browser(s) can decipher that. Best regards, Tony. -- -- 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 vim_use+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAJkCKXv_Hr4hbQrr_6bBkMZ2PGM675yMbbdJ0xYF129e0M2-YQ%40mail.gmail.com.
Editing mathematics documents
I have a question related to editing documents inside Vim. If anyone might have any tips, I'd really appreciate hearing them. I'd like to edit PDFs which contain mathematical symbols, not to publish the papers myself, as I could with Latex, but just as a form of note-taking. I'm curious, could Vim open a PDF as raw textual data? Or is the source text of a PDF sealed off, and inaccessible? And if it could, could it support mathematical formula? Not as a markup language, but as a kind of textual object you could actually stick the cursor into and manipulate a bit, such as extracting the top of a quotient and putting it somewhere else, or an expression to the right of an integral symbol, for example. Or, is there any tool that could do this? Perhaps Emacs? Thanks very much, Julius On Sat, Apr 17, 2021, 15:30 Julius Hamilton wrote: > Thanks very much, really appreciate it. > > Would you mind providing a simple outline of a function which would > terminate on some basic condition, such as, the next line is a blank > newline? I will read those docs. > > I use Vim in Termux, an Android terminal emulator app. I don't know if I > have buttons such as F9. I will investigate it. However, is there a way to > check what non-F keys are free to be mapped to something? Thanks very much. > > Best regards, > Julius > > > > On Fri, Apr 16, 2021, 19:27 Stan Brown wrote: > >> On 2021-04-16 09:42, Julius Hamilton wrote: >> >> > At the beginning of a paragraph which has been separated mid-sentence >> > onto separate lines, how might I automate the process of calling CTRL-J >> > until all the separated lines in the paragraph have been combined into >> > one line? Will Vim be able to call CTRL-J until a condition is met, for >> > example, that the single line being built ends in a sentence (a period), >> > or until the next line is a blank newline? >> >> The short answer is go to the top of the paragraph and press Shift+V, >> then to the bottom and press Shift+J (not Ctrl+J). You can automate this >> further by writing a function that would figure out the top and bottom >> of the paragraph via whatever logic you build in. See :help :function. >> >> > Then, how might I automate the process of entering N newlines between >> > every sentence? I.e., automating pressing ), i, enter a few times, then >> > escape, for multiple sentences? I could create a shortcut to execute >> > these commands and call it myself, or it could also repeat until the >> > conditions above. How would I do either? >> >> Example, for N = 4: >> :imap >> Type the actual < and > characters as shown. To use this, at the end of >> typing your paragraph do not press Esc but press F9 (or whatever key you >> mapped). >> >> If you sometimes want to insert N blank lines in already-written text, >> add this: >> :map A >> The previous map was active in insert mode; this one is active in normal >> mode. It moves to the end of the current line ("A") in insert mode and >> then appends the insert-mode version of F9. >> >> Once you've verified that these work as you wish, you can put them in >> your $VIM/_vimrc file so that they will be executed whenever you start >> Vim. >> >> > Also, how do I go back to where the cursor previously was, in case I >> > accidentally move it? >> >> `` or '' >> (One goes back to the _line_) where you were; the other goes back to the >> exact position within the line.) >> >> -- >> Stan Brown >> Tehachapi, CA, USA >> https://BrownMath.com >> https://OakRoadSystems.com >> >> -- >> -- >> 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 vim_use+unsubscr...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/vim_use/d9ee4264-13cb-eef7-be14-e0e68f9df155%40fastmail.fm >> . >> > -- -- 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 vim_use+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAGrXgp16fEb5sE%3DKTvZQcJt8awnQ0Hb%3DCi7CFMQ1uJhE1io1VQ%40mail.gmail.com.
Re: Automating paragraphs (was Re: Dump help pages)
Thanks very much, really appreciate it. Would you mind providing a simple outline of a function which would terminate on some basic condition, such as, the next line is a blank newline? I will read those docs. I use Vim in Termux, an Android terminal emulator app. I don't know if I have buttons such as F9. I will investigate it. However, is there a way to check what non-F keys are free to be mapped to something? Thanks very much. Best regards, Julius On Fri, Apr 16, 2021, 19:27 Stan Brown wrote: > On 2021-04-16 09:42, Julius Hamilton wrote: > > > At the beginning of a paragraph which has been separated mid-sentence > > onto separate lines, how might I automate the process of calling CTRL-J > > until all the separated lines in the paragraph have been combined into > > one line? Will Vim be able to call CTRL-J until a condition is met, for > > example, that the single line being built ends in a sentence (a period), > > or until the next line is a blank newline? > > The short answer is go to the top of the paragraph and press Shift+V, > then to the bottom and press Shift+J (not Ctrl+J). You can automate this > further by writing a function that would figure out the top and bottom > of the paragraph via whatever logic you build in. See :help :function. > > > Then, how might I automate the process of entering N newlines between > > every sentence? I.e., automating pressing ), i, enter a few times, then > > escape, for multiple sentences? I could create a shortcut to execute > > these commands and call it myself, or it could also repeat until the > > conditions above. How would I do either? > > Example, for N = 4: > :imap > Type the actual < and > characters as shown. To use this, at the end of > typing your paragraph do not press Esc but press F9 (or whatever key you > mapped). > > If you sometimes want to insert N blank lines in already-written text, > add this: > :map A > The previous map was active in insert mode; this one is active in normal > mode. It moves to the end of the current line ("A") in insert mode and > then appends the insert-mode version of F9. > > Once you've verified that these work as you wish, you can put them in > your $VIM/_vimrc file so that they will be executed whenever you start Vim. > > > Also, how do I go back to where the cursor previously was, in case I > > accidentally move it? > > `` or '' > (One goes back to the _line_) where you were; the other goes back to the > exact position within the line.) > > -- > Stan Brown > Tehachapi, CA, USA > https://BrownMath.com > https://OakRoadSystems.com > > -- > -- > 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 vim_use+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/vim_use/d9ee4264-13cb-eef7-be14-e0e68f9df155%40fastmail.fm > . > -- -- 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 vim_use+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAGrXgp37RNC_0WneQ1zj3CfhfNWi%2BnunAP4GAKB-g0A23GqKaA%40mail.gmail.com.
Re: Autocomplete c lang with vim
On Sat, Apr 17, 2021 at 1:02 PM 'M.R.P. zensky' via vim_use wrote: > > Hello I am wondering vim has wonderfull simple autocomplete for. html css > javascript to enable autocomplete you just enter one line of code , however > what about other languages like c c++ javaa python. Is th a simple way to get > autocomplete for vim without a plug in? Completion needs fancier code for some languages than for others, and the C filetype-plugin does much more than just defining how to do completion. If you can find a "simple" one-line autocomplete for C C++ etc. in Vim which suits your needs, you're welcome to write it and use it, for instance by means of an after-plugin ~/.vim/after/ftplugin/c.vim (on Windows replace /.vim/ by /vimfiles/) setting the appropriate option to just that line, thus avoiding the need for a completion plugin. Bram uses C a lot: Vim itself is written in C. He is also the author of the C ftplugin and of its (autoload) completion script. I suppose that if it were possible to get a reasonably fancy C completion function (suiting Bram's needs as an author of C code) by means of a single line, it would already long be done, rather than invoking $VIMRUNTIME/autoload/ccomplete.vim and the 236-line ccomplete#Complete() function which it defines. Best regards, Tony. -- -- 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 vim_use+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAJkCKXtsW7R8FccjygdceKPx_yR8ny_P%2BJoKmNoMGgs9_w%2Bepw%40mail.gmail.com.
Autocomplete c lang with vim
Hello I am wondering vim has wonderfull simple autocomplete for. html css javascript to enable autocomplete you just enter one line of code , however what about other languages like c c++ javaa python. Is th a simple way to get autocomplete for vim without a plug in? -- -- 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 vim_use+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/7A4D0F85-6E73-4AF3-88BD-C80D8E139EA5%40icloud.com.