nvim: Add csvview for tablelike csv files
Gives a very nice viewing and editing experience for csv files. Not sure what the performance impact is for bigger files, but certainly is worth it for the smaller ones. Automatically switches on the view for `.csv` and `.tsv` files. Additionally, adds some keymaps whenever a csv-like file is loaded (i.e. when the `CsvViewEnable` mode is on): <s-j> and <s-k> to traverse up and down rows, <s-l> and <s-k> to traverse columns left and right. Adds a 'field' textobject (`if` and `af`), though only a single field can currently be changed at once.
This commit is contained in:
parent
8b2f9b6815
commit
b7d2fdea3d
4 changed files with 29 additions and 0 deletions
4
nvim/.config/nvim/after/ftplugin/csv.lua
Normal file
4
nvim/.config/nvim/after/ftplugin/csv.lua
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
-- turn on a nice table view if we have it
|
||||
if require("core.util").is_available("csvview") then
|
||||
require("csvview").enable()
|
||||
end
|
||||
4
nvim/.config/nvim/after/ftplugin/tsv.lua
Normal file
4
nvim/.config/nvim/after/ftplugin/tsv.lua
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
-- turn on a nice table view if we have it
|
||||
if require("core.util").is_available("csvview") then
|
||||
require("csvview").enable()
|
||||
end
|
||||
|
|
@ -16,6 +16,7 @@
|
|||
"conform.nvim": { "branch": "master", "commit": "a6f5bdb78caa305496357d17e962bbc4c0b392e2" },
|
||||
"copilot-lualine": { "branch": "main", "commit": "6bc29ba1fcf8f0f9ba1f0eacec2f178d9be49333" },
|
||||
"copilot.lua": { "branch": "master", "commit": "c1bb86abbed1a52a11ab3944ef00c8410520543d" },
|
||||
"csvview.nvim": { "branch": "main", "commit": "a4c45eadb03a462a80dd1a545d0f9cb636b73664" },
|
||||
"dial.nvim": { "branch": "master", "commit": "2c7e2750372918f072a20f3cf754d845e143d7c9" },
|
||||
"dressing.nvim": { "branch": "master", "commit": "3a45525bb182730fe462325c99395529308f431e" },
|
||||
"fidget.nvim": { "branch": "main", "commit": "b61e8af9b8b68ee0ec7da5fb7a8c203aae854f2e" },
|
||||
|
|
|
|||
|
|
@ -1,4 +1,24 @@
|
|||
return {
|
||||
{
|
||||
-- pretty table-view and movement for CSV-like files
|
||||
"hat0uma/csvview.nvim",
|
||||
opts = {
|
||||
view = {
|
||||
display_mode = "border",
|
||||
spacing = 1,
|
||||
},
|
||||
keymaps = {
|
||||
jump_next_field_end = { "<S-l>", mode = { "n", "v" } },
|
||||
jump_prev_field_end = { "<S-h>", mode = { "n", "v" } },
|
||||
jump_next_row = { "<S-j>", mode = { "n", "v" } },
|
||||
jump_prev_row = { "<S-k>", mode = { "n", "v" } },
|
||||
textobject_field_inner = { "if", mode = { "o", "x" } },
|
||||
textobject_field_outer = { "af", mode = { "o", "x" } },
|
||||
},
|
||||
},
|
||||
cmd = { "CsvViewEnable", "CsvViewDisable", "CsvViewToggle" },
|
||||
ft = { "csv", "tsv", "dsv", "psv", "ssv", "scsv" },
|
||||
},
|
||||
{
|
||||
"jmbuhr/otter.nvim",
|
||||
config = function()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue