Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
astr0man
Feb 21, 2007

hollyeo deuroga

MononcQc posted:

I'm using the light version of solarized: http://ethanschoonover.com/solarized

Thanks for this! Started using it today and it's awesome. Took me forever to get it to play nicely with tmux though :argh:

I'll try to get the OP up to date with everyone else's stuff soon

Adbot
ADBOT LOVES YOU

Maluco Marinero
Jan 18, 2001

Damn that's a
fine elephant.

LaTex Fetish posted:

In case you guys didn't realize, or forgot, 7.3 has relative line numbering.

It's really useful for moving around with the movement keys and in visual mode. You don't have to count lines anymore, or move to the closest curly bracket to jump down.

Also, using 82gg or 98G to fix errors at a line still works. The relative line numbers are purely visual. Here's a snippet from my .vimrc about relative line numbers.

code:
set relativenumber

" Always show line numbers, but only in current window.
:au WinEnter * :setlocal relativenumber
:au WinLeave * :setlocal norelativenumber

" Absolute Line Numbers in Insert Mode
:au InsertEnter * :set number
:au InsertLeave * :set relativenumber

gently caress yeah, that's cool and that's going straight in the .vimrc

Dicky B
Mar 23, 2004

I mentioned YouCompleteMe earlier in the thread as an alternative to clang-complete. I set up a new development machine today and decided to give it a whirl and it's really nice. It provides auto-completion for basically any language and optional semantic completion for various languages provided you have the appropriate tools installed. It also integrates with Syntastic which automatically highlights errors and warnings.

Syntastic itself actually seems to work better than Visual Studio's C/C++ intellisense engine in most cases, though it doesn't seem to play nice if you're doing weird things with the C preprocessor.

DreadCthulhu
Sep 17, 2008

What the fuck is up, Denny's?!

LaTex Fetish posted:

In case you guys didn't realize, or forgot, 7.3 has relative line numbering.

It's really useful for moving around with the movement keys and in visual mode. You don't have to count lines anymore, or move to the closest curly bracket to jump down.

Also, using 82gg or 98G to fix errors at a line still works. The relative line numbers are purely visual. Here's a snippet from my .vimrc about relative line numbers.

code:
set relativenumber

" Always show line numbers, but only in current window.
:au WinEnter * :setlocal relativenumber
:au WinLeave * :setlocal norelativenumber

" Absolute Line Numbers in Insert Mode
:au InsertEnter * :set number
:au InsertLeave * :set relativenumber

Argh fine, I'll finally give this a longer try. I was aware of this, but was too lazy to get used to it. Thanks for nudging again.

EDIT: actually, this doesn't seem to work if I open a file with gvim and then open another file with ctrl-p. I have to create a new split for that to kick in. Does WinEnter not trigger with ctrl-p? Actually it might be just me with a plugin conflict somewhere overriding relativenumber.

I managed to force it to work as intended with au BufNewFile, BufRead * setl , but I feel like this is the nuclear option that I shouldn't be exercising.

DreadCthulhu fucked around with this message at 01:03 on Jun 18, 2013

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
You should use BufEnter if you want to do something when you enter a different buffer. WinEnter, as the name implies, only fires when you switch windows.

DreadCthulhu
Sep 17, 2008

What the fuck is up, Denny's?!

Jabor posted:

You should use BufEnter if you want to do something when you enter a different buffer. WinEnter, as the name implies, only fires when you switch windows.

That's good, sounds simpler. Thanks!

LaTex Fetish
Oct 11, 2010

Ah, I rarely ever hide my buffers, or show only one at a time.

So, WinEnter/Leave always worked for me. I don't use the gui version, though, so I'm sure that's a part of it all.

Tetramin
Apr 1, 2006

I'ma buck you up.
Solarized owns.

Also I just started using Vundle when I set up vim on windows recently, instead of pathogen. Way better, imo. At least removing plugins is alot less of a headache than it can be with pathogen. Also, SuperTab is pretty nice.

Best hotkey: * to jump to the next occurrence of the highlighted word.


e: Also really a big fan of nerdcommenter and once you get used to the kind of weird way vim-surround works, it's pretty fantastic, especially if you have to do some HTML or something.

Tetramin fucked around with this message at 12:03 on Jun 19, 2013

MononcQc
May 29, 2007

Funnehman posted:

Best hotkey: * to jump to the next occurrence of the highlighted word.


# should be the same but looking backwards instead of forward.

CRIP EATIN BREAD
Jun 24, 2002

Hey stop worrying bout my acting bitch, and worry about your WACK ass music. In the mean time... Eat a hot bowl of Dicks! Ice T



Soiled Meat

Dicky B posted:

I mentioned YouCompleteMe earlier in the thread as an alternative to clang-complete. I set up a new development machine today and decided to give it a whirl and it's really nice. It provides auto-completion for basically any language and optional semantic completion for various languages provided you have the appropriate tools installed. It also integrates with Syntastic which automatically highlights errors and warnings.

Syntastic itself actually seems to work better than Visual Studio's C/C++ intellisense engine in most cases, though it doesn't seem to play nice if you're doing weird things with the C preprocessor.

I've been using it for awhile, it's extremely fast. As far as weird C preprocessor things, it will parse a specially formatted file that will set all your compiler switches correctly on a file, which can be auto-generated with a CMake directive. I absolutely love it.

DreadCthulhu
Sep 17, 2008

What the fuck is up, Denny's?!

Funnehman posted:

e: Also really a big fan of nerdcommenter and once you get used to the kind of weird way vim-surround works, it's pretty fantastic, especially if you have to do some HTML or something.

Any idea how that compares to our Messiah tpope's vim-commentary? I've been using it very successfully for years, but would love to find out if there's something out there that's 10x better.

Unrelated note: is there a popular plugin out there for tidying a buffer in vim? For example, sometime I'll paste some optimized CSS into a buffer and will want to make it readable. Is there a simple and properly working tool for this in vim?

DreadCthulhu fucked around with this message at 20:13 on Jun 24, 2013

Deus Rex
Mar 5, 2005

tcomment.vim is my commenting plugin of choice. I used NERDCommenter for about a year before its lack of support for vim motions really got to me

The Laplace Demon
Jul 23, 2009

"Oh dear! Oh dear! Heisenberg is a douche!"

DreadCthulhu posted:

is there a popular plugin out there for tidying a buffer in vim? For example, sometime I'll paste some optimized CSS into a buffer and will want to make it readable. Is there a simple and properly working tool for this in vim?

As far as "unoptimizing" CSS, check out the five sed commands at the bottom of http://mabblog.com/source/shell/unCompress.bash. They do a pretty good job of it, and are a good springboard if you want to implement the functionality in vim.

astr0man
Feb 21, 2007

hollyeo deuroga

DreadCthulhu posted:

Any idea how that compares to our Messiah tpope's vim-commentary? I've been using it very successfully for years, but would love to find out if there's something out there that's 10x better.

If it's good enough for tpope it should be good enough for you :colbert:

Deus Rex
Mar 5, 2005

The Laplace Demon posted:

As far as "unoptimizing" CSS, check out the five sed commands at the bottom of http://mabblog.com/source/shell/unCompress.bash. They do a pretty good job of it, and are a good springboard if you want to implement the functionality in vim.

if you have it installed already, you could also use the scss command line tool. on the whole buffer:

code:
:%!{scss -t expanded}
on a selection (the '<,'> will be autoinserted if you type : with a selection):

code:
:'<,'>!{scss -t expanded}

Tiger.Bomb
Jan 22, 2012
Since I use tmux and often have 6+ panes I don't like line numbers cluttering the pane. For that reason I make them easy to toggle:

" Toggle showing line numbers with \l
:nmap \l :setlocal number!<CR>

Also: I installed and powerline using pathogen. How do I get powerline to show?

NERDTree works, but how do I make a new (shorter) ex command to open it? it's effectively just another window, right?

Dicky B
Mar 23, 2004

I often use g, to jump back to the last edit point, but this doesn't work across buffers. Does anyone know if there is a way to make it work across buffers?

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Dicky B posted:

I often use g, to jump back to the last edit point, but this doesn't work across buffers. Does anyone know if there is a way to make it work across buffers?

