Plug 'dhruvasagar/vim-table-mode'
Plug 'godlygeek/tabular'
Plug 'mechatroner/rainbow_csv'
vimwiki is ok for tables too
in vimwiki type :VimwikiTable 2 5
(this creates a 2 col 5 row empty table)
move through it with tab and shift tab
and it also auto formats.
item = 1
flavour = 2
pistachio = 3
| align delimiters | :Tabularize /= |
* !important note that its not :Tableize
* that's table mode, tabularize is for tabular
| insert col | leader tic |
| delete row | leader tdd |
| enable table mode | leader tm |
| delete column | leader tdc |
| add formula | leader tfa |
| evaluate formula | leader tfe |
| tableize a csv | leader tt |
| item | price |
| hamburger | 1$ |
| hotdog | 3$ |
|-----------+-------|
| TOTAL | 4.0 |
/* tmf: $4,2=Sum(1:-1) */
leader tm = table mode enable
shift v = visual mode select everything
leader tt = tablelize a csv
leader tfa = enter formula Sum(1:-1)
leader tfe = re-evaluate/re-align table
:Tabularize / = aligns by delimiter
// and going the oposite way
https://tableconvert.com/markdown-to-csv
(also pretty handy too...
Plug 'matze/vim-move')
remapped it from ctrl + jk to shift + jk with ..
" Remap vim-move from alt to shift
let g:move_key_modifier_visualmode = 'S'
Monday, February 12, 2024
3 sick vim plugins for dealing w tabular data
Sunday, February 4, 2024
ios reading list key commands
reading list is cool if you want to do it like my previous method.
but thats not even neccesary on an ipad w a bluetooth keyboard w vim binds on the browser. just yy cmd shift to textastic comma and type the title. easier way to make the csv for the website links
safari on ipad
- ctrl cmd 2 = show reading list sidebar
- ctrl cmd d = add to reading list
- ctrl cmd 1 = bookmarks sidebar
- ctrl cmd 3 = history sidebar
vim-like extension
- yy to copy link
Friday, February 2, 2024
regex to swap 2 columns of a csv
cliptools new update with smartfiles is amazing.
Ive got cliptools running 2 buffers deep.
enabled global paste in settings for cmd shift c to paste from smart file. my smartfile is {clip:1},{clip:2}(then newline).
I use this to quickly grab urls and titles to create links for my website.
my website runs a bunch of javascript that dynamically generates tables with links inside them from the csv.
By using cliptools I can grab all the links at once and as long as I stay consistant with copying the title,then the link its fine. if they end up backwards, it's not a big deal. Being consistent is the most important because I can easily use a regex to fix it.
my regex to fix it
:%s/\v([^,]+),([^,]+)/\2,\1/g
Tuesday, December 12, 2023
csv2table
I like this vscode extension by Michel SLAGMULDER.
you press ctrl H ctrl T on some selected csv and it converts to and HTML table. (although the command isn't working for me on linux mint so i use the command palate instead ctrl shift p)
arggg you know what sucks though? it doesn't escape the characters inside double quotes. so you've got a date like "sept, 11, 1905" it thinks you have 3 columns. SOO ANNNOYING. (I was wondering why the default delimiter was set to semi-colon instead of comma.)
gotta do a find and replace with a regex. heres the pattern I use to match:
,(?=(?:[^"]*"[^"]*")*[^"]*$)
open vscode live server = alt L O
format HTML = ctrl shift i
bootstrap has dark mode add this to the head: data-bs-theme="dark"
<html lang="en" data-bs-theme="dark">
basic table css styling:
table, th, td {
border: 1px solid;
}
Striped tables:
<style>
table {
border-collapse: collapse;
width: 100%;
}
th, td {
text-align: left;
padding: 8px;
}
tr:nth-child(even) {background-color: #f2f2f2;}
</style>
Thursday, July 6, 2023
getting wiki tables into markdown
How to get tables from wikipedia into markdown without loosing the formatting
OCR is cool, the thing on iphone can preserve some formatting but I was loosing the formatting on my mac. if you mess with my tables thats a deal breaker for me. heres my web tools solution:
of course you could use pandoc
$ pandoc input.csv -t markdown -o output.md
theres a python package called csvtomd
pip install csvtomd
$ csvtomd input.csv > output.md