@@ -3,27 +3,27 @@ local api = vim.api
33local M = {
44 winid = nil ,
55 buf = nil ,
6- mainwindowbuf = nil
6+ mainwindowbuf = nil ,
77}
88function M .NewWindow ()
99 if M .winid == nil then
1010 M .mainwindowbuf = vim .api .nvim_get_current_buf ()
1111 local file = vim .api .nvim_buf_get_name (0 )
12- local f = io.open (file ," r" )
12+ local f = io.open (file , " r" )
1313
1414 local messages = f :read ()
1515 if messages == nil then
1616 return
1717 end
1818 f :close ()
19- messages = messages :gsub (" %," ," |" )
19+ messages = messages :gsub (" %," , " |" )
2020 local buf = api .nvim_create_buf (false , true ) -- create new emtpy buffer
21- vim .cmd [[ sview]]
21+ vim .cmd ( [[ sview]] )
2222 api .nvim_win_set_height (0 , 1 )
2323 local win = vim .api .nvim_get_current_win ()
2424 api .nvim_buf_set_lines (buf , 0 , - 1 , false , { messages })
25- api .nvim_win_set_buf (win ,buf )
26- require (" csvtools.topbarhighlight" ).hightlight (buf ,messages )
25+ api .nvim_win_set_buf (win , buf )
26+ require (" csvtools.topbarhighlight" ).hightlight (buf , messages )
2727 -- api.nvim_buf_add_highlight(buf, -1, 'WhidHeader',0,0,1)
2828 -- api.nvim_buf_add_highlight(buf, -1, 'WhidSubHeader', 0, 1, 2)
2929 M .winid = win
@@ -32,8 +32,8 @@ function M.NewWindow()
3232 end
3333end
3434function M .CloseWindow ()
35- if M .winid ~= nil then
36- vim .api .nvim_win_close (M .winid ,true )
35+ if M .winid ~= nil then
36+ vim .api .nvim_win_close (M .winid , true )
3737 M .winid = nil
3838 M .buf = nil
3939 end
@@ -47,6 +47,6 @@ function M.add_mappings()
4747 vim .api .nvim_buf_set_keymap (M .mainwindowbuf , " n" , " <leader>td" , " :lua require'csvtools'.CloseWindow()<cr>" , opts )
4848end
4949function M .setup (opts )
50- M = vim .tbl_deep_extend (" force" ,M , opts )
50+ M = vim .tbl_deep_extend (" force" , M , opts )
5151end
5252return M
0 commit comments