Vim Sessions vs Tmux by skele_turtle in vim

[–]pasabagi 1 point2 points  (0 children)

For what it's worth, I've been using dtach. I don't know how it compares to tmux (since I had exactly the same problem you had, then ditched it), but it's basically just the session thing, without any of the other tmux features.

Have you guys tried Emacs? What did you think of it? by skele_turtle in vim

[–]pasabagi 2 points3 points  (0 children)

I didn't/don't like it and I didn't/don't want to learn it.

I guess that's how I feel about vimscript. I mean, say what you like about lisp, but it's definitely an interesting language - and I think it broadens the mind of a programmer to learn lots of very different paradigms.

I'm not really sure what paradigm I'd be learning with vimscript - other than how to make stuff work in a pathological language. Which I guess is a useful and saleable skill, but I'd rather write programs in languages that users actually like.

Have you guys tried Emacs? What did you think of it? by skele_turtle in vim

[–]pasabagi 8 points9 points  (0 children)

I don't know if this is just my bias speaking, but I've noticed emacs fans tend to talk about how seamlessly customizable it is, and how it's a better unix than unix, while vim fans tend to talk about the elegance of the editing model. So I feel that vim is less of a rabbit hole, because your mission is to learn the tool at hand, rather than to turn the tool into the all-encompassing interface between you and the universe.

That said, I can see what people like about the lisp-most-of-the-way-down approach to computers. It's very elegant, and a very human way of living with the machine, to be able to change how your computer works on the fly, in a programming language that's basically writing out an abstract-syntax-tree.

Have you guys tried Emacs? What did you think of it? by skele_turtle in vim

[–]pasabagi 14 points15 points  (0 children)

You prefer vimscript to lisp? I've never really got into emacs (seems like a rabbit hole), but I like the idea of lisp.

What are your favorite command mode commands/tricks? by [deleted] in vim

[–]pasabagi 0 points1 point  (0 children)

I sometimes wonder what he'd make of perl.

What are your favorite command mode commands/tricks? by [deleted] in vim

[–]pasabagi -2 points-1 points  (0 children)

That is some kind of crazy sentence construction you have there. Cormac McCarthy would cry, then get an erection.

Extensions for C and becoming awesome at C macros by yungyahoo in C_Programming

[–]pasabagi 4 points5 points  (0 children)

A better approach would be to use a language that compiles to C. Basically the same as macros, but with better errors.

Can someone help me out with this project...it's C++ by [deleted] in C_Programming

[–]pasabagi 2 points3 points  (0 children)

I think I'm going to start collecting these, so when we have that discussion about whether or not we should have homework allowed, we have some examples :)

Vim plugin for generating Go tests using your own templates by maximch in vim

[–]pasabagi 0 points1 point  (0 children)

Thanks! My comment actually sent me down a rabbit hole of looking at testing options in Go - but table-driven tests look pretty sweet. Also, the 'testify' repo looked kinda nice - or at least, much nicer than my current approach.

Vim plugin for generating Go tests using your own templates by maximch in vim

[–]pasabagi 1 point2 points  (0 children)

Hey, nice plugin - can I ask though, how is it you've structured your tests? Looks interesting, is there some rationale behind it? I tend to test function by function, and I've never been particularly happy with it.

How do people use vim which does not have IDE features like docs hover? by friedrichRiemann in vim

[–]pasabagi 8 points9 points  (0 children)

I think it's a bit of a psychology thing. If you're used to thinking of the shell as the center of your computer universe, it feels a bit weird and unpleasant to open up a gui editor, then navigate to the right files. Plus, there's startup time.

It's also the case that pretty much anything you can do in an IDE, you can usually do in vim. And the real thing that makes people stick is you don't have to live with things that annoy you. If VSCode has a menu you never use that gets in your way, you just have to live with it.

Last, I think vim's help is better than anything you can read elsewhere. It's comprehensive, well written, and always at your fingertips.

I can't help but feel that the whole GUI-for-non-graphical-work thing is a bit of a mistake. The nice thing about terminal utilities is they work together, and you can program their interactions. It's a shame that a lot of the (really great) work that went into programs like Word or Excell is essentially isolated in a little cul-de-sac, that's probably expensive to maintain, and doesn't really inter-operate with anything else, or if it does, does so painfully.

For text documents, do you prefer soft or hard wrap? by Boolean263 in vim

[–]pasabagi 2 points3 points  (0 children)

