nvim/plugins: add nvim-gps

This commit is contained in:
Hoang Nguyen 2021-11-07 14:18:49 +07:00
parent 041f076d07
commit 0c8cb81326
No known key found for this signature in database
GPG Key ID: 813CF484F4993419
6 changed files with 93 additions and 22 deletions

View File

@ -3,4 +3,5 @@ user_name: FollieHiyuki
user_email: folliekazetani@protonmail.com
term_font: Iosevka Nerd Font
cjk_font: Sarasa Mono J
font_size: 14
theme: nord

View File

@ -44,7 +44,7 @@ font:
family: {{ term_font }}
style: Bold Italic
size: 14
size: {{ font_size }}
offset:
x: 0

View File

@ -525,12 +525,6 @@ function M.sqls_conf()
}
end
function M.lightbulb_conf()
vim.api.nvim_command [[
autocmd CursorHold * lua require('nvim-lightbulb').update_lightbulb({sign = {enabled = false}, status_text = {enabled = true, text = ' Code action', text_unavailable = ''}})
]]
end
function M.trouble_conf()
require('trouble').setup {
mode = 'lsp_workspace_diagnostics',

View File

@ -134,6 +134,8 @@ function M.statusline_conf()
end
local vi_mode_utils = require('feline.providers.vi_mode')
local lightbulb_present, lightbulb = pcall(require, 'nvim-lightbulb')
local gps_present, gps = pcall(require, 'nvim-gps')
local comps = {
dummy = {
@ -178,16 +180,27 @@ function M.statusline_conf()
percent = {
provider = 'line_percentage',
hl = {fg = colors.fg, style = 'bold'},
right_sep = ' '
right_sep = ' '
},
gps = {
provider = function()
return gps.get_location()
end,
enabled = function()
if gps_present then
return gps.is_available()
else
return false
end
end,
hl = {fg = colors.cyan}
},
codeact = {
provider = function()
local present, state = pcall(require, 'nvim-lightbulb')
if present then
return state.get_status_text()
else
return ''
end
return lightbulb.get_status_text()
end,
enabled = function()
return lightbulb_present
end,
hl = {fg = colors.green, style = 'bold'}
},
@ -280,6 +293,7 @@ function M.statusline_conf()
table.insert(components.active[1], comps.fileinfo)
table.insert(components.active[1], comps.lineinfo)
table.insert(components.active[1], comps.percent)
table.insert(components.active[1], comps.gps)
table.insert(components.active[3], comps.codeact)
table.insert(components.active[3], comps.diagerr)
table.insert(components.active[3], comps.diagwarn)
@ -529,4 +543,25 @@ function M.gitsigns_conf()
}
end
function M.lightbulb_conf()
vim.api.nvim_command [[
autocmd CursorHold * lua require('nvim-lightbulb').update_lightbulb({sign = {enabled = false}, status_text = {enabled = true, text = ' Code action', text_unavailable = ''}})
]]
end
function M.gps_conf()
require('nvim-gps').setup {
icons = {
['class-name'] = '𝓒 ',
['function-name'] = 'ƒ ',
['method-name'] = '',
['container-name'] = '',
['tag-name'] = ''
},
separator = '',
depth = 0,
depth_limit_indicator = '..'
}
end
return M

View File

@ -49,6 +49,16 @@ local ui_plugins = function(use)
wants = 'plenary.nvim',
config = ui.gitsigns_conf
}
use {
'kosayoda/nvim-lightbulb',
after = 'nvim-lspconfig',
config = ui.lightbulb_conf
}
use {
'SmiteshP/nvim-gps',
after = 'nvim-treesitter',
config = ui.gps_conf
}
end
-- Editing-related plugins
@ -227,11 +237,6 @@ local lsp_plugins = function(use)
wants = 'nvim-lspconfig',
config = lsp.sqls_conf
}
use {
'kosayoda/nvim-lightbulb',
after = 'nvim-lspconfig',
config = lsp.lightbulb_conf
}
use {
'folke/trouble.nvim',
cmd = {'Trouble', 'TroubleToggle', 'TroubleRefresh'},

View File

@ -1,8 +1,26 @@
---
{% if theme == 'nord' %}
# Terminal colors
foreground: '#d8dee9'
# Colors for theming
background: '#2e3440'
foreground: '#d8dee9'
grey1: '#3b4252'
grey2: '#434c5e'
grey3: '#4c566a'
grey_bright: '#616e88'
white1: '#e5e9f0'
white2: '#eceff4'
teal: '#8fbcbb'
cyan: '#88c0d0'
blue: '#81a1c1'
dark_blue: '#5e81ac'
red: '#bf616a'
orange: '#d08770'
yellow: '#ebcb8b'
green: '#a3be8c'
purple: '#b48ead'
highlight: '#7b88a1'
# Terminal 16 colors
color0: '#3b4252'
color1: '#bf616a'
color2: '#a3be8c'
@ -20,9 +38,27 @@ color13: '#b48ead'
color14: '#8fbcbb'
color15: '#eceff4'
{% elif theme == 'onedark' %}
# Terminal colors
# Colors for theming
foreground: '#abb2bf'
background: '#282c34'
grey1: '#3e4452'
grey2: '#4b5263'
grey3: '#5c6470'
grey_bright: '#73797e'
white1: '#bbc2cf'
white2: '#dfdfdf'
teal: '#5699af'
cyan: '#56b6c2'
blue: '#61afef'
dark_blue: '#2257a0'
red: '#e06c75'
orange: '#d19a66'
yellow: '#e5c07b'
green: '#98c379'
purple: '#c678dd'
highlight: '#9ca0a4'
# Terminal 16 colors
color0: '#3e4452'
color1: '#be5046'
color2: '#98c379'