|
|
Hi there – a question for you! Answer it in the comments.
I have lots of stuff I could potentially share and that I run into all the time. I’ve been holding off on blogging too much here because I’m not sure if it would fit the page.
I see on other developer’s sites though that they often just combine it all up – portfolio, musings blog, and the works. But I don’t want the site to get too busy either.
Given that the problem of it being too busy is currently non-existent, I might just go this way, because I’m sure a lot of you developer-types reading this have the same questions I do, and when I find out stuff, it would be great to share.
Let me know what you think though, if you want. I’ll weigh in any comments I get.
Thanks,
Kevin
Hey all,
Just to let you know that, as I’m sure you must wonder upon seeing this site, a new theme is indeed coming. In fact, it’s already been designed and is currently being implemented.
So stay tuned…it’ll be quite nice to look at.
Kevin
This is a quick post with some shortcuts I just implemented in my vimrc file that I just felt compelled to share with the world.
It answers the question, “Are you tired of hitting Ctrl-W to move around windows?” Then do I have the solution for you!
Pop these guys into your vimrc file:
nnoremap <S-C-h> <C-W>h
nnoremap <S-C-j> <C-W>j
nnoremap <S-C-k> <C-W>k
nnoremap <S-C-l> <C-W>l
Save it and reload your files (or source it into one). Voilà! Now you can enjoy single-press window moving by holding down shift and control and using the movement keys (hjkl). You’ll need more maps if you want to use the arrow keys, but in the time it takes you to get to those, you may as well just press Ctrl + W and a movement key!
Speaking of sticking to the home row as much as possible, don’t forget that you can use Ctrl + [ instead of Esc to return to normal mode.
Enjoy!
Kevin
So today I had the chance to learn about vimdiff, VIM’s mode for file comparison and merging. It was a lot better than I expected!
When I switched to using Ubuntu for my day-to-day local testing (because I need reliable Xdebug, and Windows Vista’s Apache-PHP module just wasn’t cutting it as far as Xdebug stability goes), I was worried I wouldn’t have a good merging tool to go along with it. VIM’s been working great as an IDE (just when I was about to go back to my slower XP image, too!), but I was wondering about this vimdiff thing I’d heard about. I figured today that, since a couple conflicts came up in my Bazaar merge, I’d give vimdiff a whirl.
I ran it like this:
vimdiff file1 file2
and VIM appeared, nicely split into two panes and with all the changes highlighted – just like WinMerge! This was cool so far.
Then I had to figure out how to actually, you know, merge the changes. So I typed :help vimdiff and got the help file.
I scrolled through, and picked up the only 3-4 commands I will probably ever need. And here they are for you. Note that these assume you’re just diffing two files…which is all I’ve ever done, so you probably are…and if not, you’re probably smarter than me anyway. And they’re all used in VIM’s normal mode (the one it starts in, unless you’re a Creamer) unless otherwise mentioned.
VIMDIFF COMMAND #1 – JUMP TO NEXT CHANGE
]c – Jump to the next difference. Equivalent to alt + down in WinMerge.
VIMDIFF COMMAND #2 – JUMP TO PREVIOUS CHANGE
[c – Jump to the previous difference. Equivalent to alt + up in WinMerge.
VIMDIFF COMMAND #3 – MERGE LEFT
do – Copy the current difference’s text from the file on the right to the file on the left. Equivalent to alt + left in WinMerge. (The VIM help said it’s do and not dg because dg is too close to dgg – a smart move on their part, as I enjoy not deleting to the beginning of my buffer. But if you ever wanna do that, hey, now you know how.)
VIMDIFF COMMAND #4 – MERGE RIGHT
dp – Copy the current difference’s text from the file on the left to the file on the right. Equivalent to alt + right in WinMerge.
BONUS VIMDIFF COMMAND – UPDATE THE DIFF DISPLAY
Occasionally, as you’re happily merging away, your vimdiff display may get out of whack for some reason. VIM does a pretty good job of preventing it (hasn’t happened to me yet), but if you want to make sure you’re all good, just type :diffupdate. Then continue merging. (If you’ve been reading the WinMerge shortcut mapping, this one’s equivalent to good ol’ F5.)
Bazaar’s bizarre merge markers finally kinda made sense after merging with vimdiff!
Thanks VIM people. Maybe I will be donating to Uganda soon
I hope this article was useful. If you’ve got any extra tips, post them in the comments!
And hey, if you’re merging on Windows, WinMerge stands as an awesome tool: http://winmerge.org.
Talk to you soon, and happy merging.
Learning more Vim paid off the other day. I edited a couple files on a remote server using my T-Mobile G1 along with the ConnectBot program. The process was, of course, pretty simple.
- Start ConnectBot on the G1.
- Connect to the server.
- cd to the directory containing the file I wanted to edit.
- Type vim <name of file>
- Edit as usual (remembering that ESC is two trackball presses…that one got me at first)
- Save file
- Check results on Browser, if desired
- Rejoice
Pretty easy! Using an editor with windows, tabs, and syntax coloring on a phone gives you a warm, fuzzy feeling.
Happy Vimming,
Kevin
Yesterday, I hit a crossroads in the life of a Web developer. You see, I’ve been doing my testing on an Ubuntu VM lately. It’s been great because Apache runs PHP faster than it did on my XP VM. (If you ever need a break, fire up XP and load the Drupal modules page on a decently-sized site. You’ll have plenty of break time.)
But I had a dilemma; the IDEs just weren’t as good for PHP as my favorite Windows one (phpDesigner). I wanted to think they were. They had features that indicated that they should have been. But, in terms of actual productivity, they just weren’t – either they were too big, or they lacked good code completion at the right time. I was seriously considering sucking it up and heading back on over to Windows. After all, I figured, at least my databases are still on Linux, right? Maybe it’ll be faster. However, I had to pull my local Bazaar branches off of the Linux VM in preparation for the push to Windows, since there were still some changes (I think) that I might not have wanted to commit to the shared repositories yet. While I was waiting, I figured I’d make a last-ditch effort to find a suitable IDE/editor my projects. After all, my needs in the end weren’t great – give me a couple nice features like code completion, syntax highlighting, and I’m fine.
So I thought I would try to finally learn VIM. I thought it was just a dinky little editor that wouldn’t be practical to use as my development environment for PHP.
I think I might have made a little miscalculation there. I don’t know where I was, but nobody ever told me VIM had so many great plugins or was so flexible! I can set it up practically however I like. It’s FAST. I can avoid using the mouse. I can get my syntax highlighting, code completion, and so on (a link to VIM for PHP programmers is obligatory here). More than I thought, in fact. And then…I can take it with me. Haven’t tried it yet, but VIM is cross-platform, so, in theory, I should be able to take the contents of my .vim directory with me. And I’m a big fan of DRY (something I do EVERY time I install an IDE for the first time on a computer/VM…).
Right now I’m just alternating between vim and gvim. I might wind up trying Pida or another similar IDE that embeds VIM as its editor.
I really ought to learn how to manipulate windows in VIM properly, though. One day!
I wonder if it’s the destiny of all programmers to eventually use VIM or Emacs? They do call them programmer’s editors…
That’s all for now,
Kevin
Hi there,
I know I’ve been kind of quiet; been busy working a lot with osCommerce. It really makes me want to learn Magento, which at least looks a lot nicer and easier to customize.
So I’m going to do up a “coder’s comparison” for them in the near future, once I learn enough Magento.
Look forward to it!
Kevin
Just thought to mention that you can now view the many exciting pages of wizonesolutions.com (cough) on your iPhone, iPod Touch, Android device (I’ve got a G1 myself), or Blackberry Touch!
Thanks to the makers of the WPtouch plugin for enabling this possibility. The plugin’s home page is: http://bravenewcode.com/wptouch
Hi again,
Today I snuck up a link to a portfolio page. Said portfolio will be getting filled in soon. I just wanted to make sure you realize you can just contact me for the moment if you want to know what work I’ve done. Rest assured that I’ve done this stuff before…a lot
Hope everyone had a great Labor Day weekend.
Update: I’ve finally reached a mutually beneficial agreement with my contact form. It works now.
I just noticed the contact form has become a captcha nazi. Contact forms don’t like me, for some reason. But not to fear – I’m on the case and it’ll be fixed shortly. Watch for one of those fancy Update: messages on this blog post!
|
|