1- local U = require (" FTerm.config" )
1+ local U = require (' FTerm.config' )
22local api = vim .api
33local fn = vim .fn
44local cmd = api .nvim_command
55
66local Terminal = {
77 au_close = {},
8- au_resize = {}
8+ au_resize = {},
99}
1010
1111-- Init
1212function Terminal :new ()
1313 local state = {
1414 win = nil ,
1515 buf = nil ,
16- terminal = nil
16+ terminal = nil ,
1717 }
1818
1919 self .__index = self
@@ -84,7 +84,7 @@ function Terminal:win_dim()
8484 width = width ,
8585 height = height ,
8686 col = col ,
87- row = row
87+ row = row ,
8888 }
8989end
9090
@@ -104,26 +104,21 @@ end
104104function Terminal :create_win (buf )
105105 local dim = self .dims
106106
107- local win =
108- api .nvim_open_win (
109- buf ,
110- true ,
111- {
112- border = self .config .border ,
113- relative = " editor" ,
114- style = " minimal" ,
115- width = dim .width ,
116- height = dim .height ,
117- col = dim .col ,
118- row = dim .row
119- }
120- )
121-
122- api .nvim_win_set_option (win , " winhl" , " Normal:Normal" )
107+ local win = api .nvim_open_win (buf , true , {
108+ border = self .config .border ,
109+ relative = ' editor' ,
110+ style = ' minimal' ,
111+ width = dim .width ,
112+ height = dim .height ,
113+ col = dim .col ,
114+ row = dim .row ,
115+ })
116+
117+ api .nvim_win_set_option (win , ' winhl' , ' Normal:Normal' )
123118
124119 -- Setting filetype in `create_win()` instead of `create_buf()` because window options
125120 -- such as `winhl`, `winblend` should be available after the window is created.
126- api .nvim_buf_set_option (buf , " filetype" , " FTerm" )
121+ api .nvim_buf_set_option (buf , ' filetype' , ' FTerm' )
127122
128123 return win
129124end
@@ -148,7 +143,7 @@ function Terminal:term()
148143 cmd (" autocmd! TermClose <buffer> lua require('FTerm.terminal').au_close['" .. self .au_key .. " ']()" )
149144 end
150145
151- cmd (" startinsert" )
146+ cmd (' startinsert' )
152147end
153148
154149-- Terminal:open does all the magic of opening terminal
@@ -179,7 +174,7 @@ function Terminal:close(force)
179174
180175 if force then
181176 if api .nvim_buf_is_loaded (self .buf ) then
182- api .nvim_buf_delete (self .buf , {force = true })
177+ api .nvim_buf_delete (self .buf , { force = true })
183178 end
184179
185180 fn .jobstop (self .terminal )
0 commit comments