![]() |
| | #16 |
| subminimalist Join Date: Jul 2008 Location: NYC
Posts: 3,946
| Also surprised: Midnight Commander, the *second* best piece of software of all time, placed 3rd in "File Manager". Under "Best Programming Langauge", Python beat C++ 226 to 129... *IDE's were in a seperate catagory, but the winner there (Eclipse) only recieved 129 votes.
__________________ Accuracy and integrity mean nothing if you don't make it past the censors...PYTHAGORAS |
| MK27 is offline | |
| | #17 |
| Complete Beginner Join Date: Feb 2009
Posts: 312
| :s/<regexp>/<replace>/g Replaces <regexp> with <replace> globally. :v :V Start selecting text per character/per line. :y ..."yank", i.e. copy the selected text... :p :P ...and paste at the current cursor position or the next one. :r Enter replace-mode for exactly one character. Handy for fixing typos. :help uganda Make Bram Moolenaar happy. Greets, Philip PS: what is an emac and why do I need several of them to edit text?
__________________ All things begin as source code. Source code begins with an empty file. -- Tao Te Chip |
| Snafuist is offline | |
| | #18 |
| subminimalist Join Date: Jul 2008 Location: NYC
Posts: 3,946
| Sorry, Snafusist, but this is wrong; a command prefaced by a colon is an "ex"tended command that appears at the bottom allowing you to add extensions. ":v" is a real ex command not to be confused with just pushing "v" while in ex mode, which I think is what you meant. "v" enters VISUAL mode where you can select text (personally, I prefer yy & yw). I won't try and describe ":v" since I never use it except to say that is a variant of ":g", which is incredibly useful. Let's say you have a block of text containing some printf lines that all have some character or sequence in them (eg, "+") that you want to replace all instances of (with "->"), but you don't want to replace "+" globally. You could go line to line and just repeat the command :s/+/->/ which since you won't have to type that more than once, is pretty easy. Now say there are twenty of them, on every other line (and the line in between has a + you want to leave). That's ":g" :11,46g/printf/s/+/->/ "11,46" limits the command to lines 11-46 (otherwise global). "printf" -- only lines containing printf. The next part (beginning with "s") can be any other command (except, unfortunately, another g, but you can make up for that with a little regexp know-how in your pattern) -- in this case the substitution. :v is a slightly useless seeming variation you'll have to look up yourself ![]() This is why I like using the actual "Insert" key to enter "insert" mode: because if you press Insert in insert mode, you can switch in and out of "replace" (just like most other places in the universe).
__________________ Accuracy and integrity mean nothing if you don't make it past the censors...PYTHAGORAS |
| MK27 is offline | |
| | #19 |
| Registered User Join Date: Aug 2003
Posts: 774
| To get code completion to work with vim: http://blogs.gnome.org/lharris/2008/...on-with-vim-7/ When you are done with that i suggest you run :h omnicppcomplete in vim and check through chapter 4 to see what options you can change. For instance to have prototypes show up in the dropdown list you add this line to your .vimrc file: let OmniCpp_ShowPrototypeInAbbr=1 To get rid of the preview window add this to .vimrc set completeopt=menuone,menu,longest If you dont have any colorscheme by default i suggest you add this to .vimrc colorscheme default This however has some uglyass colors for the dropdown (magenta and a completely white line) so i added these lines to the default.vim file in /usr/share/vim/vim71/colors/ let colors_name = "default" hi Pmenu ctermbg=3 ctermfg=0 hi PmenuSel ctermbg=3 ctermfg=1 hi PmenuSbar ctermbg=7 hi PmenuThumb ctermbg=0 cterm=NONE Ive included a screenshot of my vim with these settings. To see a list of colors you can use go here: Vim documentation: syntax And scroll down to cterm-colors section. |
| Shakti is offline | |
| | #20 |
| Jaxom's & Imriel's Dad Join Date: Aug 2006 Location: Alabama
Posts: 801
| Maybe you folks already know this, but maybe you don't. One of the coolest things I found lately is CTRL-SHIFT-v for block select. Comes in really handy from time to time. NOTE: this is NOT the same thing as v or V as those are character and line select. |
| Kennedy is offline | |
| | #21 |
| Registered User Join Date: Sep 2004 Location: California
Posts: 2,845
| Hmm, I've never heard of that, and it didn't work in my version of VIM. I usually use v-% to select a block.
__________________ bit∙hub [bit-huhb] n. A source and destination for information. |
| bithub is offline | |
| | #22 | ||
| Jaxom's & Imriel's Dad Join Date: Aug 2006 Location: Alabama
Posts: 801
| Quote:
Quote:
EDIT: What I've been using it to do is to block copy my enums to put into switch case statements. I can dup case : then paste it in between the case and :. Last edited by Kennedy; 08-06-2009 at 03:53 PM. | ||
| Kennedy is offline | |
| | #23 |
| Registered User Join Date: Sep 2004 Location: California
Posts: 2,845
| I was in command mode, so that's not it. I'm using VIM 7.0, so I guess it may be a version issue. I also have set up quite a few custom commands in my vimrc, so one of those may be conflicting with (and messing up) the ctrl-shift-v. At any rate, I think v-% does the same thing (unless I misunderstand what you mean by block select), so I'm not missing out on anything.
__________________ bit∙hub [bit-huhb] n. A source and destination for information. |
| bithub is offline | |
| | #24 |
| Jaxom's & Imriel's Dad Join Date: Aug 2006 Location: Alabama
Posts: 801
| What is v-%???? When I do that all that happens is that it smart selects a block of code. What I'm talking about is something like this: Code: 1234567 1234567 1234567 1234567 |
| Kennedy is offline | |
| | #25 |
| subminimalist Join Date: Jul 2008 Location: NYC
Posts: 3,946
| They are different: v-% is VISUAL ctrl-v is VISUAL BLOCK Here's my new found vim feature. I'm always using either remote from file browser to load (see first post in this thread) or :e. The problem with :e is there is only macro, #, which is the last file edited. I'd really prefer a list of all the files I have been editing this session. So it turns out :b will do that; regardless of how the file was loaded, if you now type the first few characters of it's short name, you can get a tab completion of the full path and return loads the file same as :e. Another new found thing: :set wildmenu This will give you a horizontal bar of possibilities when using tab completion with any command (or no command, eg, :br tab will give you a bar of possibilities beginning with br). Without wildmenu on, tab completion starts with the first cantidate... And another: you can add your own commands to abbreviate others with options, etc, using :command. So here's a nice one for the .vimrc: command SpellOn setlocal spell spelllang=en_us command SpellOff setlocal nospell As usual there is more advanced syntax for including parameters, etc. So now, with wildmenu on, you just type :Sp, hit tab, and you will get a choice between SpellOn and SpellOff.
__________________ Accuracy and integrity mean nothing if you don't make it past the censors...PYTHAGORAS Last edited by MK27; 08-16-2009 at 12:09 PM. |
| MK27 is offline | |
| | #26 |
| Registered User Join Date: Nov 2005
Posts: 146
| Well, my most used vim things. 1. run ctags -R in root of your source folders. 2. edit vimrc so vim can find the tags file ( set tags=./tags;../../../../ ) Now, when you want to find the implementation of some function, definition, enum, ..., ... just save file, move cursor on name, and press ctrl+altgr+] Then ctrl+t will bring you back. Autocompletion with ctrl+n What I also do, :new <filename> to split the window and open new file to splitted part. ctrl+ww will change active window. Running shell commands :!command Running shell commands and reading output to file (I use this to correct compile bugs by splitting window when source file is open, and runnin make in empty window.) :r!command |
| Maz is offline | |
| | #27 | |
| Registered User Join Date: Jul 2007
Posts: 44
| Quote:
Or, that's the case in nvi which I use (current version of original vi, read about lawsuits if you want to hear more). I believe the situation is the same in vim and other clones. EDIT: Yay, emacs lost pitifully in linuxquestions poll. 8) | |
| fronty is offline | |
| | #28 | |
| subminimalist Join Date: Jul 2008 Location: NYC
Posts: 3,946
| Quote:
* you could also just look at "help v" and "help :v" for the difference.
__________________ Accuracy and integrity mean nothing if you don't make it past the censors...PYTHAGORAS Last edited by MK27; 08-31-2009 at 11:46 AM. | |
| MK27 is offline | |
| | #29 | |
| and the Hat of Guessing Join Date: Nov 2007
Posts: 8,740
| Quote:
| |
| tabstop is offline | |
| | #30 |
| Registered User Join Date: Jul 2007
Posts: 44
| You are free to try v in ex and :v in vi. I think you will notice that commands that begin with : in vi are same as ex commands. :/ ex commands are commands of line editor ex. ex's prompt is colon, hence vi's command line commands begin with colon (with some exceptions). If you enter a command that begins with colon in visual mode, you are really executing ex's command with same name and syntax and meaning. In fact ex and vi are the same program, it just has two user interfaces, line editor interface and screen editor interface. Visual mode has some commands that aren't present in line editor mode and they share some commands. EDIT: And by visual mode I mean screen editor mode, the mode you can enter with ex command vi. |
| fronty is offline | |
![]() |
| Tags |
| "vi", vim |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| pthreads, I created the thread, passed a function, function never runs. | mr_coffee | Linux Programming | 2 | 02-26-2009 11:48 PM |
| Terminating secondary thread from another thread | wssoh85 | C++ Programming | 13 | 12-19-2008 05:14 AM |
| CreateThread ?! | Devil Panther | Windows Programming | 13 | 11-15-2005 10:55 AM |
| pointer to main thread from worker thread? | draegon | C++ Programming | 2 | 10-27-2005 06:35 AM |
| Critical Sections, destroying | Hunter2 | Windows Programming | 4 | 09-02-2003 10:36 PM |