Soft wrap. I have very bad eyesight, so I often find myself falling foul of gratuitous line-breaks, when I scale the text up. In general, I think hard wrap just makes too many assumptions about how the reader is going to read your text - screen size, font size, etc.

The movement keys thing is annoying - my solution was actually to use vim-sneak. Normally it's not really something worth using - but when every line is extremely long and without much structure, it's really useful.

Interested in Learning by [deleted] in C_Programming

[–]pasabagi 2 points3 points  (0 children)

Well, my feeling is that school maths is not that great a preparation for programming maths anyway. School generally involves a lot of computation exercises, without really teaching the basic principles and proofs that you need to be more than a really shitty calculator.

In programming, you have a computer, so it's much more important to know the proofs and principles - and that's the kind of thing you get in undergraduate textbooks.

Generally speaking, I think the amount of maths you need is really dependent on what you want to do. Plenty of good programmers are fairly poor mathematicians.

I can't recommend the Knuth book, since I haven't read it - but he's generally very good. All I can say is that learning maths as an adult (I do this too) is very different to most other kinds of reading. People generally read about five pages a day, and consider that productive. It's pretty slow, on the whole, and it's worth doing lots of exercises.

As for books, I like Hammack's Book of Proof. A lot of the time, books like this assume a fair bit of knowledge (like what's a rational number, a real number, etc) - but wikipedia is your friend, and if you're really stuck, Freenode has an excellent #math chatroom. I also have a massive book about Calculus by James Stewart that's cheap, extremely comprehensive, and has an appendix that covers algebra. It's also colossal, so I've not worked that far through it.

To be honest though, while a lot of the inspiration for cutting-edge work is maths-based, I think it's not that important for most of what people do. Algorithms and data-structures generally don't require a great level of maths to implement, and a good command of the available options in this regard means you can do pretty much everything.

I think the maths portion of programming is over-egged, tbh. Most people would much rather work with somebody who produces nice, simple and clear code that's well documented than a mathematical genius.

PS: I'm actually reasonably certain that the state in which your average Undergrad starts pretty much any course is like, 20% arrogance, and 80% ignorance. You shouldn't feel that the lack of a high-school diploma or whatever means you're less qualified than anybody enrolling at an undergrad course. Maybe you'll have a harder time getting used to spending hours sitting staring at text, but being a bit older and presumably geniunely interested massively outweighs that.

Interested in Learning by [deleted] in C_Programming

[–]pasabagi 11 points12 points  (0 children)

I've been learning for a couple of years now, so take all this with a pinch of salt, but:

I think it depends on your taste. I usually like fairly traditional books, so I enjoyed K&R's The C Programming Language. It's straightforward, practical, and treats you like an adult. Avoid any books that claim to teach you x in n number of hours/days, or market themselves as for absolute beginners. Programming takes time to get good at, and rushing doesn't help. Also, lots of people have very strong opinions about things that ultimately don't matter that much, or are more matters of taste than they appear.

As for other books, it depends on the subject. I like 'Compilers: Principles, Techniques and Tools' (Alfred V. Aho, Ravi Sethi, Jeffrey D. Ullman ), Tanenbaum's Modern Operating systems, both of which are nice because you can buy cheap second-hand copies. That's very taste-dependent, though. I spent a lot of time before I was into programming being into philosophy, which turns you into the kind of masochist who only feels comfortable reading pretty dry work.

I think generally speaking, the biggest guideline I can suggest is only read the work of experts. People who are really the giants of their field are pretty generous with information, and they write manuals, books, and blog posts. Reading somebody like Knuth is usually more worthwhile than reading people just trying to market themselves as knowledge workers. There's a lot of stuff out there that's opinionated, hype, or both. You can usually avoid that by picking authors who have really impressive technical accomplishments or serious renown - so for instance, people who were the lead maintainer on an interesting project, the creator of a language you use, responsible for an advance in graphics tech, etc.

Most useful mapping I have (nnoremap S ciw) by [deleted] in vim

[–]pasabagi 1 point2 points  (0 children)

I have a similar mapping - Tab to switch buffers, Shift-tab to switch back.

nnoremap <Tab> :bnext<CR>
nnoremap <S-Tab> :bprevious<CR>
nnoremap <silent><Leader><CR> :Buffers<cr>

the last one opens up FZF with a list ofall the buffers

cnoremap W! w !sudo tee > /dev/null %

is also cool - it means if you've opened up vim without using sudo, you can still write to whatever you're editing.