I always use `. to jump back to last edit point, and that seems to work in every buffer I have open.

Dicky B
Mar 23, 2004

That does exactly the same as g, for me, and is still buffer-local :/

This seems to be the case with a completely bare .vimrc. Do you have anything in your config which changes this behaviour?

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Dicky B posted:

That does exactly the same as g, for me, and is still buffer-local :/

This seems to be the case with a completely bare .vimrc. Do you have anything in your config which changes this behaviour?

Maybe I don't understand what you want to have happen then. Do you mean "jump to where I last edited in a buffer that I switched to" ( which is what I thought you meant) or "I edited buffer X, I switched over to buffers A,B, and C to look at stuff, and now I want a command to jump back to whatever buffer I last changed, at the point I changed it".

Dicky B
Mar 23, 2004

The latter. There doesn't seem to be any way to just switch to the last edited buffer either. I assume it's possible to implement this through vimscript though.

sm00th
Jan 5, 2013

Dicky B posted:

The latter. There doesn't seem to be any way to just switch to the last edited buffer either. I assume it's possible to implement this through vimscript though.

Ctrl+o jumps back, including across buffers

Dicky B
Mar 23, 2004

sm00th posted:

Ctrl+o jumps back, including across buffers
For my purposes this works fine. Thanks! :)

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Dicky B posted:

For my purposes this works fine. Thanks! :)

There is also BufSurf: http://github.com/ton/vim-bufsurf which allows you to go back through edit history.

There are also lots of other ways to cycle through buffers, many of which I did not know until you asked your question and I read this page: http://vim.wikia.com/wiki/Easier_buffer_switching

vim wiki posted:

Often the buffer that you want to edit is the buffer that you have just left. Vim provides a couple of convenient commands to switch back to the previous buffer. These are <C-^> (or <C-6>) and :b#.

Dicky B
Mar 23, 2004

BufSurf is based on viewing history, not edit history.

If there's a way to switch to the last modified buffer then it would be trivial to set up a mapping to do what I want but this doesn't appear to be a core feature. Fortunately Ctrl-o is good enough for my particular needs.

DreadCthulhu
Sep 17, 2008

What the fuck is up, Denny's?!
Just stumbled upon the native option to turn on column and line highlighting. It's super obnoxious, I'm finally in full Christmas tree mode.

Civil Twilight
Apr 2, 2011

DreadCthulhu posted:

Just stumbled upon the native option to turn on column and line highlighting. It's super obnoxious, I'm finally in full Christmas tree mode.

I've mapped <leader>r to toggling rainbow parens, because while it is certainly useful, god drat it's garish.

Tiger.Bomb
Jan 22, 2012

DreadCthulhu posted:

Just stumbled upon the native option to turn on column and line highlighting. It's super obnoxious, I'm finally in full Christmas tree mode.

Whoa. I want cursor line highlighting, but it doesn't work with solarized. How do I set it? Searching around I guess i need to set cursorline as well as g:solarized_hitrail. It uses some regexto only highlight after the cursor, though. Regardless, I see nothing when both are set. What gives?

EDIT: Actually nevermind. It does work, but instead of setting the background, it changes the colour of some of the syntax, so in a normal text file it's useless.

Tiger.Bomb fucked around with this message at 18:39 on Jul 19, 2013

DreadCthulhu
Sep 17, 2008

What the fuck is up, Denny's?!
Anybody here got experience with writing syntax highlighting rules in vim? Do you know if when you use the "region" rule, whatever is matched by start= can no longer be highlighted by the rest of the rules, especially if you use hs=e? I'm probably brainfarting super hard here, but say I have:

code:
(defn hello-world
  "Description of
   this function"
  (println "hello world"))
And I'd like the description to be marked as of type myComment. Here are a couple of options I tried:

code:
syntax match myComment"(defn\s\+\S\+\_s\+\zs\"\_.\{-}\""
syntax region myComment start=/(defn\s\+\S\+\_s\+"/hs=e,rs=e,ms=e end=/"$/
syntax region myComment start=/(defn\s\+\S\+\_s\+\zs"/ end=/"$/
The first regex works fine when doing a search in vim (set hlsearch proves the match is correct throughout the file), but does jack poo poo for highlighting.
The second and third regex do the highlighting successfully, BUT then defn loses its original special keyword syntax highlighting which was there before, thus not really doing its job. Is there a way to make both happen or am I stuck?

xtal
Jan 9, 2011

by Fluffdaddy
Is there a way to make UltiSnips and YouCompleteMe share a Tab binding, such that it will expand or proceed through a snippet if applicable and through completions otherwise? It seems like binding UltiSnips expand key to <Tab> prevents it from passing through to YCM.

SavageMessiah
Jan 28, 2009

Emotionally drained and spookified

Toilet Rascal
YCM has ultisnips integration, read the docs.

xtal
Jan 9, 2011

by Fluffdaddy

SavageMessiah posted:

YCM has ultisnips integration, read the docs.

The only integration YCM provides is autocompleting the snippet's shortcut. You still need to press a key to expand it, and the author's suggestion is remapping UltiSnips to something that doesn't conflict in order to do so. I'd like them both to share a context-sensitive key, which I think should be possible with a function in VimScript.

SavageMessiah
Jan 28, 2009

Emotionally drained and spookified

Toilet Rascal

xtal posted:

The only integration YCM provides is autocompleting the snippet's shortcut. You still need to press a key to expand it, and the author's suggestion is remapping UltiSnips to something that doesn't conflict in order to do so. I'd like them both to share a context-sensitive key, which I think should be possible with a function in VimScript.

Gotcha. I was just messing with YCM a few days ago, I guess it is I who should read the docs. I ended up not using it because it doesn't play nicely with clojure.

xtal
Jan 9, 2011

by Fluffdaddy

SavageMessiah posted:

Gotcha. I was just messing with YCM a few days ago, I guess it is I who should read the docs. I ended up not using it because it doesn't play nicely with clojure.

Yeah, luckily neocomplete is very nice and just as performant, with functioning integration with neosnippet. I like YCM's Jedi integration, though, so I'm still looking for a solution!

xtal fucked around with this message at 04:48 on Aug 5, 2013

O Tempora! O Mores!
Dec 24, 2008
I'm running gVim on XP, but the memory utilization is through the roof, and it has a tendency to freeze/crash even where heavier editors like Sublime and Eclipse don't have similar issues. There's also something weird going on with fonts, wherein they appear blurry, distorted, and in general, poorly rendered, even when other programs render this font well. Two questions:

1. Has anyone experienced these issues? Is there a known fix?

2. Is running Vim in cmd.exe a viable solution? I know it can be done, but is it a hassle?

I'd post my _vimrc but I'm not at work right now, and my home installation is very different and exhibits none of the same symptoms.

Tiger.Bomb
Jan 22, 2012

O Tempora! O Mores! posted:

I'm running gVim on XP, but the memory utilization is through the roof, and it has a tendency to freeze/crash even where heavier editors like Sublime and Eclipse don't have similar issues. There's also something weird going on with fonts, wherein they appear blurry, distorted, and in general, poorly rendered, even when other programs render this font well. Two questions:

1. Has anyone experienced these issues? Is there a known fix?

2. Is running Vim in cmd.exe a viable solution? I know it can be done, but is it a hassle?

I'd post my _vimrc but I'm not at work right now, and my home installation is very different and exhibits none of the same symptoms.

vim in cmd isn't particularly bad. The only real bummer is how you have to go through the menus to resize the cmd window itself.

Try renaming your _vimrc (to revert to default rules) first to see if this changes any of the behaviour.

xtal
Jan 9, 2011

by Fluffdaddy
For posterity, I fixed YCM/UltiSnips by installing SuperTab (which itself has UltiSnips integration) and setting it to trigger <C-Tab>, which I've remapped YCM to. Essentially, pressing tab either activates UltiSnips or passes the event to SuperTab, which emulates YCM's mapping. Works like a charm.

ArcticZombie
Sep 15, 2010
Can anyone explain this command to me? I know what the result is but I don't know what it's actually doing because all I did was modify a different thing. It finds all instances of <p> and gives them an id attribute with sequential numbers.

code:
let n=1 | g/<p>/s/<p>/\='<p id="'.n.'">'/ | let n=n+1
Here's what I can work out:

let n=1 -- Simple enough, it's defining a variable.

g/<p>/ -- From what I can tell, this searches for the pattern and collates all lines that match into a new buffer of sorts which is kind of like a more/less thing?

s/<p>/ -- Search for this pattern.

\='<p id="'.n.'">'/ -- I get that this is the replacement part of the s command and I can see the different parts of it but it starts with an escaped equals sign, has quotes surrounding it and the variable part and some periods around the variable too?

let n=n+1 -- Increasing the variable by 1. If this command is being run over and over I don't see why this part is repeated to increase the variable but let n=1 isn't repeated. If it's all repeated then n would be set to 1 at the start, the replacement would be carried out with n as 1, it would be set to n+1 (2) but then set back to 1 again? This clearly isn't the case.

jony neuemonic
Nov 13, 2009

I'm not an expert (hell, I've never even used vimscript for anything) so this is completely just spitballing. But this part:

ArcticZombie posted:

\='<p id="'.n.'">'/ -- I get that this is the replacement part of the s command and I can see the different parts of it but it starts with an escaped equals sign, has quotes surrounding it and the variable part and some periods around the variable too?

Looks like it's doing string concatenation to me ( <p id -", the variable n, and "> joined by the . operator). The escaped equals sign looks like it tells Vim to not literally replace <p> with '<p id="'.n.'">' (Take a look here).

edit: Removed a misunderstanding on my part.

jony neuemonic fucked around with this message at 18:06 on Aug 11, 2013

Adbot
ADBOT LOVES YOU

xtal
Jan 9, 2011

by Fluffdaddy
e: I tried to explain that but it was dumb so I'm removing it.

  • Locked thread