Skip to content

Commit

Permalink
🐛 Fix highlight of git blame
Browse files Browse the repository at this point in the history
  • Loading branch information
Nguyen-Hoang-Nam committed Feb 25, 2022
1 parent 0d9fca9 commit bed01f7
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 3 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ _Kitty with Fira, Cascadia, and Mini-File-Icons_
| React | 👍👍 | 👍 | 👍 | | | |
| Rust | 👍 | 👍 | 👍 | | | 👍 |
| Scala | | 👍 | | | | |
| Solidity | | | | | | |
| Solidity | 👍 | | | | | |
| Svelte | 👍👍 | 👍 | 👍 | | | |
| Tex | 👍 | 👍 | 👍 | | | |
| TOML | | 👍 | | | | |
Expand Down Expand Up @@ -350,7 +350,7 @@ store in `~/.local/share/nvim/site/pack/*/start/`.
| [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter) | Feb 24 2022 |
| [nvim-ts-autotag](https://github.com/windwp/nvim-ts-autotag) | Feb 22 2022 |
| [nvim-ts-context-commentstring](https://github.com/JoosepAlviste/nvim-ts-context-commentstring) | Dec 13 2021 |
| [nvim-ts-rainbow](https://github.com/p00f/nvim-ts-rainbow) | Feb 24 2022 |
| [nvim-ts-rainbow](https://github.com/p00f/nvim-ts-rainbow) | Feb 23 2022 |
| [plenary.nvim](https://github.com/nvim-lua/plenary.nvim) | Feb 19 2022 |
| [rest.nvim](https://github.com/NTBBloodbath/rest.nvim) | Jan 26 2022 |
| [tabout.nvim](https://github.com/abecodes/tabout.nvim) | Dec 15 2021 |
Expand Down
8 changes: 8 additions & 0 deletions after/ftplugin/solidity.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
vim.opt.indentexpr = 'nvim_treesitter#indent()'

require('cmp').setup.buffer({
sources = {
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
},
})
1 change: 1 addition & 0 deletions lua/autocommands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ augroup Config
autocmd InsertLeave * set cursorline
autocmd! BufEnter * if &ft ==# 'help' | wincmd L | endif
autocmd bufenter * if (winnr("$") == 2 && &filetype == "Yanil") | q | endif
autocmd BufNewFile,BufRead *.sol set filetype=solidity
augroup END
]],
true
Expand Down
1 change: 1 addition & 0 deletions lua/highlights.lua
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ highlight({
GitSignsAdd = { guifg = base0B, guibg = colors.background },
GitSignsChange = { guifg = base0D, guibg = colors.background },
GitSignsDelete = { guifg = base08, guibg = colors.background },
GitSignsCurrentLineBlame = { guifg = colors.comment },

TroubleNormal = { guibg = colors.dark_background },

Expand Down
1 change: 1 addition & 0 deletions lua/languages/languages.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ return {
php = require('languages.php'),
python = require('languages.python'),
rust = require('languages.rust'),
solidity = require('languages.solidity'),
svelte = require('languages.svelte'),
tex = require('languages.tex'),
typescript = require('languages.javascript'),
Expand Down
22 changes: 22 additions & 0 deletions lua/languages/solidity.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
local lsp = require('languages.lsp')
local M = {}

M.efm = {
{
formatCommand = 'prettier --tab-width=4 --use-tabs=false --stdin-filepath ${INPUT}',
formatStdin = true,
},
}

M.all_format = { efm = 'Prettier' }

M.default_format = 'efm'

M.lsp_server = 'solidity_ls'

M.lsp = {
capabilities = lsp.capabilities,
on_attach = lsp.on_attach,
}

return M
1 change: 1 addition & 0 deletions lua/settings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ return {
'php',
'python',
'rust',
'solidity',
'svelte',
'tex',
'xml',
Expand Down
11 changes: 10 additions & 1 deletion lua/utils/lightbulb.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,18 @@ local function _update_sign(new_line)
end
end

local function has_code_action()
local filetype = vim.bo.filetype
if filetype ~= 'cmake' and filetype ~= 'gitcommit' and filetype ~= 'solidity' then
return true
end

return false
end

-- Credit https://github.com/kosayoda/nvim-lightbulb/blob/master/lua/nvim-lightbulb.lua
function M.code_action()
if vim.bo.filetype ~= 'cmake' and vim.bo.filetype ~= 'gitcommit' then
if has_code_action() then
local context = { diagnostics = lsp.diagnostic.get_line_diagnostics() }
local params = lsp.util.make_range_params()

Expand Down

0 comments on commit bed01f7

Please sign in to comment.