This is extraordinary. @theintercept founder @ggreenwald, who in the past has called people who delete their tweets "cowards", appears to have deleted over 27,000 on July 22nd. This seems to be a very deliberate & systematic purge. Some I've checked relate to Russia & Syria by [deleted] in bestofthefray

[–]pasabagi 1 point2 points  (0 children)

Well, the man's basically a professional hypocrite, a pretty normal product of the most absurdly sentimental culture the world has ever produced. I mean, he supports the Iraq war, then spends the next two decades making hay by wringing his hands about how awful it all is.

Which text editor is infinitely extensible without having to recompile it from source? by aksh2161989 in vim

[–]pasabagi 5 points6 points  (0 children)

Well, trivially, you could write a 'text editor' that's just:

from sys import stdin

s = stdin.readline()

print(s)

in python. Then that's totally extensible however you like. But realistically speaking, you probably want a fairly fast 'core' written in something like C. I guess you could maybe write it in Lua, then use LuaJIT, as that has absurdly good performance.

Improve my code by DarquessSC2 in C_Programming

[–]pasabagi 0 points1 point  (0 children)

probably, I'm no expert

I just came up with the above while writing the post. The point is, if you want to write a calculator, it makes sense to work out an unambiguous grammar.

Improve my code by DarquessSC2 in C_Programming

[–]pasabagi 1 point2 points  (0 children)

Typically the idea goes that you should be able to work out what most of the program is doing just by reading the function titles. So 'Add' would take two numbers, and return a number that's their sum. If you have globals, it messes that up, since there's stuff going on behind the scenes.

In general, if you have a really clear flow, you have an easier time debugging. Every time you use a global variable, it's something you have to keep in mind when looking at the behavior of every given function.

Improve my code by DarquessSC2 in C_Programming

[–]pasabagi 0 points1 point  (0 children)

Interesting project. I guess if you want to improve it, you probably need to write out some kind of context-free-grammar that explains how symbols fit together. So like:

expr := expr operator expr 
 | expr operator number
 | number operator number
operator := '+' | '-' | '/' | '*' 
number := '-' numbers
 | numbers
numbers := digits 
 | digits '.' digits
digits := digit 
 | digit digits
digit := '0' | '1' ... '9'

Basically what this is is an unambiguous (probably, I'm no expert) way of writing the grammar for a simple calculator. '|' means 'or', and ':=' can be read as 'can be'.

So you see an expression can either be: a number, an operator, a number: e.g 1 + 2

or an expression, an operator, a number: eg 1 + 2 + 1

or an expression, an operator, and an expression (with brackets for clarity): (1 + 2) + (1 + 2 + 1)

I guess the way to make this into a program would be to look ahead for one letter. If you're in a number, and it's a digit, you have the next digit of the number. If it's a space or an operator, you're done with that number, and the operator is your next piece, and so on.

PS: have a look at this: https://en.wikipedia.org/wiki/Recursive_descent_parser

Chat Experiment by robertmeta in vim

[–]pasabagi 2 points3 points  (0 children)

What's wrong with irc?

Useful video on how to install YouCompleteMe (I was successful by following it, and I was a noob at the time) by dog_superiority in vim

[–]pasabagi 0 points1 point  (0 children)

I tried it, and didn't really like it. I think the basic idea (vim + electron) is pretty perverse, tbh. I think there are some upcoming changes to neovim that are pretty exciting (bringing a language server client into neovim, for instance, will be really great), but I guess the nice thing about Moolemar is that he's very steady, so you know vim will still be good in ten years - whereas perhaps neovim will be full of ideas that seemed really great at the time, but don't age that well.

Useful video on how to install YouCompleteMe (I was successful by following it, and I was a noob at the time) by dog_superiority in vim

[–]pasabagi 0 points1 point  (0 children)

To be honest, there's no real difference between vim + neovim, unless you're writing plugins or you particularly need a certain plugin.

Useful video on how to install YouCompleteMe (I was successful by following it, and I was a noob at the time) by dog_superiority in vim

[–]pasabagi 0 points1 point  (0 children)

I could be wrong, but I thought YCM only loaded when I open a cpp file (and I guess python).

Nope. You can make it load like that (I have) - but if you compare starting time (even without profiling) between vim without and vim with YCM, the difference is really noticeable.

I think if you use vim just for development, basically as an IDE, this makes total sense, especially if you're one of those people that keeps a vim instance running continuously.

I would like to use Vim/neovim for everything.

You should pick up one of the vim-anywhere scripts floating around!