[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
Vim thread
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 112
Thread images: 14
File: vim-logo1.png (14 KB, 605x300) Image search: [Google]
vim-logo1.png
14 KB, 605x300
Post your configs, favorite plugins, and other Vim-related things.

I just started using spf13-vim and it's absolutely awesome (if a bit slow). Anyone else use it?
>>
>>47329032
using it now.

the code completion is sometimes a bother when you're scrolling through code. otherwise, i like it. i don't even care if it makes me a pleb. at least i'm using vim.
>>
>>47329060
Do you notice any lag when using it? Things like NERDTree take a second to load (whereas when I loaded it by itself that didn't happen).
>>
>>47329076
nah it runs pretty smooth for me.
>>
File: vim.png (106 KB, 1368x976) Image search: [Google]
vim.png
106 KB, 1368x976
pretty much a noob, so no plugins. I'm pretty fluent with the basics though so far.

the "#solarized block is a target for a script that edits the config when I want default color scheme

haven't experimented with any plugins yet
>>
>>47329032
there's already an editor thread

>>47305122
>>
>>47329205
The first plugins I recommend getting are NERDTree and CtrlP, makes searching through your projects an absolute harmony.
>>
>>47329252
thanks, heard of nerdtree but not ctrlP, I'll try it out
>>
>>47329032
http://a.pomf.se/zrofoj.png

Needs better syntax highlighting for C but other than that I'm quite satisfied.
(pic related, muh vim)
>>
>>47329411
excuse my stupidity
http://a.pomf.se/zsmhud.txt
>>
>>47329411
Is that just the standard jelly bean colorscheme, or did you make some modifications?
>>
spf13-vim is a awful idea. Install plugins piecemeal when you need them and no earlier. Same with any .vimrc changes, you should understand why before you just throw a bunch of shit together.

Most of the plugins listed have better alternatives. If you want a jumping off point you could use this https://github.com/tpope/vim-sensible

However I still think that glosses over the fact that you should understand the parts you are adding. Also you should have your own reasons for adding things. Other than that keep calm and vim on.
>>
>>47329487
It's just the default.
>>
>>47329511
Nice. Also which font are you using?
>>
>>47329493
As a follow up to my previous comment, you may want to pick and choose pieces of spf13-vim after you've got the hang of vanilla vim. But I would read and understand the changes before copypasta.
>>
>>47329411
>Needs better syntax highlighting for C
https://github.com/jeaye/color_coded
>>
>>47329060
That is because spf13 comes with neocompletecache which is slow. Rather than something real like actual neocomplete.
>>
>>47329517
Terminus size 8, I usually prefer profont but it's not in the repos for my OS and I haven't bothered with getting it installed this time around.

>>47329522
Thanks!
>>
File: vim.png (77 KB, 1280x800) Image search: [Google]
vim.png
77 KB, 1280x800
Really happy with my current setup, honestly.
>>
>>47329640
What terminal emulator are you using? You should get rid of the bold/italic.
>>
>>47329650
I'm using URxvt.

I'm not terribly bothered by the bold/italic, actually. I can understand how some wouldn't like it that much but it works for me.
>>
YouCompleteMe is the best thing since sliced bread
>>
>>47329690
ah, with fonts like that what bothers me is readability/it just looks like the quality is "poorer" I guess so I always disable it.
>>
I've had some ideas to improve my Vim but have no idea how to do it.

I want to use the Alt key to switch to normal-mode instead of Escape (since it's able to be pressed by your thumb incredibly easy).

I also was to map ; to :, and : to ; (effectively reversing the default), that way shift has to be used much less often.

I then want Alt + {h,j,k,l} to be used to navigate Vim's open windows, but if you cannot do that with setting Alt to Escape then Ctrl would work too.

And then of course all of this would be added on top of easy keybindings for CtrlP, NERDTree, fugitive, Syntastic, surround.vim, NERD commenter, and EasyMotion.

I would also change some of tmux's keybindings (to change windows by using Alt + {h,j,k,l}, just like Vim by using https://github.com/christoomey/vim-tmux-navigator).

How would I go about doing this? I know it probably involves a lot of :map hackery but I simply don't understand how to do it.
>>
all i have is

set number
set modeline
set modelines=5


default vim does me fine otherwise
>>
>>47329702
I'm actually working on installing it now (it's huge for my painfully slow internet). Does it slow down Vim too much?
>>
>>47329896
Switching Esc and CapsLock is very common, I don't know if Vim uses Alt. I switched mine with:

setxkbmap -rules evdev -model evdev -layout us -variant altgr-intl -option caps:escape


I think a friend of mine did the one with :, so it is possible also.
>>
Solarized is still the best even after 2 years of using it. I wonder how long it will take for me to get bored of it.
>>
File: j-key1.gif (3 KB, 108x102) Image search: [Google]
j-key1.gif
3 KB, 108x102
best
ino jj <Esc>
>>
Anybody know how to map just the alt key to the escape key?

I've been trying "imap <M-> <Esc>" but it's not working.
>>
>>47330653
You can't map modifier keys alone

You'd have to do that somehow on OS level
>>
File: vim.png (83 KB, 1084x741) Image search: [Google]
vim.png
83 KB, 1084x741
>>47329032
>Post your configs, favorite plugins, and other Vim-related things.
Everything's there: https://github.com/Marneus68/dotfiles
I'm using git submodule to handle the plugins.
>>
>>47330653
its better to remap caps lock to escape with xmodmap
remove Lock = Caps_Lock
keysym Caps_Lock = Escape


since you dont need caps lock, then just put
xmodmap ~/yourconfigfile


into your .xinitrc or whatever you are using to start xserver
>>
File: 20150403_130502_ptp.png (58 KB, 1018x617) Image search: [Google]
20150403_130502_ptp.png
58 KB, 1018x617
http://pastebin.com/raw.php?i=RWVqjN1m
>>
>>47330523
Nice rice. Do you browse Internet from terminal window manager, or am I seeing things?
>>
>>47330523
pls post your setting that does the
{code]
|
|
|
[/code]
for indentation
>>
File: 418756124.jpg (61 KB, 564x304) Image search: [Google]
418756124.jpg
61 KB, 564x304
>>47329032
I'm an absolute beginner.
I'm running >windows 7
My goal is to code Ruby in Vim, I've installed Ruby 2.1.5 and Vim 7.4 but I have no idea how to use Vim(pic related).
Could someone please point me in the right direction?
>>
>>47332129
Do you want to code Ruby plugins for Vim, or do you want to code Ruby projects in Vim? If the first, then
:help ruby
is your friend indeed. If not, then don't bother with it at all. Just write the code, possibly add some plugins that allow autocomplete and syntax highlighting, and run in separate terminal with your Ruby interpreter. Anything beyond that, like using subshells or integrating Ruby interpreter with plugins is not beginner stuff, so I recommend you take the most basic approach first.
>>
>>47332129
first learn basic vim :help
than google for some useful ruby plugins (and use them with something like neobundle, it makes managing plugins really easy
>>
>>47332160
>>47332181
Yes, my goal is to code Ruby and someone in a previous /dpt/ general suggested that I use Vim as my IDE.

I think I'll go with Notepad++ for now. Vim is well beyond my understanding. Thank you for your help!
>>
>>47332129
I don't know how well vim works in cmd.exe, but might want to use gvim, at least in the beginning.
>>
>>47332301
On Windows you might want to try Sublime Text 3, though Np++ should be fine too.
>>
>>47332344
>I don't know how well vim works in cmd.exe
Not well. Not well at all. Gvim is kinda acceptable in Windows tho.
>>
>>47329896
nnoremap ; :
nnoremap : ;

nnoremap <C-h> :wincmd h<CR>
nnoremap <C-j> :wincmd j<CR>
nnoremap <C-k> :wincmd k<CR>
nnoremap <C-l> :wincmd l<CR>


I don't know if mappings to alt key are even supposed to work in (CLI) vim but I couldn't get them to work. You could try to change those "<C-h>" to "<A-h>" etc and try it for yourself.
>>
>>47332129
> I have no idea how to use Vim

http://derekwyatt.org/vim/tutorials/
some of these vids are decent
>>
>>47332097
It's firefox with a solarized theme for 4chan.

>>47332109
Yggdroot/indentline on github.
>>
Is there a nice greyscale theme available?
>>
File: emacs_user.gif (960 KB, 500x272) Image search: [Google]
emacs_user.gif
960 KB, 500x272
Vi(m) is the poorman's Emacs.
>>
>>47335357
Vi(m) vs Emacs is the poor man's troll.
>>
>>47329205
>the "#solarized block is a target for a script that edits the config when I want default color scheme
You are an Emacs user at heart.
>>
>>47335606
>y-y-you troll
You mad that Emacs shits on your favorite editor?
>>
>>47336719
>not using acme
>>
>>47336738
Emacs is Unix's acme.

Emacs even has an acme emulation package.
>>
>>47337375
>using Unix when Plan9 exists

Why haven't you moved to Plan9 yet? It's the new and improved Unix made by the same people.
>>
>>47337440
Because it doesn't run on anything, isn't compatible with anything, and has no software.
>>
>>47337556
>it doesn't run on anything
Are you serious? It runs on tons of hardware.
http://plan9.bell-labs.com/sys/doc/port.html
http://www.plan9.bell-labs.com/wiki/plan9/other_hardware/

>isn't compatible with anything
Plan9 is written to be incredibly comptible and easily portable.

>and has no software
It actually has a lot of software and if there is some niche you're missing then either port it or write and alternative you pleb.
>>
>>47337440
Because UNIX-likes are good enough for me.

Also Plan9's default shell forces you to use the mouse for certain actions.

>kek
>>
>>47337753
Plan9 and it's GUI go hand in hand, it's not like Unix where the GUI is just an extra feature you can have. Also the way they handle the mouse integration is very nice.

>windows vista is good enough for me
>>
>>47337813
Plan9 is a fucking joke, my friend. You can't make a successor to perfection (UNIX).
>>
>>47337813
I can understand the GUI integration, but what if I just don't want to use the mouse?
What if I prefer the keyboard?
>>47337892
>UNIX
>perfection
This is why we can't have nice things.
>>
File: chile1.jpg (36 KB, 661x450) Image search: [Google]
chile1.jpg
36 KB, 661x450
I mostly use vim to edit configs and scripts. It's nice to have a simple setup I can quickly download from my server at any time
>>
>>47337892
That was a really good argument my friend. Though the people who actually wrote Unix would disagree.

>>47337912
It's made for keyboard/mouse, therefore it would be easier to use the mouse. You could just use the Keyboard but you'll likely miss out on cool features that use the mouse.
>>
>>47338004
Why not run Emacs on your server then, so you can jack into it and make even faster config edits remotely?
>>
>>47338017
I know that I would, which is why I don't really like some of that Plan 9 GUI stuff.
Anyway, why would you use Plan 9 when Inferno exists? Are you scared of Limbo?
>>
>>47338017
>You could just use the Keyboard
No, Plan9 is not usable without the mouse.
>>
>>47338076
No it's not.

>>47338066
I'm not as familiar with it, it's on my to-do list.
>>
<--- current setup.

theme is Afterglow
>>
>>47338144
I think Inferno would have a better chance of becoming an OS that people actually use because of Dis, the kernel/virtual machine. If something of the sort picked up that'd be really nice.
>>
>>47338219
https://bitbucket.org/inferno-os/inferno-os/

>Last updated: 3 hours ago

neat
>>
>>47338264
Yep, it's still actively developed. Apparently it moved from Google Code to BitBucket very recently too, last time I've seen it it was still in gc.
>>
" Join next line to current
nnoremap J mzJ`z
" Split Lines at cursor
nnoremap S i<cr><esc>^mwgk:silent! s/\v +$//<cr>:noh<cr>`w
>>
anyone have a good way of swapping two lines?

What I do is " dd k P" but I'm wondering if this is built in... also, how would I go about making this into a key combo? And how do I know if the key combo I pick for it is not mapped to something else?
>>
>>47338401
https://github.com/tpope/vim-unimpaired

One of my favourite Plugins. [e or ]e swaps lines with above / below.
Adds loads of other cool functionality as well.
>>
>>47338439
NICE! Thanks!

I switched the other day to vim plug and it's the best plugin manager I've used so far. You can specify lazy loading so installing more plugs doesn't slow you down.

Highly recommended... better than Vbundle and Pathogen:

https://github.com/junegunn/vim-plug

Rest of this guy's plugins are amazing as well... he's' a vim super-master.
>>
What's the fastest way to close help split window after you're done reading it?
>>
>>47338584
:w
>>
>>47338584
map <leader>c :clo<CR>


I hate how help opens in a spllt though, would much prefer a full tab but cant seem to find an option to toggle it.
>>
>>47329205
What font is that?
>>
>>47338401
>>47338439
while that plugin looks cool, I've just been using
nnoremap <C-S-Down> :m+<CR>
nnoremap <C-S-Up> :m-2<CR>
inoremap <C-S-Down> <Esc>:m+<CR>gi
inoremap <C-S-Up> <Esc>:m-2<CR>gi
>>
>>47338594
thx! I was using :q since it's a read-only file.

>>47338655
nice!

ps: when do I use map vs nnoremap vs nmap vs cmap?
>>
>>47338869
Oh actually I meant :q, sorry
>>
QUESTION... slightly unrelated to vim but maybe someone here has a suggestion..

How do you guys keep your command line tips and other notes organized? I have a file full of various commands and then I just grep through it (have a zsh alias to do that) to find what I jotted down before.

Are there any command line tools to keep notes in a database/text file or something?
>>
>>47338655
here's how to make help open in a new tab or in a new vertical split. this is the cleanest way I could find.

mkdir -p ~/.vim/after/ftplugin/
vim ~/.vim/after/ftplugin/help.vim


and inside the file, put:
autocmd BufWinEnter <buffer> wincmd T

to open in a new tab

or

autocmd BufWinEnter <buffer> wincmd L


to open help in a vertical split.
>>
>>47338923
https://github.com/erichs/composure
Might be what you want.

Generally though either an alias or <C-r> will find what I want
>>
>>47339085
will take a look at composure! thanks.

my main workflow is this... say I wanna compile ffmpeg again... I have a specific options for configure. to do that right now, I have an alias that greps through a file based on a string I pass it (something as simple as "grep -i $1 file.txt"). what I'd like to have is to have an easy way to add to organize all these ffmpeg, mp3 encoding, configure etc "recipes" that I have accumulated over the years.
>>
>>47339066
me again.. I found an even better way:

stick this into your vimrc.
cabbrev help tab help
>>
My Vim is pretty much an IDE now (I've uninstalled spf13 and now have my own config, works much better).

Pic very related
>>
>>47330072
I literally just installed it today, and it isn't slow at all. Thank god for the plugin, I can't be assed to memorize all these shitty javascript canvas functions for class
>>
>>47339473
is there a way to run a debugger term in Vim without using tmux?
>>
>>47339564
Yes, here is a simple example to check a simple C program for compile errors:

map <F9> :w <CR> :!gcc % -o %<.x -Wall -ansi -pedantic -Wextra 2>errors.err; cat errors.err<CR>

You can pretty much do whatever.
>>
>>47339564
not really... to run gdb properly, it need to be in its own terminal.

I run tmux with a good .tmux.conf that has remapped keys so when you move around it, you're using the same keys as moving around the vim. so it's painless.

I also have this plug
https://github.com/scrooloose/syntastic
which automatically tells me of bugs in my code... it won't help with logical bugs but it saves a lot of trips to gcc/clang command line.
>>
>>47339813
Anything is possible Anon, just because you might have to get your hands dirty doesn't mean you "can't" do it.
>>
>>47339564
>is there a way to run a debugger term in Vim without using tmux?
Yeah, it's called installing Emacs.
>>
>>47339564
vimshell (and vimproc, as a dependency) will let you launch a shell within your vim window. I have ":Bash" aliased to ":VimShellInteractive bash" to launch a bash shell within Vim. There're a couple of problems, but it actually works really well.

If you're on windows it works with powershell.exe as well.
>>
small slightly offtopic question:
how do users of vimperator browse a site like 4chan?
>>
Okay guys I use vim on-and-off but I'm still not an editor wizard so I'd like to know what plugins are a must-have? I already know about the latex plugin, but what else?
>>
>>47341435
with a keyboard
>>
>>47341448
nerdtree
>>
>>47341464
fair enough. but can I view images inside the thread (akin to left mouse click behavior when clicking on an image) or am I stuck with opening images on a new tab (middle click behavior)
>>
>>47341526
use f and select the image, should work just like clicking does
>>
>>47341546
I've been doing that all along, but vimperator uses the middle click mouse behavior for opening images for some reason.
>>
>>47341626
mine doesn't
>>
>>47339564
There's a few term plugins for vim but they're all pretty terrible. neovim ships with a terminal (:term) though I haven't tested it.
>>
>>47332397
its actually not bad at all once you get YCM up and running smoothly.
>>
File: hqdefault.jpg (11 KB, 480x360) Image search: [Google]
hqdefault.jpg
11 KB, 480x360
>>47331198
>>
>>47341626
OS?
>>
>>47342175
Windows. I'm also guessing it's some OS idiosyncrasy.
>>
>>47342381
Definitely. I use it under OS X and sometimes Linux and haven't had any issues. Something's messing it up. You should def report the bug to the author. They'll fix it. It's a great addon for sure.
>>
Once, just once, I'd like to find an organization plugin project that has working agenda views, working automated checklist support, and actual file exporting.

vim-orgmode's exporting to pdf is fucked and I couldn't debug out why

VimOrganizer is no longer in active development

DoToo doesn't support checklist, despite that being top of his future features for like a year now.

I may just have to say fuck it and go with actual org-mode.
>>
>>47339813
So I'm just looking at breaking into tmux, would you mind sharing that conf with me?
>>
>>47346104
check out https://github.com/christoomey/vim-tmux-navigator
>>
>>47333142
I checked out the first vid, I'm giving Vim another shot.
Could someone tell me if I messed something up? I followed this guide: http://junegunn.kr/2013/09/installing-vim-with-ruby-support/

>installed gVim 7.4
>downloaded and overwritten with the precompiled .exes from http://wyw.dcweb.cn/#download
>used autoinstaller for ruby 2.0.0
>in gvim :echo has("ruby") returns 1
Thread replies: 112
Thread images: 14

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.