How to hide the line number in the left margin? #331
Replies: 3 comments 1 reply
-
Try `view.margin_width_n[1] = 0`. The line number margin is first,
followed by the marker margin (bookmarks and such), and then the fold
margin. The last two margins are hidden (they already have a default
width of 0).
https://orbitalquark.github.io/textadept/api.html#view.margin_width_n
|
Beta Was this translation helpful? Give feedback.
1 reply
-
Oh, sorry about that. If you want this to be a more permanent setting
(vs. using the command entry), you'll have to set it in a function
connected to `events.BUFFER_NEW` and `events.VIEW_NEW` in your
*~/.textadept/init.lua*:
local function hide_line_numbers() view.margin_width_n[1] = 0 end
events.connect(events.BUFFER_NEW, hide_line_numbers)
events.connect(events.VIEW_NEW, hide_line_numbers)
Textadept's own *init.lua* does the same, so you need to override it:
https://github.com/orbitalquark/textadept/blob/3bc82b2eca020c97abbee2fd3edf6f24f56c864e/init.lua#L162-L168
|
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
amitbha
-
local function toogle_line_number()
if view.margin_width_n[1] > 0 then
view.margin_width_n[1] = 0
else
view.margin_width_n[1] = math.max(4, #tostring(buffer.line_count)) * view:text_width(view.STYLE_LINENUMBER, '9') + (not CURSES and 4 or 0)
end
end |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
While taking a new markdown note, the left margin width takes 5 pixels, too wide to be unpleasant.
How to hide the line number? but keep the fold function.
view.margins = 2
does not work.Beta Was this translation helpful? Give feedback.
All reactions