Here's a bit of advice from a librarian: Your personal archive rarely benefits from international classification standards. Whatever floats your boat, I guess, but I would organize my books in my own way, the way I'm comfortable with, and recommend anyone else to do the same.
Hey, Luke, I've got 10+ years of Vim behind me and I'm still amazed at its versatility and adaptability. I just recently subed you; I'd been watching you for a long time and it finally dawned on me, hey, why aren't I following this guy?
@@javaman4584 I don't think everyone learns the same way but when I was first diving into vim I'd use the editor that I was most fluent with 90% of the time I was editing but always devote the remaining 10% of the time during the day to vim. As I became more comfortable with vim I'd increase the amount of time I allocated to using it each day. At some point I felt confident enough to make it my full time, go to editor of choice. And of course I also watched a lot of videos and read a lot of articles about vim. Like I said, I think everyone learns differently but what I described worked for me, starting first with baby steps and gradually building my confidence over time.
Definitely a cool use of globals in VIM.. I usually use globals for search and replace of lines containing specific text. eg. ":g/search/s/replace/with/g" - search for lines containing "search" then replace "replace" with "with". Also, the actual job you are doing here really feels like something I'd do with sqlite3 which would enable much more powerful and complex queries against the data set, but I realize that's not the point of what you showed.
You could use the data attribute instead of a comment. That way the classification number is a part of the element and you could do useful things with it using JavaScript (if you felt so inclined). The lines are still sortable, too. Ex: . . . Note: the data attribute can be anything with the form “data-*”
I think that using a separated json file for all the books, then rendering the json file with some simple frontend library like Vue.JS it's even easier than this. Also, you could still :g/re/p and sort the json file to get the columns sorted as you want, or even create a simple shell script in Javascript to retrieve info about the books (using node.JS, as a Javascript interpreter). Maintaing a "database" in plain html can be very painful sometimes
If the books are organized by HTML tags, I imagine he's going to use the browser to view the final result. In this case, Javascript is already one step away, so why not?
Just a tip, when you go to do the sorting, it's much faster to do it in two parts, kind of like an irl sorting algorithm. What you wanna do is take your sorted list and split it evenly into however many piles you can manage within arm's reach of your computer, then create a new list that's just the book title and what pile it goes in. Then you make a big intake pile nearby and use whatever kind of fuzzyfinder you want to start typing in titles and as soon as it pulls up the group/pile that's where you put the book and move on to the next one. If you do it right you can rough sort like 20-30 books a minute. Then it's pretty easy to make the second pass and sort your stacks of 30ish books from each pile into their correct interstack order, then you just shelve stack 1 then 2 etc... The description is convoluted, but the actual process is simple and is more or less what large libraries do but just with typing and stacks instead of scanning and book carts.
Wanted to download a calculus textbook but the chapters were in individual links - used vim, converted the html file into csv and used python to download everything
Surprised that no one mentioned that once the HTML comments have been moved to the beginning of the line, can simply run :sort on select lines or :sort u to dedupe if there are duplicates that one wants removed
Not to take away from the video since this is definitely an effective method but I thought I would point out that you can use sort on more then just the start of the line. You could use `sort --field-separator='!' --key=2 library.html` or `sort -t '!' -k 2 library.HTML` to sort based on everything after the comment marker. That being said this has some obverse limitations, such as the fact that it sorts the entire file and the fact that it will sort other comments that you may not want sorted and most importantly no ! can occur in any of the book titles. Just figured I find myself using variations of this particular sort feature a lot and you all might find this useful.
I wanna point out that in :g and :s, you can use any special character instead of the / as the pattern separator. I personally use ; Pretty sure this is the case in any command that expects a pattern with separators, in vim
Here is an idea: using your webcam as a barcode reader (ZBar) you could really quickly build a database like this as the barcode usually stores the ISBN number. Pipe the read code into curl with the database website. Find the information you want in the output. Profit!
Thank you for your video, I found this usage of vim a good example of its power. I like editors with some sort of "macro" mode. (One of my favorites is Textpad on windows even though it's a paid software with an endless trial version) But honestly it is not really a "daily task" to sort such a badly organized file, no offence meant ! Instead of editing or organizing manually a giant html file, you should code in order to generate it from an XML let's say, it would be so much more powerful. You could add new books without needing to resort the list everytime. Just an idea :)
Simpler yet is merely a plain csv file that is imported into html, using CSS: html should be the last amount of formatting complexity, not the first. Ideally you'd never store your data mixed with you formatting: this why there are stylesheets.
Luke, I mean, I love vim and everything too, but this is really something that would be done better with sed; then you can use sort and don't even have to pipe to grep: sed -E 's/(.*)()/\2\1' | sort But honestly, this is really a job for awk. You could write a script to do this and sort these lines in place without even having to pipe it into anything, although it would be complicated enough that it probably does deserve its own (albeit short) awk script file.
I've seen couple times a (funny) saying .. something more or less like this: No matter how good you are, there is always an asian better than you! but in reality asians (like me) are thinking: No matter how good you are, there is always luke out there!
Why not store your data in a representation-agnostic format (i.e. YAML, JSON, CSV, bibtex etc.) and then simply have a small script to transform to the desired format (rich-HTML, plaintext, different formatting etc.). While this is nice, the mental friction to get to where you wanted to get is simply way too high. Just some thoughts. Still love your content! :-)
So I was on a forum looking for an IDE for C and someone said use Vim and spend 2 months learning that instead of C. Laughed hard and assumed they were a linux hater. :(
5 ปีที่แล้ว +1
The terminal font size is too small, it should be like 3:29 the whole video
Hi Luke. Is there a way to sort paragraphs by headers? I use vim now for 3 months. I began to write a book in Markdown. Now I like to reorganize like this: # A Content A # B Content B Transform to # B contents of B # A Content of A And this by a large document with a lot of h1, h2 and h3. I tried out a lot and looked in internet. But I failed till yet. May you can help me. I learned a lot of your videos. Nice greetings Sven
Why don't you just store the book name and identifier in a spreadsheet, or any sort of application/format that supports tables? It seems like a more structured, organized and scalable way of maintaining something like this
@@chrisbannister1684 yeah, it's much better to fuck around with html and write regexes the size of an essay to accomplish anything significant with your data
Spread shit programs are among the most bloated pieces of software ever written. The way to go is to use some relational database system, SQLite is fine for personal usage. Then, you make your queries to sort/filter/join everything you want. Then, create a simple backend and frontend to access and view the data. Or use Calibre, which is full featured and full bloated.
Other people would use python, Luke uses vim instead ;-) BTW: You like Linux / free technology and books? You might read Ivan Illich: Tools for Conviviality.
Let's just pretend to forget that DBMS is useful or call that "NOT MINIMALIST" even longer than needed so we can forget there are tools that can make your life better. BUT GUI? NO!!!!!!! EVIL!!!!! (It is a joke BTW.)
Duuude, you have a mistake in your library in the american literature section, José Saramago is portuguese! Please put your website offline until this is fixed!!
You really need to learn about structured data. I know it's a Windows-thing, but formats like CSV, YML, XML and JSON exist for a reason. Instead of wrangling HTML comments like some zoomer, why not just store the library in a CSV? You can then easily read that in and use it to auto-generate the HTML page or any other autistic endeavour you can think of. But if you hand-code your website and try to use that as the "database" you are unironically doing it wrong.
Well structured data is not really a Windows thing. Binary proprietary unreadable format is a Windows thing, you could go through a json or css with less and scrap paper if you wanted to, not so much with word files, for example.
@@alessandroceloria that's wrong and shows how little you know. Windows is entirely object-oriented and so is all other Microsoft Software, they really love it. Word (all Office) files are literally XML Inside a ZIP btw, nothing binary about that.
@@0M9H4X_Neckbeard Do you even know what object oriented means? It has nothing to do with how a file is laid down, it's a programming paradigm you dumbass. I said that structured data is not a Microsoft exclusive, prove me wrong if you can. Last time I checked csv,json,yaml,xml,html and so on were not created by Microsoft and were open, non-proprietary standards that anyone can use without royalties and that are completely plaintext, hence can be read with less/cat and restructured on a piece of paper in a more plain way. And as somebody else here said, /etc/passwd in unix is a csv file, so the one that knows little about what structured files are is you. I know that office files are compressed XMLs, hence the x in the extension name (docx,pptx,...) and the file header, but the file as-is, prior to decompression, is binary data since it cannot be used in any meaningful way (apart from extracting some metadata like the author name) and to access the raw, structured data you have to first decompress it. Binary file in its broader meaning indicates any file that cannot be fully represented as human-readable text with ASCII or UTF-8/16/32 encoding. In its narrower meaning it indicates an executable program but that's not what I was talking about.
But not a single one of these did he do faster than he could have done with a modern text editor. If it's the commands he likes I'm sure they might have vim bindings or something. I extensively use regex search in vscode to do the same things in a very minimalistic UI
hey check out the 3TB or whatever size repository of scientific literature at libgen.is , i found 7 editions of James Stewart's Calculus book that I used in that class. Could've saved $150 but didn't know about it. Just found it out a couple days ago. I'd appreciate it if someone told me about it before I spent money on books, so I'm tellin you now!
As the saying goes: ”if your only tool is VIM then every problem looks like an ASCII text file”
As it should.
Vim works really nice with UTF-8 too.
precisely! a simple db would solve the problem elegantly
5:50
C.S. Lewis, Evola, Nietzche
BASED
Careful! Your Stephen Hawking's _A Brief Story of Time_ wasn't matched to the regex because of the space between
Hahah, look, it's Brave! Luke fell on memes again.
Here's a bit of advice from a librarian:
Your personal archive rarely benefits from international classification standards. Whatever floats your boat, I guess, but I would organize my books in my own way, the way I'm comfortable with, and recommend anyone else to do the same.
I think it's just the autism. Well, at least as an autistic, organizing books by some sort of cool number related standard sounds incredibly exciting.
The man who inspired my vim passion
sql with vim, sounds legit
Hey, Luke, I've got 10+ years of Vim behind me and I'm still amazed at its versatility and adaptability. I just recently subed you; I'd been watching you for a long time and it finally dawned on me, hey, why aren't I following this guy?
@@javaman4584 Even I want to know this.
@@javaman4584 I don't think everyone learns the same way but when I was first diving into vim I'd use the editor that I was most fluent with 90% of the time I was editing but always devote the remaining 10% of the time during the day to vim. As I became more comfortable with vim I'd increase the amount of time I allocated to using it each day. At some point I felt confident enough to make it my full time, go to editor of choice. And of course I also watched a lot of videos and read a lot of articles about vim. Like I said, I think everyone learns differently but what I described worked for me, starting first with baby steps and gradually building my confidence over time.
The sort command has delimiters tho, so you could in theory sort by a delimiter
also awk can do more advanced sorting ^
you could `g/something/d` to delete matching lines, no need of `norm dd` for that.
Luke uses Brave now
AAAAAAAAAA
Power of :g and sort combined:
:g/
Definitely a cool use of globals in VIM.. I usually use globals for search and replace of lines containing specific text. eg. ":g/search/s/replace/with/g" - search for lines containing "search" then replace "replace" with "with". Also, the actual job you are doing here really feels like something I'd do with sqlite3 which would enable much more powerful and complex queries against the data set, but I realize that's not the point of what you showed.
As a new user of VIM, I'm loving these videos! Subbed.
You could use the data attribute instead of a comment. That way the classification number is a part of the element and you could do useful things with it using JavaScript (if you felt so inclined). The lines are still sortable, too.
Ex: . . .
Note: the data attribute can be anything with the form “data-*”
Organizing the pacman mirror list is what inspired me to learn VIM global commands.
BROOOO, I just love your miniatures, best miniatures ever on YT xD
@K19 I don't think we'll ever find out.
miniatures.vim or minis.el
miniature = thumbnail
So many uploads, is it Christmas already?
PADORU PADORU!
You should see what some of us ancient guys do with Emacs in evil mode. Evil mode makes the keystrokes like vim, a far more extensible vim.
I think that using a separated json file for all the books, then rendering the json file with some simple frontend library like Vue.JS it's even easier than this. Also, you could still :g/re/p and sort the json file to get the columns sorted as you want, or even create a simple shell script in Javascript to retrieve info about the books (using node.JS, as a Javascript interpreter). Maintaing a "database" in plain html can be very painful sometimes
If the books are organized by HTML tags, I imagine he's going to use the browser to view the final result.
In this case, Javascript is already one step away, so why not?
or you could have just used sort -k
Lol that would only word if literally every book title was the same number of words.
@@LukeSmithxyz sort -k2 -t'!' file.html
Just a tip, when you go to do the sorting, it's much faster to do it in two parts, kind of like an irl sorting algorithm.
What you wanna do is take your sorted list and split it evenly into however many piles you can manage within arm's reach of your computer, then create a new list that's just the book title and what pile it goes in. Then you make a big intake pile nearby and use whatever kind of fuzzyfinder you want to start typing in titles and as soon as it pulls up the group/pile that's where you put the book and move on to the next one. If you do it right you can rough sort like 20-30 books a minute. Then it's pretty easy to make the second pass and sort your stacks of 30ish books from each pile into their correct interstack order, then you just shelve stack 1 then 2 etc... The description is convoluted, but the actual process is simple and is more or less what large libraries do but just with typing and stacks instead of scanning and book carts.
Wanted to download a calculus textbook but the chapters were in individual links - used vim, converted the html file into csv and used python to download everything
You should have used assembly. Python is so much bloat these days
@@ThaEzioAuditore No, I only used python because the downloader I built directly from logic gates did not work
Btw fyi, the "Lexical-Functional Syntax"-entry has a typo: Toivonen instead of Tolivonen :)
Surprised that no one mentioned that once the HTML comments have been moved to the beginning of the line, can simply run :sort on select lines or :sort u to dedupe if there are duplicates that one wants removed
"super del" sounds like a good way to say goodbye :3
Not to take away from the video since this is definitely an effective method but I thought I would point out that you can use sort on more then just the start of the line.
You could use `sort --field-separator='!' --key=2 library.html` or `sort -t '!' -k 2 library.HTML` to sort based on everything after the comment marker.
That being said this has some obverse limitations, such as the fact that it sorts the entire file and the fact that it will sort other comments that you may not want sorted and most importantly no ! can occur in any of the book titles. Just figured I find myself using variations of this particular sort feature a lot and you all might find this useful.
in library
>kropotkin
>engels
>GEORGE SOROS
guys watch out
I wanna point out that in :g and :s, you can use any special character instead of the / as the pattern separator. I personally use ;
Pretty sure this is the case in any command that expects a pattern with separators, in vim
Why not to use SQL? Keep data in SQLdb (i.e. SQLite - single file db), and create html dynamically (i.e. using at least PHP)
Awk could handle this job right on the command line! I really apreciate tour videos man! Thanks a lot
"I Am A Strange Loop" in SCIENCE & MATH
lmaoo the depths unplumbed
Thank you Luke, that was a great help! You made me use Vim - and I love it :)!!!!!!
I see your Feyerabend Against Method - it's a great work in the philosophy of science.
Vim geekness to the next level
Here is an idea: using your webcam as a barcode reader (ZBar) you could really quickly build a database like this as the barcode usually stores the ISBN number. Pipe the read code into curl with the database website. Find the information you want in the output. Profit!
Based and techpilled
Thank you for your video, I found this usage of vim a good example of its power. I like editors with some sort of "macro" mode. (One of my favorites is Textpad on windows even though it's a paid software with an endless trial version)
But honestly it is not really a "daily task" to sort such a badly organized file, no offence meant ! Instead of editing or organizing manually a giant html file, you should code in order to generate it from an XML let's say, it would be so much more powerful. You could add new books without needing to resort the list everytime. Just an idea :)
Simpler yet is merely a plain csv file that is imported into html, using CSS: html should be the last amount of formatting complexity, not the first.
Ideally you'd never store your data mixed with you formatting: this why there are stylesheets.
Luke, I mean, I love vim and everything too, but this is really something that would be done better with sed; then you can use sort and don't even have to pipe to grep:
sed -E 's/(.*)()/\2\1' | sort
But honestly, this is really a job for awk. You could write a script to do this and sort these lines in place without even having to pipe it into anything, although it would be complicated enough that it probably does deserve its own (albeit short) awk script file.
Розенбаум плохого не посоветует, спасибо!
Ахаха, вимеры всех стран объединяйтесь!
As for less, it's an alias for me to vim "+noremap q :q" -p -R -M . Much better than less.
stayed up all night learning vim now upset my day's responsibilities aren't the editing of text files
Do a walk-through your books...
Make a video on regular expression
Some book reviews would be nice.
Gödel, Escher, Bach, Mere Christianity, AND Differential Games!?
my dude
I've been using VIM for years and I didn't know about the global command, feeling like a real brainlet rn 2bh senpai
Nice tip. I too have tended to use macros for this. The approach you outline here is way better.
Can't you just do sort /
Have you tried using xmllint or any other commandline xpath parser for that?
How practical, thanks for the tip
but have you heard about MS Excel?
Could use the 'sed' command to bring the comment to the beginning (using regex groups) and then pipe that to the 'sort' command
my thoughts exactly. but i think the point of the video was about being a better vim user.
The fact that you just happen to have exactly 333 books is oddly satisfying
Cool! I didn't knew this technique
Is he still /ourguy/?
is Luke based about (them)? Havent heard him talk about it.
@@ctmctm2031 hes got culture of critique on his booklist lol
I've seen couple times a (funny) saying .. something more or less like this:
No matter how good you are, there is always an asian better than you!
but in reality asians (like me) are thinking:
No matter how good you are, there is always luke out there!
Your cs Lewis library needs to be larger.
same, I used to write stupid long commands on my shell to do similar things, now I use an editor (insert-emacs-joke)
Emacs needs an own doctor for its users!
Awesome Vim tutorial, but dude, you should use a DB.
Why not store your data in a representation-agnostic format (i.e. YAML, JSON, CSV, bibtex etc.) and then simply have a small script to transform to the desired format (rich-HTML, plaintext, different formatting etc.). While this is nice, the mental friction to get to where you wanted to get is simply way too high. Just some thoughts. Still love your content! :-)
Read "Who if I Cry Out" by brazilian Gustavo Corção. Just amazing f amazing (or if you can read portuguese: Lições de abismo)
Nice, I'll look into it!
I saw in one of your video that you use some similar to grep to preview pictures. What is that???
Are relation databases or a table based methods bloated? nice tutorial though
I need to learn vim. . .
He lives! Praise be!
QB981 is missing a space.
Really love this kind of videos. Thank's a lot.
So I was on a forum looking for an IDE for C and someone said use Vim and spend 2 months learning that instead of C.
Laughed hard and assumed they were a linux hater. :(
The terminal font size is too small, it should be like 3:29 the whole video
Bro is vim librarian
there should be a Chad mode in nvim
I found the guy from the math problem with 300 plus books
Are there more videos like this? Solving real world problems.
woah Luke smith read the kybalion and blavatsky!!! !!! !!!
This is the guy from all those math questions XD
Hi Luke.
Is there a way to sort paragraphs by headers?
I use vim now for 3 months. I began to write a book in Markdown. Now I like to reorganize like this:
# A
Content A
# B
Content B
Transform to
# B
contents of B
# A
Content of A
And this by a large document with a lot of h1, h2 and h3.
I tried out a lot and looked in internet. But I failed till yet. May you can help me. I learned a lot of your videos.
Nice greetings
Sven
Doesn't sort have a sort by column? I think '-k'
Why don't you just store the book name and identifier in a spreadsheet, or any sort of application/format that supports tables? It seems like a more structured, organized and scalable way of maintaining something like this
Ouch!!! It's never a good idea to use a spreadsheet as a database.
@@chrisbannister1684 yeah, it's much better to fuck around with html and write regexes the size of an essay to accomplish anything significant with your data
Spread shit programs are among the most bloated pieces of software ever written.
The way to go is to use some relational database system, SQLite is fine for personal usage. Then, you make your queries to sort/filter/join everything you want. Then, create a simple backend and frontend to access and view the data.
Or use Calibre, which is full featured and full bloated.
well.. I guess sqlite would be better choice ;)
sqlite is bloat if you dont need to do complex queries
@@pokefreak2112 yeah... so are gui programs and precompiled distros ;)
SQLite is not bloat.
Using your text editor to sort shit that might be by book, author, index, etc is bloat.
I guess all these things could also be done with a little programming, but I do use Haskell to automate stuff like this so idk
Always useful, always inspiring!
Why don't you use vim's sort function?
I don't want to change the file, just see the output sorted temporarily so I can go through it.
Great video! Thank you.
Other people would use python, Luke uses vim instead ;-)
BTW: You like Linux / free technology and books?
You might read Ivan Illich: Tools for Conviviality.
NOOOOOOOOO YOU CANT USE BRAVE NOOOOO BRAVE SHILL
Or open your file in a browser and use xpath to get the contents of li...
Evola, nice.
this can all be solved if you switch to E books
Ehm ... why not sort not by the first column but instead another one with sort?
Okay: which number column would I tell it to sort by?
@@LukeSmithxyz sort has the option "-t" to define the separator. So you can set "!" maybe even "
Let's just pretend to forget that DBMS is useful or call that "NOT MINIMALIST" even longer than needed so we can forget there are tools that can make your life better.
BUT GUI? NO!!!!!!! EVIL!!!!!
(It is a joke BTW.)
Good to have you back luke
I guess Luke is back. 3 videos in under a week? WOOOOO
Duuude, you have a mistake in your library in the american literature section, José Saramago is portuguese! Please put your website offline until this is fixed!!
You really need to learn about structured data. I know it's a Windows-thing, but formats like CSV, YML, XML and JSON exist for a reason.
Instead of wrangling HTML comments like some zoomer, why not just store the library in a CSV? You can then easily read that in and use it to auto-generate the HTML page or any other autistic endeavour you can think of. But if you hand-code your website and try to use that as the "database" you are unironically doing it wrong.
Well structured data is not really a Windows thing. Binary proprietary unreadable format is a Windows thing, you could go through a json or css with less and scrap paper if you wanted to, not so much with word files, for example.
/etc/passwd is a csv
Data is a bloat! Use Vim!
@@alessandroceloria that's wrong and shows how little you know. Windows is entirely object-oriented and so is all other Microsoft Software, they really love it. Word (all Office) files are literally XML Inside a ZIP btw, nothing binary about that.
@@0M9H4X_Neckbeard Do you even know what object oriented means? It has nothing to do with how a file is laid down, it's a programming paradigm you dumbass.
I said that structured data is not a Microsoft exclusive, prove me wrong if you can. Last time I checked csv,json,yaml,xml,html and so on were not created by Microsoft and were open, non-proprietary standards that anyone can use without royalties and that are completely plaintext, hence can be read with less/cat and restructured on a piece of paper in a more plain way. And as somebody else here said, /etc/passwd in unix is a csv file, so the one that knows little about what structured files are is you.
I know that office files are compressed XMLs, hence the x in the extension name (docx,pptx,...) and the file header, but the file as-is, prior to decompression, is binary data since it cannot be used in any meaningful way (apart from extracting some metadata like the author name) and to access the raw, structured data you have to first decompress it. Binary file in its broader meaning indicates any file that cannot be fully represented as human-readable text with ASCII or UTF-8/16/32 encoding. In its narrower meaning it indicates an executable program but that's not what I was talking about.
Or you could have used the vim command :sort
@Christopher Medlin unless you have all your numerics correctly padded, alphabetic sorting is definitely not the same as numeric sorting.
But not a single one of these did he do faster than he could have done with a modern text editor. If it's the commands he likes I'm sure they might have vim bindings or something. I extensively use regex search in vscode to do the same things in a very minimalistic UI
why not database
When you use Acme.
hey check out the 3TB or whatever size repository of scientific literature at libgen.is , i found 7 editions of James Stewart's Calculus book that I used in that class. Could've saved $150 but didn't know about it. Just found it out a couple days ago. I'd appreciate it if someone told me about it before I spent money on books, so I'm tellin you now!