Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

vim get color name at cursor

# Returns the foreground color ID of the character at cursor. 
# Replace "fg" with "bg" to get the background color.

:echo synIDattr(synIDtrans(synID(line("."), col("."), 1)), "fg")

#============================== SIDE-NOTE ===============================
# You can "alias" it in your vimrc for simpler use in the future like so:

cnoreabbrev GetFgColor echo synIDattr(synIDtrans(synID(line("."), 
		 col("."), 1)), "fg")
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #vim #color #cursor
ADD COMMENT
Topic
Name
1+1 =