mv from dotfiles
This commit is contained in:
commit
e8169ca91c
19
init.lua
Normal file
19
init.lua
Normal file
@ -0,0 +1,19 @@
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
vim.fn.system({
|
||||
"git",
|
||||
"clone",
|
||||
"--filter=blob:none",
|
||||
"--single-branch",
|
||||
"https://github.com/folke/lazy.nvim.git",
|
||||
lazypath,
|
||||
})
|
||||
end
|
||||
vim.opt.runtimepath:prepend(lazypath)
|
||||
|
||||
require 'config.settings'
|
||||
require 'config.lazy'
|
||||
require 'config.mappings'
|
||||
require 'config.autocmd'
|
||||
|
||||
vim.cmd 'colorscheme tokyonight'
|
32
lazy-lock.json
Normal file
32
lazy-lock.json
Normal file
@ -0,0 +1,32 @@
|
||||
{
|
||||
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
||||
"cmp-cmdline": { "branch": "main", "commit": "23c51b2a3c00f6abc4e922dbd7c3b9aca6992063" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "59224771f91b86d1de12570b4070fe4ad7cd1eeb" },
|
||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||
"cmp-snippy": { "branch": "master", "commit": "9af1635fe40385ffa3dabf322039cb5ae1fd7d35" },
|
||||
"feline.nvim": { "branch": "master", "commit": "d48b6f92c6ccdd6654c956f437be49ea160b5b0c" },
|
||||
"hop.nvim": { "branch": "master", "commit": "90db1b2c61b820e230599a04fedcd2679e64bd07" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "8d452e37bbf16cfd8841cca4286c2b0f7c8db669" },
|
||||
"lazygit.nvim": { "branch": "main", "commit": "32bffdebe273e571588f25c8a708ca7297928617" },
|
||||
"lsp": { "branch": "master", "commit": "9c73b57ed03ad0a906e2cdc2fc348bf86ae53e3a" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "698713735933a5891080fc3d87a687f90b9d2aee" },
|
||||
"mason.nvim": { "branch": "main", "commit": "1592493e3406c271e9128b4d424731e25f1ff2a1" },
|
||||
"mini.nvim": { "branch": "main", "commit": "06eddfd8d6341e6c4f53ec9ae109a376a566329d" },
|
||||
"null-ls.nvim": { "branch": "main", "commit": "647a1eeeefc43ce15d941972642210637c370471" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "03580d758231956d33c8dd91e2be195106a79fa4" },
|
||||
"nvim-bqf": { "branch": "main", "commit": "b418b0a241d36509196944a6f6bee886c775d54f" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "e55033fce468c9c578b946948807f2ac48a6ee08" },
|
||||
"nvim-colorizer.lua": { "branch": "master", "commit": "36c610a9717cc9ec426a07c8e6bf3b3abcb139d6" },
|
||||
"nvim-snippy": { "branch": "master", "commit": "47def62945611212a242657cc414dac91ca0453a" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "ee3e9f4dc0e5ee9e2bfb1ee47638375840b8fe0f" },
|
||||
"nvim-ts-context-commentstring": { "branch": "main", "commit": "32d9627123321db65a4f158b72b757bcaef1a3f4" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "05e1072f63f6c194ac6e867b567e6b437d3d4622" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "4b7e52044bbb84242158d977a50c4cbcd85070c7" },
|
||||
"telescope-file-browser.nvim": { "branch": "master", "commit": "eb4f026735f781ea5749331a5059021328d6eee8" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "a606bd10c79ec5989c76c49cc6f736e88b63f0da" },
|
||||
"toggleterm.nvim": { "branch": "main", "commit": "b02a1674bd0010d7982b056fd3df4f717ff8a57a" },
|
||||
"tokyonight.nvim": { "branch": "main", "commit": "8a619f0cf3ed9051081d9fc0cd4f852a7355f546" },
|
||||
"trouble.nvim": { "branch": "main", "commit": "897542f90050c3230856bc6e45de58b94c700bbf" },
|
||||
"vim-snippets": { "branch": "master", "commit": "8c917944354552c1263159a4a218ad924969be0c" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "8682d3003595017cd8ffb4c860a07576647cc6f8" }
|
||||
}
|
45
lua/config/autocmd.lua
Normal file
45
lua/config/autocmd.lua
Normal file
@ -0,0 +1,45 @@
|
||||
-- Use 'q' to quit from common plugins
|
||||
vim.api.nvim_create_autocmd({ 'FileType' }, {
|
||||
pattern = { 'qf', 'help', 'man', 'lspinfo', 'spectre_panel', 'lir' },
|
||||
callback = function()
|
||||
vim.cmd [[
|
||||
nnoremap <silent> <buffer> q :close<CR>
|
||||
set nobuflisted
|
||||
]]
|
||||
end,
|
||||
})
|
||||
|
||||
-- use 2 spaces for cpp
|
||||
vim.api.nvim_create_autocmd({ 'FileType' }, {
|
||||
pattern = { 'cpp', 'cc', 'hpp', 'hh', 'md', 'markdown' },
|
||||
callback = function()
|
||||
vim.opt.ts = 2
|
||||
vim.opt.sw = 2
|
||||
vim.opt.expandtab = true
|
||||
end,
|
||||
})
|
||||
|
||||
vim.cmd "autocmd BufEnter * ++nested if winnr('$') == 1 && bufname() == 'NvimTree_' . tabpagenr() | quit | endif"
|
||||
|
||||
-- Fixes Autocomment
|
||||
vim.api.nvim_create_autocmd({ 'BufWinEnter' }, {
|
||||
callback = function()
|
||||
vim.cmd 'set formatoptions-=cro'
|
||||
end,
|
||||
})
|
||||
|
||||
-- Highlight Yanked Text
|
||||
vim.api.nvim_create_autocmd({ 'TextYankPost' }, {
|
||||
callback = function()
|
||||
vim.highlight.on_yank { higroup = 'Visual', timeout = 200 }
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_augroup('diagnostics', { clear = true })
|
||||
|
||||
vim.api.nvim_create_autocmd({ 'DiagnosticChanged' }, {
|
||||
group = 'diagnostics',
|
||||
callback = function()
|
||||
vim.diagnostic.setloclist { open = false }
|
||||
end,
|
||||
})
|
31
lua/config/lazy.lua
Normal file
31
lua/config/lazy.lua
Normal file
@ -0,0 +1,31 @@
|
||||
require("lazy").setup("config.plugins",
|
||||
{
|
||||
defaults = { lazy = true },
|
||||
checker = { enabled = false },
|
||||
diff = {
|
||||
cmd = "terminal_git",
|
||||
},
|
||||
change_detection = {
|
||||
enabled = false
|
||||
},
|
||||
performance = {
|
||||
cache = {
|
||||
enabled = true,
|
||||
-- disable_events = {},
|
||||
},
|
||||
rtp = {
|
||||
disabled_plugins = {
|
||||
"gzip",
|
||||
"matchit",
|
||||
-- "matchparen",
|
||||
"netrwPlugin",
|
||||
"tarPlugin",
|
||||
"tohtml",
|
||||
"tutor",
|
||||
"zipPlugin",
|
||||
"nvim-treesitter-textobjects",
|
||||
},
|
||||
},
|
||||
},
|
||||
debug = false,
|
||||
})
|
95
lua/config/mappings.lua
Normal file
95
lua/config/mappings.lua
Normal file
@ -0,0 +1,95 @@
|
||||
-- Set leader {{{
|
||||
vim.api.nvim_set_keymap('n', '<Space>', '<NOP>', { noremap = true, silent = true })
|
||||
vim.g.mapleader = ' '
|
||||
-- }}}
|
||||
-- resize {{{
|
||||
vim.api.nvim_set_keymap('n', '<c-up>', '<cmd>resize -2<cr>', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('n', '<c-down>', '<cmd>resize +2<cr>', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('n', '<c-left>', '<cmd>vertical resize -2<cr>', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('n', '<c-right>', '<cmd>vertical resize -2<cr>', { noremap = true, silent = true })
|
||||
-- }}}
|
||||
-- indent {{{
|
||||
vim.api.nvim_set_keymap('v', '<', '<gv', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('v', '>', '>gv', { noremap = true, silent = true })
|
||||
-- }}}
|
||||
-- open/close folds with enter key {{{
|
||||
vim.api.nvim_set_keymap('n', '<cr>', "@=(foldlevel('.')?'za':\"<Space>\")<CR>", { noremap = true, silent = true })
|
||||
-- }}}
|
||||
-- terminal {{{
|
||||
vim.api.nvim_set_keymap('n', '<home>', '<cmd>ToggleTerm<cr>', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('t', '<home>', '<cmd>ToggleTerm<cr>', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('v', '<home>', '<cmd>ToggleTerm<cr>', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('i', '<home>', '<cmd>ToggleTerm<cr>', { noremap = true, silent = true })
|
||||
-- }}}
|
||||
-- misc {{{
|
||||
vim.api.nvim_set_keymap('n', '<c-space>', '<cmd>nohlsearch<cr>', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('v', '<C-p>', '"_dp', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('x', 'E', ":move '<-2<cr>gv-gv", { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('x', 'N', ":move '>+1<cr>gv-gv", { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('n', '<c-\\>', 'z=1<cr><cr>', { noremap = true, silent = true })
|
||||
-- vim.api.nvim_set_keymap(
|
||||
-- 'n',
|
||||
-- '<leader>lf',
|
||||
-- '<cmd>lua vim.lsp.buf.format { async = true }<cr>',
|
||||
-- { noremap = true, silent = true }
|
||||
-- )
|
||||
|
||||
-- }}}
|
||||
-- vim.api.nvim_set_keymap("n", "", "<cmd><cr>", { noremap = true, silent = true })
|
||||
|
||||
vim.api.nvim_set_keymap('n', '<BS>', ':', { noremap = true })
|
||||
-- vim.api.nvim_set_keymap('n', ';', ':', { noremap = true })
|
||||
vim.api.nvim_set_keymap('n', '<leader>rs', ':s///gI<Left><Left><Left><Left><Left><Left>', { noremap = true })
|
||||
vim.api.nvim_set_keymap('n', '<leader>rr', ':%s///gI<Left><Left><Left><Left>', { noremap = true })
|
||||
vim.api.nvim_set_keymap('v', '<leader>r', ':s///gI<Left><Left><Left><Left>', { noremap = true })
|
||||
|
||||
vim.api.nvim_set_keymap('n', '<leader>xl', '<cmd>TroubleToggle loclist<cr>', { silent = true, noremap = true })
|
||||
vim.api.nvim_set_keymap('n', '<leader>xq', '<cmd>TroubleToggle quickfix<cr>', { silent = true, noremap = true })
|
||||
vim.api.nvim_set_keymap('n', 'gR', '<cmd>TroubleToggle lsp_references<cr>', { silent = true, noremap = true })
|
||||
vim.api.nvim_set_keymap('n', '<leader>xx', '<cmd>TroubleToggle<cr>', { silent = true, noremap = true })
|
||||
vim.api.nvim_set_keymap(
|
||||
'n',
|
||||
'<leader>xw',
|
||||
'<cmd>TroubleToggle workspace_diagnostics<cr>',
|
||||
{ silent = true, noremap = true }
|
||||
)
|
||||
vim.api.nvim_set_keymap(
|
||||
'n',
|
||||
'<leader>xd',
|
||||
'<cmd>TroubleToggle document_diagnostics<cr>',
|
||||
{ silent = true, noremap = true }
|
||||
)
|
||||
|
||||
function MapDHM()
|
||||
vim.api.nvim_set_keymap('n', 'i', 'l', { noremap = true })
|
||||
vim.api.nvim_set_keymap('n', 'n', 'j', { noremap = true })
|
||||
vim.api.nvim_set_keymap('n', 'e', 'k', { noremap = true })
|
||||
vim.api.nvim_set_keymap('v', 'i', 'l', { noremap = true })
|
||||
vim.api.nvim_set_keymap('v', 'n', 'j', { noremap = true })
|
||||
vim.api.nvim_set_keymap('v', 'e', 'k', { noremap = true })
|
||||
vim.api.nvim_set_keymap('n', 'l', 'i', { noremap = true })
|
||||
vim.api.nvim_set_keymap('n', 'N', 'J', { noremap = true })
|
||||
vim.api.nvim_set_keymap('n', 'j', 'n', { noremap = true })
|
||||
vim.api.nvim_set_keymap('n', 'J', 'N', { noremap = true })
|
||||
vim.api.nvim_set_keymap('n', '<nop>', 'I', { noremap = true })
|
||||
end
|
||||
|
||||
function UnMapDHM()
|
||||
vim.api.nvim_del_keymap('n', 'l')
|
||||
vim.api.nvim_del_keymap('n', 'j')
|
||||
vim.api.nvim_del_keymap('v', 'l')
|
||||
vim.api.nvim_del_keymap('v', 'j')
|
||||
vim.api.nvim_del_keymap('v', 'k')
|
||||
vim.api.nvim_del_keymap('n', 'i')
|
||||
vim.api.nvim_del_keymap('n', 'J')
|
||||
vim.api.nvim_del_keymap('n', 'n')
|
||||
vim.api.nvim_del_keymap('n', 'N')
|
||||
end
|
||||
|
||||
-- local handle = io.popen 'lsusb | grep -c Sofle'
|
||||
-- local automap = handle:read '*n'
|
||||
-- handle:close()
|
||||
|
||||
-- if os.getenv("SSH_TTY") then
|
||||
MapDHM()
|
||||
-- end
|
28
lua/config/plugins/autopairs.lua
Normal file
28
lua/config/plugins/autopairs.lua
Normal file
@ -0,0 +1,28 @@
|
||||
local M = {
|
||||
'windwp/nvim-autopairs',
|
||||
event = 'InsertEnter'
|
||||
}
|
||||
|
||||
function M.config()
|
||||
local npairs = require 'nvim-autopairs'
|
||||
|
||||
npairs.setup {
|
||||
check_ts = true, -- treesitter integration
|
||||
fast_wrap = {
|
||||
map = '<C-e>',
|
||||
highlight = 'Search',
|
||||
highlight_grey = 'Comment',
|
||||
},
|
||||
map_c_w = true,
|
||||
-- disable_filetype = { "TelescopePrompt" },
|
||||
}
|
||||
|
||||
local cmp_autopairs = require 'nvim-autopairs.completion.cmp'
|
||||
local cmp_status_ok, cmp = pcall(require, 'cmp')
|
||||
if not cmp_status_ok then
|
||||
return
|
||||
end
|
||||
cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done {})
|
||||
end
|
||||
|
||||
return M
|
189
lua/config/plugins/cmp.lua
Normal file
189
lua/config/plugins/cmp.lua
Normal file
@ -0,0 +1,189 @@
|
||||
local M = {
|
||||
'hrsh7th/nvim-cmp',
|
||||
lazy = false,
|
||||
dependencies = {
|
||||
'hrsh7th/cmp-nvim-lsp',
|
||||
'hrsh7th/cmp-buffer',
|
||||
'hrsh7th/cmp-cmdline',
|
||||
'hrsh7th/cmp-path',
|
||||
},
|
||||
}
|
||||
|
||||
function M.config()
|
||||
local cmp = require 'cmp'
|
||||
local snippy = require 'snippy'
|
||||
|
||||
local ELLIPSIS_CHAR = '…'
|
||||
local MAX_LABEL_WIDTH = 20
|
||||
|
||||
--[[ local winhighlight = 'NormalFloat:Pmenu,NormalFloat:Pmenu,CursorLine:PmenuSel,Search:None' ]]
|
||||
|
||||
local has_words_before = function()
|
||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match '%s' == nil
|
||||
end
|
||||
|
||||
cmp.setup {
|
||||
view = {
|
||||
entries = {
|
||||
name = 'custom', -- can be "custom", "wildmenu" or "native"
|
||||
-- separator = ' | ',
|
||||
},
|
||||
},
|
||||
completion = {
|
||||
autocomplete = false,
|
||||
},
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require('snippy').expand_snippet(args.body)
|
||||
end,
|
||||
},
|
||||
window = {
|
||||
--[[ completion = {
|
||||
border = 'rounded',
|
||||
winhighlight = winhighlight,
|
||||
},
|
||||
documentation = {
|
||||
border = 'rounded',
|
||||
winhighlight = winhighlight,
|
||||
}, ]]
|
||||
completion = cmp.config.window.bordered(),
|
||||
documentation = cmp.config.window.bordered(),
|
||||
},
|
||||
experimental = {
|
||||
ghost_text = true,
|
||||
},
|
||||
formatting = {
|
||||
fields = { 'menu', 'abbr', 'kind' },
|
||||
format = function(entry, item)
|
||||
local menu_icon = {
|
||||
nvim_lsp = 'λ',
|
||||
snippy = '⋗',
|
||||
buffer = 'Ω',
|
||||
path = '🖫',
|
||||
}
|
||||
|
||||
item.menu = menu_icon[entry.source.name]
|
||||
local label = item.abbr
|
||||
local truncated_label = vim.fn.strcharpart(label, 0, MAX_LABEL_WIDTH)
|
||||
if truncated_label ~= label then
|
||||
item.abbr = truncated_label .. ELLIPSIS_CHAR
|
||||
end
|
||||
return item
|
||||
end,
|
||||
},
|
||||
mapping = {
|
||||
['<C-k>'] = cmp.mapping.select_prev_item(),
|
||||
['<C-j>'] = cmp.mapping.select_next_item(),
|
||||
['<C-b>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }),
|
||||
['<C-f>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }),
|
||||
['<C-Space>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }),
|
||||
['<C-e>'] = cmp.mapping {
|
||||
i = cmp.mapping.abort(),
|
||||
c = cmp.mapping.close(),
|
||||
},
|
||||
['<CR>'] = cmp.mapping.confirm { select = true },
|
||||
['<Tab>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item { behavior = cmp.SelectBehavior.Insert }
|
||||
elseif snippy.can_expand_or_advance() then
|
||||
snippy.expand_or_advance()
|
||||
elseif has_words_before() then
|
||||
cmp.complete()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { 'i', 'c', 's' }),
|
||||
|
||||
['<S-Tab>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item { behavior = cmp.SelectBehavior.Insert }
|
||||
elseif snippy.can_jump(-1) then
|
||||
snippy.previous()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { 'i', 's', 'c' }),
|
||||
},
|
||||
sources = cmp.config.sources {
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'snippy' },
|
||||
{ name = 'buffer' },
|
||||
{ name = 'path' },
|
||||
},
|
||||
}
|
||||
|
||||
cmp.setup.cmdline(':', {
|
||||
completion = { autocomplete = true },
|
||||
mapping = {
|
||||
['<TAB>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item { behavior = cmp.SelectBehavior.Insert }
|
||||
else
|
||||
cmp.complete()
|
||||
cmp.select_next_item { behavior = cmp.SelectBehavior.Insert }
|
||||
end
|
||||
end, { 'i', 's', 'c' }),
|
||||
['<S-TAB>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item { behavior = cmp.SelectBehavior.Insert }
|
||||
else
|
||||
cmp.complete()
|
||||
end
|
||||
end, { 'i', 's', 'c' }),
|
||||
['<CR>'] = cmp.mapping { i = cmp.mapping.confirm { select = true } },
|
||||
},
|
||||
sources = {
|
||||
{ name = 'cmdline' },
|
||||
{ name = 'path' },
|
||||
},
|
||||
view = {
|
||||
entries = { name = 'wildmenu', separator = ' · ' },
|
||||
},
|
||||
})
|
||||
|
||||
cmp.setup.cmdline('/', {
|
||||
completion = { autocomplete = true },
|
||||
sources = {
|
||||
{
|
||||
name = 'buffer',
|
||||
},
|
||||
},
|
||||
view = {
|
||||
entries = { name = 'wildmenu', separator = ' · ' },
|
||||
},
|
||||
})
|
||||
|
||||
local config = {
|
||||
virtual_text = true,
|
||||
signs = false,
|
||||
underline = true,
|
||||
update_in_insert = true,
|
||||
severity_sort = true,
|
||||
float = {
|
||||
focusable = true,
|
||||
style = 'minimal',
|
||||
border = 'rounded',
|
||||
source = 'always',
|
||||
header = '',
|
||||
prefix = '',
|
||||
},
|
||||
}
|
||||
vim.diagnostic.config(config)
|
||||
|
||||
vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(vim.lsp.handlers.hover, {
|
||||
border = 'rounded',
|
||||
})
|
||||
|
||||
vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with(vim.lsp.handlers.signature_help, {
|
||||
border = 'rounded',
|
||||
})
|
||||
|
||||
--[[ local on_references = vim.lsp.handlers['textDocument/references'] ]]
|
||||
--[[ vim.lsp.handlers['textDocument/references'] = vim.lsp.with(on_references, { ]]
|
||||
--[[ -- Use location list instead of quickfix list ]]
|
||||
--[[ loclist = true, ]]
|
||||
--[[ }) ]]
|
||||
end
|
||||
|
||||
return M
|
23
lua/config/plugins/colorizer.lua
Normal file
23
lua/config/plugins/colorizer.lua
Normal file
@ -0,0 +1,23 @@
|
||||
return {
|
||||
'NvChad/nvim-colorizer.lua',
|
||||
event = 'BufReadPre',
|
||||
config = {
|
||||
filetypes = { '*', '!lazy' },
|
||||
buftype = { '*', '!prompt', '!nofile' },
|
||||
user_default_options = {
|
||||
RGB = true, -- #RGB hex codes
|
||||
RRGGBB = true, -- #RRGGBB hex codes #ffffff
|
||||
names = false, -- "Name" codes like Blue
|
||||
RRGGBBAA = true, -- #RRGGBBAA hex codes
|
||||
AARRGGBB = false, -- 0xAARRGGBB hex codes
|
||||
rgb_fn = true, -- CSS rgb() and rgba() functions
|
||||
hsl_fn = true, -- CSS hsl() and hsla() functions
|
||||
css = false, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB
|
||||
css_fn = true, -- Enable all CSS *functions*: rgb_fn, hsl_fn
|
||||
-- Available modes: foreground, background
|
||||
-- Available modes for `mode`: foreground, background, virtualtext
|
||||
-- mode = "background", -- Set the display mode.
|
||||
-- virtualtext = "■",
|
||||
},
|
||||
},
|
||||
}
|
244
lua/config/plugins/feline.lua
Normal file
244
lua/config/plugins/feline.lua
Normal file
@ -0,0 +1,244 @@
|
||||
local M = {
|
||||
'feline-nvim/feline.nvim',
|
||||
-- lazy = false
|
||||
event = 'UIEnter',
|
||||
dependencies = {
|
||||
'nvim-tree/nvim-web-devicons',
|
||||
},
|
||||
}
|
||||
|
||||
function M.config()
|
||||
local feline = require 'feline'
|
||||
|
||||
local theme = {
|
||||
fg = '#abb2bf',
|
||||
bg = '#1e2024',
|
||||
green = '#98c379',
|
||||
yellow = '#e5c07b',
|
||||
purple = '#c678dd',
|
||||
orange = '#d19a66',
|
||||
peanut = '#f6d5a4',
|
||||
red = '#e06c75',
|
||||
aqua = '#61afef',
|
||||
darkblue = '#282c34',
|
||||
dark_red = '#f75f5f',
|
||||
}
|
||||
|
||||
local vi_mode_colors = {
|
||||
NORMAL = 'green',
|
||||
OP = 'green',
|
||||
INSERT = 'yellow',
|
||||
VISUAL = 'purple',
|
||||
LINES = 'orange',
|
||||
BLOCK = 'dark_red',
|
||||
REPLACE = 'red',
|
||||
COMMAND = 'aqua',
|
||||
}
|
||||
|
||||
local c = {
|
||||
vim_mode = {
|
||||
provider = {
|
||||
name = 'vi_mode',
|
||||
opts = {
|
||||
show_mode_name = true,
|
||||
-- padding = "center", -- Uncomment for extra padding.
|
||||
},
|
||||
},
|
||||
hl = function()
|
||||
return {
|
||||
fg = require('feline.providers.vi_mode').get_mode_color(),
|
||||
bg = 'darkblue',
|
||||
style = 'bold',
|
||||
name = 'NeovimModeHLColor',
|
||||
}
|
||||
end,
|
||||
left_sep = 'block',
|
||||
right_sep = 'block',
|
||||
},
|
||||
gitBranch = {
|
||||
provider = 'git_branch',
|
||||
hl = {
|
||||
fg = 'peanut',
|
||||
bg = 'darkblue',
|
||||
style = 'bold',
|
||||
},
|
||||
left_sep = 'block',
|
||||
right_sep = 'block',
|
||||
},
|
||||
gitDiffAdded = {
|
||||
provider = 'git_diff_added',
|
||||
hl = {
|
||||
fg = 'green',
|
||||
bg = 'darkblue',
|
||||
},
|
||||
left_sep = 'block',
|
||||
right_sep = 'block',
|
||||
},
|
||||
gitDiffRemoved = {
|
||||
provider = 'git_diff_removed',
|
||||
hl = {
|
||||
fg = 'red',
|
||||
bg = 'darkblue',
|
||||
},
|
||||
left_sep = 'block',
|
||||
right_sep = 'block',
|
||||
},
|
||||
gitDiffChanged = {
|
||||
provider = 'git_diff_changed',
|
||||
hl = {
|
||||
fg = 'fg',
|
||||
bg = 'darkblue',
|
||||
},
|
||||
left_sep = 'block',
|
||||
right_sep = 'right_filled',
|
||||
},
|
||||
separator = {
|
||||
provider = '',
|
||||
},
|
||||
fileinfo = {
|
||||
provider = {
|
||||
name = 'file_info',
|
||||
opts = {
|
||||
type = 'relative-short',
|
||||
},
|
||||
},
|
||||
hl = {
|
||||
style = 'bold',
|
||||
},
|
||||
left_sep = ' ',
|
||||
right_sep = ' ',
|
||||
},
|
||||
diagnostic_errors = {
|
||||
provider = 'diagnostic_errors',
|
||||
hl = {
|
||||
fg = 'red',
|
||||
},
|
||||
},
|
||||
diagnostic_warnings = {
|
||||
provider = 'diagnostic_warnings',
|
||||
hl = {
|
||||
fg = 'yellow',
|
||||
},
|
||||
},
|
||||
diagnostic_hints = {
|
||||
provider = 'diagnostic_hints',
|
||||
hl = {
|
||||
fg = 'aqua',
|
||||
},
|
||||
},
|
||||
diagnostic_info = {
|
||||
provider = 'diagnostic_info',
|
||||
},
|
||||
lsp_client_names = {
|
||||
provider = 'lsp_client_names',
|
||||
hl = {
|
||||
fg = 'purple',
|
||||
bg = 'darkblue',
|
||||
style = 'bold',
|
||||
},
|
||||
left_sep = 'left_filled',
|
||||
right_sep = 'right_filled',
|
||||
},
|
||||
file_type = {
|
||||
provider = {
|
||||
name = 'file_type',
|
||||
opts = {
|
||||
filetype_icon = true,
|
||||
case = 'titlecase',
|
||||
},
|
||||
},
|
||||
hl = {
|
||||
fg = 'red',
|
||||
bg = 'darkblue',
|
||||
style = 'bold',
|
||||
},
|
||||
left_sep = 'left_filled',
|
||||
right_sep = 'block',
|
||||
},
|
||||
file_encoding = {
|
||||
provider = 'file_encoding',
|
||||
hl = {
|
||||
fg = 'orange',
|
||||
bg = 'darkblue',
|
||||
-- style = 'italic',
|
||||
},
|
||||
left_sep = 'block',
|
||||
right_sep = 'block',
|
||||
},
|
||||
position = {
|
||||
provider = 'position',
|
||||
hl = {
|
||||
fg = 'green',
|
||||
bg = 'darkblue',
|
||||
style = 'bold',
|
||||
},
|
||||
left_sep = 'block',
|
||||
right_sep = 'block',
|
||||
},
|
||||
line_percentage = {
|
||||
provider = 'line_percentage',
|
||||
hl = {
|
||||
fg = 'aqua',
|
||||
bg = 'darkblue',
|
||||
style = 'bold',
|
||||
},
|
||||
left_sep = 'block',
|
||||
right_sep = 'block',
|
||||
},
|
||||
scroll_bar = {
|
||||
provider = 'scroll_bar',
|
||||
hl = {
|
||||
fg = 'yellow',
|
||||
style = 'bold',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
local left = {
|
||||
c.vim_mode,
|
||||
c.fileinfo,
|
||||
-- c.gitBranch,
|
||||
-- c.gitDiffAdded,
|
||||
-- c.gitDiffRemoved,
|
||||
-- c.gitDiffChanged,
|
||||
-- c.separator,
|
||||
c.diagnostic_errors,
|
||||
c.diagnostic_warnings,
|
||||
c.diagnostic_info,
|
||||
c.diagnostic_hints,
|
||||
}
|
||||
|
||||
local middle = {
|
||||
c.lsp_client_names,
|
||||
c.separator,
|
||||
}
|
||||
|
||||
local right = {
|
||||
c.file_type,
|
||||
c.file_encoding,
|
||||
c.position,
|
||||
c.line_percentage,
|
||||
c.scroll_bar,
|
||||
}
|
||||
|
||||
local components = {
|
||||
active = {
|
||||
left,
|
||||
middle,
|
||||
right,
|
||||
},
|
||||
inactive = {
|
||||
left,
|
||||
middle,
|
||||
right,
|
||||
},
|
||||
}
|
||||
|
||||
feline.setup {
|
||||
components = components,
|
||||
theme = theme,
|
||||
vi_mode_colors = vi_mode_colors,
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
17
lua/config/plugins/init.lua
Normal file
17
lua/config/plugins/init.lua
Normal file
@ -0,0 +1,17 @@
|
||||
return {
|
||||
'nvim-lua/plenary.nvim',
|
||||
{ 'honza/vim-snippets', lazy = false },
|
||||
{ 'dcampos/nvim-snippy', lazy = false },
|
||||
{ 'dcampos/cmp-snippy', lazy = false },
|
||||
{ 'kdheepak/lazygit.nvim', cmd = 'LazyGit' },
|
||||
'williamboman/mason-lspconfig.nvim',
|
||||
{
|
||||
'phaazon/hop.nvim',
|
||||
event = 'BufRead',
|
||||
config = function()
|
||||
require('hop').setup()
|
||||
vim.api.nvim_set_keymap('n', 's', ':HopChar2<cr>', { silent = true })
|
||||
vim.api.nvim_set_keymap('n', 'S', ':HopWord<cr>', { silent = true })
|
||||
end,
|
||||
},
|
||||
}
|
106
lua/config/plugins/lsp/handlers.lua
Normal file
106
lua/config/plugins/lsp/handlers.lua
Normal file
@ -0,0 +1,106 @@
|
||||
local M = {}
|
||||
|
||||
local cmp_nvim_lsp = require 'cmp_nvim_lsp'
|
||||
|
||||
M.capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
M.capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||
-- M.capabilities.offsetEncoding = { "utf-16" }
|
||||
M.capabilities = cmp_nvim_lsp.default_capabilities(M.capabilities)
|
||||
|
||||
-- vim.cmd [[autocmd CursorHold,CursorHoldI * lua vim.diagnostic.open_float(nil, {focus=false, scope="cursor"})]]
|
||||
|
||||
M.setup = function()
|
||||
local config = {
|
||||
virtual_text = true,
|
||||
signs = false,
|
||||
underline = true,
|
||||
update_in_insert = true,
|
||||
severity_sort = true,
|
||||
float = {
|
||||
focusable = true,
|
||||
style = 'minimal',
|
||||
border = 'rounded',
|
||||
source = 'always',
|
||||
header = '',
|
||||
prefix = '',
|
||||
},
|
||||
}
|
||||
vim.diagnostic.config(config)
|
||||
|
||||
vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(vim.lsp.handlers.hover, {
|
||||
border = 'rounded',
|
||||
})
|
||||
|
||||
vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with(vim.lsp.handlers.signature_help, {
|
||||
border = 'rounded',
|
||||
})
|
||||
|
||||
--[[ local on_references = vim.lsp.handlers['textDocument/references'] ]]
|
||||
--[[ vim.lsp.handlers['textDocument/references'] = vim.lsp.with(on_references, { ]]
|
||||
--[[ -- Use location list instead of quickfix list ]]
|
||||
--[[ loclist = true, ]]
|
||||
--[[ }) ]]
|
||||
end
|
||||
|
||||
local function lsp_keymaps(bufnr)
|
||||
local opts = { noremap = true, silent = true }
|
||||
local keymap = vim.api.nvim_buf_set_keymap
|
||||
keymap(bufnr, 'n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts)
|
||||
keymap(bufnr, 'n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts)
|
||||
keymap(bufnr, 'n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts)
|
||||
keymap(bufnr, 'n', 'gI', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
|
||||
keymap(bufnr, 'n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
|
||||
keymap(bufnr, 'n', 'gl', '<cmd>lua vim.diagnostic.open_float()<CR>', opts)
|
||||
keymap(bufnr, 'n', '<leader>lf', '<cmd>lua vim.lsp.buf.format { async = true }<cr>', opts)
|
||||
keymap(bufnr, 'n', '<leader>li', '<cmd>LspInfo<cr>', opts)
|
||||
keymap(bufnr, 'n', '<leader>lI', '<cmd>LspInstallInfo<cr>', opts)
|
||||
keymap(bufnr, 'n', '<leader>la', '<cmd>lua vim.lsp.buf.code_action()<cr>', opts)
|
||||
keymap(bufnr, 'n', '<leader>lj', '<cmd>lua vim.diagnostic.goto_next({buffer=0})<cr>', opts)
|
||||
keymap(bufnr, 'n', '<leader>lk', '<cmd>lua vim.diagnostic.goto_prev({buffer=0})<cr>', opts)
|
||||
keymap(bufnr, 'n', '<leader>lr', '<cmd>lua vim.lsp.buf.rename()<cr>', opts)
|
||||
keymap(bufnr, 'n', '<leader>ls', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
|
||||
keymap(bufnr, 'n', '<leader>lq', '<cmd>lua vim.diagnostic.setloclist()<CR>', opts)
|
||||
keymap(bufnr, 'n', '<leader>e', '<cmd>lua vim.diagnostic.open_float()<CR>', opts)
|
||||
end
|
||||
|
||||
M.on_attach = function(client, bufnr)
|
||||
--[[ vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') ]]
|
||||
lsp_keymaps(bufnr)
|
||||
if client.name == 'sumneko_lua' then
|
||||
client.server_capabilities.documentFormattingProvider = false
|
||||
end
|
||||
if client.name == 'clangd' then
|
||||
client.server_capabilities.documentFormattingProvider = false
|
||||
end
|
||||
if client.name == 'gopls' then
|
||||
client.server_capabilities.documentFormattingProvider = false
|
||||
end
|
||||
if client.name == 'jdtls' then
|
||||
client.server_capabilities.documentFormattingProvider = false
|
||||
end
|
||||
if client.name == 'jdt.ls' then
|
||||
client.server_capabilities.documentFormattingProvider = false
|
||||
vim.lsp.codelens.refresh()
|
||||
if JAVA_DAP_ACTIVE then
|
||||
require('jdtls').setup_dap { hotcodereplace = 'auto' }
|
||||
require('jdtls.dap').setup_dap_main_class_configs()
|
||||
end
|
||||
end
|
||||
local ft = vim.api.nvim_buf_get_option(bufnr, 'filetype')
|
||||
local nls = require 'config.plugins.null-ls'
|
||||
|
||||
local enable = false
|
||||
if nls.has_formatter(ft) then
|
||||
enable = client.name == 'null-ls'
|
||||
else
|
||||
enable = not (client.name == 'null-ls')
|
||||
end
|
||||
|
||||
if client.name == 'tsserver' then
|
||||
enable = false
|
||||
end
|
||||
-- util.info(client.name .. " " .. (enable and "yes" or "no"), "format")
|
||||
client.server_capabilities.documentFormattingProvider = enable
|
||||
end
|
||||
|
||||
return M
|
152
lua/config/plugins/lsp/init.lua
Normal file
152
lua/config/plugins/lsp/init.lua
Normal file
@ -0,0 +1,152 @@
|
||||
local M = {
|
||||
'neovim/nvim-lspconfig',
|
||||
name = 'lsp',
|
||||
event = 'BufReadPre',
|
||||
dependencies = { 'hrsh7th/cmp-nvim-lsp' },
|
||||
}
|
||||
|
||||
M.tools = {
|
||||
'clangd',
|
||||
'gopls',
|
||||
'sumneko_lua',
|
||||
}
|
||||
|
||||
function M.config()
|
||||
require 'mason'
|
||||
local lspconfig = require 'lspconfig'
|
||||
local opts = {}
|
||||
local cmp_nvim_lsp = require 'cmp_nvim_lsp'
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||
capabilities = cmp_nvim_lsp.default_capabilities(capabilities)
|
||||
|
||||
local function lsp_keymaps(bufnr)
|
||||
local opt = { noremap = true, silent = true }
|
||||
local keymap = vim.api.nvim_buf_set_keymap
|
||||
keymap(bufnr, 'n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opt)
|
||||
keymap(bufnr, 'n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opt)
|
||||
keymap(bufnr, 'n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opt)
|
||||
keymap(bufnr, 'n', 'gI', '<cmd>lua vim.lsp.buf.implementation()<CR>', opt)
|
||||
keymap(bufnr, 'n', 'gr', '<cmd>TroubleToggle lsp_references<CR>', opt)
|
||||
keymap(bufnr, 'n', 'gl', '<cmd>lua vim.diagnostic.open_float()<CR>', opt)
|
||||
keymap(bufnr, 'n', '<leader>lf', '<cmd>lua vim.lsp.buf.format { async = true }<cr>', opt)
|
||||
keymap(bufnr, 'n', '<leader>li', '<cmd>LspInfo<cr>', opt)
|
||||
keymap(bufnr, 'n', '<leader>lI', '<cmd>LspInstallInfo<cr>', opt)
|
||||
keymap(bufnr, 'n', '<leader>la', '<cmd>lua vim.lsp.buf.code_action()<cr>', opt)
|
||||
keymap(bufnr, 'n', '<leader>lj', '<cmd>lua vim.diagnostic.goto_next({buffer=0})<cr>', opt)
|
||||
keymap(bufnr, 'n', '<leader>lk', '<cmd>lua vim.diagnostic.goto_prev({buffer=0})<cr>', opt)
|
||||
keymap(bufnr, 'n', '<leader>lr', '<cmd>lua vim.lsp.buf.rename()<cr>', opt)
|
||||
keymap(bufnr, 'n', '<leader>ls', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opt)
|
||||
keymap(bufnr, 'n', '<leader>lq', '<cmd>lua vim.diagnostic.setloclist()<CR>', opt)
|
||||
keymap(bufnr, 'n', '<leader>e', '<cmd>lua vim.diagnostic.open_float()<CR>', opt)
|
||||
end
|
||||
|
||||
local on_attach = function(client, bufnr)
|
||||
--[[ vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') ]]
|
||||
lsp_keymaps(bufnr)
|
||||
if client.name == 'sumneko_lua' then
|
||||
client.server_capabilities.documentFormattingProvider = false
|
||||
end
|
||||
if client.name == 'clangd' then
|
||||
client.server_capabilities.documentFormattingProvider = false
|
||||
end
|
||||
if client.name == 'gopls' then
|
||||
client.server_capabilities.documentFormattingProvider = false
|
||||
end
|
||||
if client.name == 'jdtls' then
|
||||
client.server_capabilities.documentFormattingProvider = false
|
||||
end
|
||||
if client.name == 'jdt.ls' then
|
||||
client.server_capabilities.documentFormattingProvider = false
|
||||
vim.lsp.codelens.refresh()
|
||||
if JAVA_DAP_ACTIVE then
|
||||
require('jdtls').setup_dap { hotcodereplace = 'auto' }
|
||||
require('jdtls.dap').setup_dap_main_class_configs()
|
||||
end
|
||||
end
|
||||
local ft = vim.api.nvim_buf_get_option(bufnr, 'filetype')
|
||||
local nls = require 'config.plugins.null-ls'
|
||||
|
||||
local enable = false
|
||||
if nls.has_formatter(ft) then
|
||||
enable = client.name == 'null-ls'
|
||||
else
|
||||
enable = not (client.name == 'null-ls')
|
||||
end
|
||||
|
||||
if client.name == 'tsserver' then
|
||||
enable = false
|
||||
end
|
||||
-- util.info(client.name .. " " .. (enable and "yes" or "no"), "format")
|
||||
client.server_capabilities.documentFormattingProvider = enable
|
||||
end
|
||||
for _, tool in ipairs(M.tools) do
|
||||
opts = {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
local server = vim.split(tool, '@')[1]
|
||||
|
||||
if server == 'sumneko_lua' then
|
||||
local sumneko_opts = require 'config.plugins.lsp.settings.sumneko_lua'
|
||||
opts = vim.tbl_deep_extend('force', sumneko_opts, opts)
|
||||
end
|
||||
if server == 'clangd' then
|
||||
local clangd_flags = {
|
||||
'--all-scopes-completion',
|
||||
'--suggest-missing-includes',
|
||||
'--background-index',
|
||||
'--pch-storage=disk',
|
||||
'--cross-file-rename',
|
||||
'--log=info',
|
||||
'--completion-style=detailed',
|
||||
'--enable-config', -- clangd 11+ supports reading from .clangd configuration file
|
||||
'--clang-tidy',
|
||||
-- "--clang-tidy-checks=-*,llvm-*,clang-analyzer-*,modernize-*,-modernize-use-trailing-return-type",
|
||||
-- "--fallback-style=Google",
|
||||
-- "--header-insertion=never",
|
||||
-- "--query-driver=<list-of-white-listed-complers>"
|
||||
}
|
||||
local clang_opts = {
|
||||
arg = { unpack(clangd_flags) },
|
||||
}
|
||||
opts = vim.tbl_deep_extend('force', clang_opts, opts)
|
||||
end
|
||||
lspconfig[server].setup(opts)
|
||||
end
|
||||
|
||||
local config = {
|
||||
virtual_text = {
|
||||
prefix = '●',
|
||||
},
|
||||
signs = false,
|
||||
underline = true,
|
||||
update_in_insert = true,
|
||||
severity_sort = true,
|
||||
float = {
|
||||
focusable = true,
|
||||
style = 'minimal',
|
||||
border = 'rounded',
|
||||
source = 'always',
|
||||
header = '',
|
||||
prefix = '',
|
||||
},
|
||||
}
|
||||
vim.diagnostic.config(config)
|
||||
|
||||
vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(vim.lsp.handlers.hover, {
|
||||
border = 'rounded',
|
||||
})
|
||||
|
||||
vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with(vim.lsp.handlers.signature_help, {
|
||||
border = 'rounded',
|
||||
})
|
||||
|
||||
--[[ local on_references = vim.lsp.handlers['textDocument/references'] ]]
|
||||
--[[ vim.lsp.handlers['textDocument/references'] = vim.lsp.with(on_references, { ]]
|
||||
--[[ -- Use location list instead of quickfix list ]]
|
||||
--[[ loclist = true, ]]
|
||||
--[[ }) ]]
|
||||
end
|
||||
|
||||
return M
|
21
lua/config/plugins/lsp/settings/sumneko_lua.lua
Normal file
21
lua/config/plugins/lsp/settings/sumneko_lua.lua
Normal file
@ -0,0 +1,21 @@
|
||||
return {
|
||||
flags = {
|
||||
debounce_text_changes = 150,
|
||||
},
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = {
|
||||
globals = { 'vim' },
|
||||
},
|
||||
-- workspace = {
|
||||
-- library = {
|
||||
-- [vim.fn.expand '$VIMRUNTIME/lua'] = true,
|
||||
-- [vim.fn.stdpath 'config' .. '/lua'] = true,
|
||||
-- },
|
||||
-- },
|
||||
telemetry = {
|
||||
enable = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
49
lua/config/plugins/mason.lua
Normal file
49
lua/config/plugins/mason.lua
Normal file
@ -0,0 +1,49 @@
|
||||
local M = {
|
||||
'williamboman/mason.nvim',
|
||||
}
|
||||
|
||||
M.tools = {
|
||||
'clang-format',
|
||||
'clangd',
|
||||
'gopls',
|
||||
-- 'lua-language-server',
|
||||
'rust-analyzer',
|
||||
'prettierd',
|
||||
-- 'stylua',
|
||||
'shellcheck',
|
||||
'shfmt',
|
||||
'black',
|
||||
}
|
||||
|
||||
function M.check()
|
||||
local mr = require 'mason-registry'
|
||||
for _, tool in ipairs(M.tools) do
|
||||
local p = mr.get_package(tool)
|
||||
if not p:is_installed() then
|
||||
p:install()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function M.config()
|
||||
require('mason').setup {
|
||||
settings = {
|
||||
ui = {
|
||||
border = 'rounded',
|
||||
icons = {
|
||||
package_installed = '◍',
|
||||
package_pending = '◍',
|
||||
package_uninstalled = '◍',
|
||||
},
|
||||
},
|
||||
log_level = vim.log.levels.INFO,
|
||||
max_concurrent_installers = 4,
|
||||
},
|
||||
}
|
||||
M.check()
|
||||
require('mason-lspconfig').setup {
|
||||
automatic_installation = false,
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
127
lua/config/plugins/mini.lua
Normal file
127
lua/config/plugins/mini.lua
Normal file
@ -0,0 +1,127 @@
|
||||
local mini = {
|
||||
'echasnovski/mini.nvim',
|
||||
event = 'VeryLazy',
|
||||
}
|
||||
|
||||
local specs = { mini, 'JoosepAlviste/nvim-ts-context-commentstring' }
|
||||
|
||||
function mini.surround()
|
||||
require('mini.surround').setup {
|
||||
mappings = {
|
||||
add = 'gza', -- Add surrounding in Normal and Visual modes
|
||||
delete = 'gzd', -- Delete surrounding
|
||||
find = 'gzf', -- Find surrounding (to the right)
|
||||
find_left = 'gzF', -- Find surrounding (to the left)
|
||||
highlight = 'gzh', -- Highlight surrounding
|
||||
replace = 'gzr', -- Replace surrounding
|
||||
update_n_lines = 'gzn', -- Update `n_lines`
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
function mini.jump()
|
||||
require('mini.jump').setup {}
|
||||
end
|
||||
|
||||
function mini.pairs()
|
||||
require('mini.pairs').setup {}
|
||||
end
|
||||
|
||||
function mini.comment()
|
||||
require('mini.comment').setup {
|
||||
hooks = {
|
||||
pre = function()
|
||||
require('ts_context_commentstring.internal').update_commentstring {}
|
||||
end,
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
function mini.ai()
|
||||
local ai = require 'mini.ai'
|
||||
require('mini.ai').setup {
|
||||
n_lines = 500,
|
||||
-- search_method = "cover_or_next",
|
||||
custom_textobjects = {
|
||||
o = ai.gen_spec.treesitter({
|
||||
a = { '@block.outer', '@conditional.outer', '@loop.outer' },
|
||||
i = { '@block.inner', '@conditional.inner', '@loop.inner' },
|
||||
}, {}),
|
||||
f = ai.gen_spec.treesitter({ a = '@function.outer', i = '@function.inner' }, {}),
|
||||
c = ai.gen_spec.treesitter({ a = '@class.outer', i = '@class.inner' }, {}),
|
||||
},
|
||||
}
|
||||
|
||||
local map = function(text_obj, desc)
|
||||
for _, side in ipairs { 'left', 'right' } do
|
||||
for dir, d in pairs { prev = '[', next = ']' } do
|
||||
local lhs = d .. (side == 'right' and text_obj:upper() or text_obj:lower())
|
||||
for _, mode in ipairs { 'n', 'x', 'o' } do
|
||||
vim.keymap.set(mode, lhs, function()
|
||||
ai.move_cursor(side, 'a', text_obj, { search_method = dir })
|
||||
end, {
|
||||
desc = dir .. ' ' .. desc,
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
map('f', 'function')
|
||||
map('c', 'class')
|
||||
map('o', 'block')
|
||||
end
|
||||
|
||||
function mini.config()
|
||||
-- M.jump()
|
||||
mini.surround()
|
||||
-- mini.ai()
|
||||
-- mini.pairs()
|
||||
mini.comment()
|
||||
mini.jump()
|
||||
-- mini.animate()
|
||||
end
|
||||
|
||||
function mini.animate()
|
||||
local mouse_scrolled = false
|
||||
for _, scroll in ipairs { 'Up', 'Down' } do
|
||||
local key = '<ScrollWheel' .. scroll .. '>'
|
||||
vim.keymap.set('', key, function()
|
||||
mouse_scrolled = true
|
||||
return key
|
||||
end, { remap = true, expr = true })
|
||||
end
|
||||
|
||||
local animate = require 'mini.animate'
|
||||
vim.go.winwidth = 20
|
||||
vim.go.winminwidth = 5
|
||||
|
||||
animate.setup {
|
||||
resize = {
|
||||
timing = animate.gen_timing.linear { duration = 50, unit = 'total' },
|
||||
},
|
||||
scroll = {
|
||||
timing = animate.gen_timing.linear { duration = 100, unit = 'total' },
|
||||
subscroll = animate.gen_subscroll.equal {
|
||||
predicate = function(total_scroll)
|
||||
if mouse_scrolled then
|
||||
mouse_scrolled = false
|
||||
return false
|
||||
end
|
||||
return total_scroll > 1
|
||||
end,
|
||||
},
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
function mini.init()
|
||||
vim.keymap.set('n', '<leader>bd', function()
|
||||
require('mini.bufremove').delete(0, false)
|
||||
end)
|
||||
vim.keymap.set('n', '<leader>bD', function()
|
||||
require('mini.bufremove').delete(0, true)
|
||||
end)
|
||||
end
|
||||
|
||||
return specs
|
69
lua/config/plugins/null-ls.lua
Normal file
69
lua/config/plugins/null-ls.lua
Normal file
@ -0,0 +1,69 @@
|
||||
local M = {
|
||||
'jose-elias-alvarez/null-ls.nvim',
|
||||
}
|
||||
|
||||
function M.config()
|
||||
local null_ls = require 'null-ls'
|
||||
|
||||
-- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/formatting
|
||||
local formatting = null_ls.builtins.formatting
|
||||
-- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics
|
||||
local diagnostics = null_ls.builtins.diagnostics
|
||||
|
||||
null_ls.setup {
|
||||
debug = false,
|
||||
on_init = function(new_client, _)
|
||||
new_client.offset_encoding = 'utf-16'
|
||||
end,
|
||||
sources = {
|
||||
formatting.prettier.with { extra_args = { '--no-semi', '--single-quote', '--jsx-single-quote' } },
|
||||
formatting.black.with { extra_args = { '--fast' } },
|
||||
formatting.stylua.with { extra_args = { '--quote-style=AutoPreferSingle', '--call-parentheses=None' } },
|
||||
formatting.clang_format.with {
|
||||
filetypes = { 'c' },
|
||||
extra_args = {
|
||||
'--style',
|
||||
'{AccessModifierOffset : -2, AllowShortIfStatementsOnASingleLine : Never, AlignConsecutiveMacros : true, AllowShortLoopsOnASingleLine : false, AlwaysBreakTemplateDeclarations : true, Standard : c++20, NamespaceIndentation : All, IndentWidth : 4, TabWidth : 4, BreakBeforeBraces : Linux, AllowShortFunctionsOnASingleLine : Empty, AllowShortBlocksOnASingleLine : Never, FixNamespaceComments : true, PointerAlignment : Right, ColumnLimit : 120, ContinuationIndentWidth : 2, UseTab : Always }',
|
||||
},
|
||||
},
|
||||
formatting.clang_format.with {
|
||||
filetypes = { 'cpp' },
|
||||
extra_args = {
|
||||
'--style',
|
||||
'google',
|
||||
},
|
||||
},
|
||||
formatting.beautysh,
|
||||
formatting.google_java_format,
|
||||
formatting.goimports,
|
||||
formatting.gofumpt,
|
||||
formatting.sql_formatter,
|
||||
diagnostics.golangci_lint.with {
|
||||
extra_args = {
|
||||
'-E',
|
||||
'revive',
|
||||
'-E',
|
||||
'errcheck',
|
||||
'-E',
|
||||
'gosec',
|
||||
'-E',
|
||||
'nilerr',
|
||||
'-E',
|
||||
'nlreturn',
|
||||
},
|
||||
},
|
||||
formatting.asmfmt.with {
|
||||
filetypes = { 'asm', 's' },
|
||||
},
|
||||
-- diagnostics.flake8
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
function M.has_formatter(ft)
|
||||
local sources = require 'null-ls.sources'
|
||||
local available = sources.get_available(ft, 'NULL_LS_FORMATTING')
|
||||
return #available > 0
|
||||
end
|
||||
|
||||
return M
|
112
lua/config/plugins/telescope.lua
Normal file
112
lua/config/plugins/telescope.lua
Normal file
@ -0,0 +1,112 @@
|
||||
local function project_files()
|
||||
local opts = {}
|
||||
if vim.loop.fs_stat '.git' then
|
||||
opts.show_untracked = true
|
||||
require('telescope.builtin').git_files(opts)
|
||||
else
|
||||
local client = vim.lsp.get_active_clients()[1]
|
||||
if client then
|
||||
opts.cwd = client.config.root_dir
|
||||
end
|
||||
-- require('telescope.builtin').find_files(opts)
|
||||
require('telescope').extensions.file_browser.file_browser()
|
||||
end
|
||||
end
|
||||
|
||||
local M = {
|
||||
'nvim-telescope/telescope.nvim',
|
||||
cmd = { 'Telescope' },
|
||||
keys = {
|
||||
{ '<leader><space>', project_files, desc = 'Find File' },
|
||||
},
|
||||
dependencies = {
|
||||
'nvim-telescope/telescope-file-browser.nvim',
|
||||
},
|
||||
}
|
||||
|
||||
function M.config()
|
||||
local telescope = require 'telescope'
|
||||
local actions = require 'telescope.actions'
|
||||
local previewers = require 'telescope.previewers'
|
||||
local Job = require 'plenary.job'
|
||||
local new_maker = function(filepath, bufnr, opts)
|
||||
filepath = vim.fn.expand(filepath)
|
||||
Job:new({
|
||||
command = 'file',
|
||||
args = { '--mime-type', '-b', filepath },
|
||||
on_exit = function(j)
|
||||
local mime_type = vim.split(j:result()[1], '/')[1]
|
||||
if mime_type == 'text' then
|
||||
previewers.buffer_previewer_maker(filepath, bufnr, opts)
|
||||
else
|
||||
-- maybe we want to write something to the buffer here
|
||||
vim.schedule(function()
|
||||
vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, { 'BINARY' })
|
||||
end)
|
||||
end
|
||||
end,
|
||||
}):sync()
|
||||
end
|
||||
|
||||
-- local fb_actions = require "telescope".extensions.file_browser.actions
|
||||
telescope.setup {
|
||||
extensions = {
|
||||
file_browser = {
|
||||
theme = 'ivy',
|
||||
-- disables netrw and use telescope-file-browser in its place
|
||||
hijack_netrw = true,
|
||||
mappings = {
|
||||
['i'] = {
|
||||
},
|
||||
['n'] = {
|
||||
-- your custom normal mode mappings
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
pickers = {
|
||||
find_files = {
|
||||
theme = 'dropdown',
|
||||
},
|
||||
live_grep = {
|
||||
theme = 'dropdown',
|
||||
},
|
||||
buffers = {
|
||||
theme = 'dropdown',
|
||||
},
|
||||
},
|
||||
defaults = {
|
||||
layout_config = {
|
||||
vertical = { width = 0.5 },
|
||||
-- other layout configuration here
|
||||
},
|
||||
buffer_previewer_maker = new_maker,
|
||||
prompt_prefix = ' ',
|
||||
selection_caret = ' ',
|
||||
path_display = { 'smart' },
|
||||
file_ignore_patterns = { '.git/', 'node_modules' },
|
||||
|
||||
mappings = {
|
||||
i = {
|
||||
['<Down>'] = actions.move_selection_next,
|
||||
['<Up>'] = actions.move_selection_previous,
|
||||
['<C-n>'] = actions.cycle_history_next,
|
||||
['<C-e>'] = actions.cycle_history_prev,
|
||||
['<esc>'] = actions.close,
|
||||
},
|
||||
},
|
||||
vimgrep_arguments = {
|
||||
'rg',
|
||||
'--color=never',
|
||||
'--no-heading',
|
||||
'--with-filename',
|
||||
'--line-number',
|
||||
'--column',
|
||||
'--smart-case',
|
||||
'--trim', -- add this value
|
||||
},
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
14
lua/config/plugins/theme.lua
Normal file
14
lua/config/plugins/theme.lua
Normal file
@ -0,0 +1,14 @@
|
||||
local M = {
|
||||
'folke/tokyonight.nvim',
|
||||
lazy = true, -- make sure we load this during startup if it is your main colorscheme
|
||||
priority = 1000, -- make sure to load this before all the other start plugins
|
||||
}
|
||||
|
||||
function M.config()
|
||||
require('tokyonight').setup {
|
||||
transparent = true,
|
||||
style = 'night', -- The theme comes in three styles, `storm`, `moon`, a darker variant `night` and `day`
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
47
lua/config/plugins/toggleterm.lua
Normal file
47
lua/config/plugins/toggleterm.lua
Normal file
@ -0,0 +1,47 @@
|
||||
local M = {
|
||||
'akinsho/toggleterm.nvim',
|
||||
cmd = 'ToggleTerm',
|
||||
}
|
||||
|
||||
function M.config()
|
||||
local toggleterm = require 'toggleterm'
|
||||
|
||||
toggleterm.setup {
|
||||
-- size can be a number or function which is passed the current terminal
|
||||
size = function(term)
|
||||
if term.direction == 'horizontal' then
|
||||
return 15
|
||||
elseif term.direction == 'vertical' then
|
||||
return vim.o.columns * 0.4
|
||||
end
|
||||
end,
|
||||
shade_filetypes = { 'none', 'fzf' },
|
||||
open_mapping = [[<home>]],
|
||||
hide_numbers = true, -- hide the number column in toggleterm buffers
|
||||
shade_terminals = true,
|
||||
shading_factor = '2', -- the degree by which to darken to terminal colour, default: 1 for dark backgrounds, 3 for light
|
||||
start_in_insert = true,
|
||||
insert_mappings = true, -- whether or not the open mapping applies in insert mode
|
||||
persist_size = true,
|
||||
direction = 'float', -- 'vertical' | 'horizontal' | 'window' | 'float',
|
||||
close_on_exit = true, -- close the terminal window when the process exits
|
||||
shell = vim.o.shell, -- change the default shell
|
||||
-- This field is only relevant if direction is set to 'float'
|
||||
float_opts = {
|
||||
-- The border key is *almost* the same as 'nvim_win_open'
|
||||
-- see :h nvim_win_open for details on borders however
|
||||
-- the 'curved' border is a custom border type
|
||||
-- not natively supported but implemented in this plugin.
|
||||
border = 'curved', -- | 'double' | 'shadow' | 'curved' --| ... other options supported by win open
|
||||
width = 100,
|
||||
height = 30,
|
||||
winblend = 0,
|
||||
highlights = {
|
||||
border = 'Normal',
|
||||
background = 'Normal',
|
||||
},
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
50
lua/config/plugins/tresitter.lua
Normal file
50
lua/config/plugins/tresitter.lua
Normal file
@ -0,0 +1,50 @@
|
||||
local M = {
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
-- lazy = false,
|
||||
event = 'BufReadPost',
|
||||
}
|
||||
|
||||
function M.config()
|
||||
local configs = require 'nvim-treesitter.configs'
|
||||
|
||||
configs.setup {
|
||||
ensure_installed = {
|
||||
'bash',
|
||||
'c',
|
||||
'cpp',
|
||||
'go',
|
||||
'javascript',
|
||||
'typescript',
|
||||
'json',
|
||||
'lua',
|
||||
'python',
|
||||
'rust',
|
||||
'html',
|
||||
'css',
|
||||
'toml',
|
||||
'latex',
|
||||
'markdown',
|
||||
'vim',
|
||||
'dot',
|
||||
},
|
||||
ignore_install = { 'haskell' },
|
||||
-- matchup = {
|
||||
-- enable = true -- mandatory, false will disable the whole extension
|
||||
-- -- disable = { "c", "ruby" }, -- optional, list of language that will be disabled
|
||||
-- },
|
||||
highlight = {
|
||||
enable = true, -- false will disable the whole extension
|
||||
disable = { 'html' },
|
||||
},
|
||||
context_commentstring = { enable = true, config = { css = '// %s' } },
|
||||
-- indent = {enable = true, disable = {"python", "html", "javascript"}},
|
||||
-- TODO seems to be broken
|
||||
indent = { enable = true, disable = { 'python', 'css' } },
|
||||
autotag = { enable = true },
|
||||
autopairs = {
|
||||
enable = true,
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
61
lua/config/plugins/trouble.lua
Normal file
61
lua/config/plugins/trouble.lua
Normal file
@ -0,0 +1,61 @@
|
||||
local M = {
|
||||
'folke/trouble.nvim',
|
||||
dependencies = {
|
||||
'nvim-tree/nvim-web-devicons',
|
||||
},
|
||||
cmd = { 'TroubleToggle', 'Trouble' },
|
||||
}
|
||||
|
||||
function M.config()
|
||||
local trouble = require 'trouble'
|
||||
|
||||
trouble.setup {
|
||||
position = 'bottom', -- position of the list can be: bottom, top, left, right
|
||||
height = 10, -- height of the trouble list when position is top or bottom
|
||||
width = 50, -- width of the list when position is left or right
|
||||
icons = true, -- use devicons for filenames
|
||||
mode = 'document_diagnostics', -- "workspace_diagnostics", "document_diagnostics", "quickfix", "lsp_references", "loclist"
|
||||
fold_open = '', -- icon used for open folds
|
||||
fold_closed = '', -- icon used for closed folds
|
||||
group = true, -- group results by file
|
||||
padding = true, -- add an extra new line on top of the list
|
||||
action_keys = { -- key mappings for actions in the trouble list
|
||||
-- map to {} to remove a mapping, for example:
|
||||
-- close = {},
|
||||
close = 'q', -- close the list
|
||||
cancel = '<esc>', -- cancel the preview and get back to your last window / buffer / cursor
|
||||
refresh = 'r', -- manually refresh
|
||||
jump_close = { '<cr>', '<tab>' }, -- jump to the diagnostic or open / close folds
|
||||
open_split = { '<c-x>' }, -- open buffer in new split
|
||||
open_vsplit = { '<c-v>' }, -- open buffer in new vsplit
|
||||
open_tab = { '<c-t>' }, -- open buffer in new tab
|
||||
jump = { 'o' }, -- jump to the diagnostic and close the list
|
||||
toggle_mode = 'm', -- toggle between "workspace" and "document" diagnostics mode
|
||||
toggle_preview = 'P', -- toggle auto_preview
|
||||
hover = 'K', -- opens a small popup with the full multiline message
|
||||
preview = 'p', -- preview the diagnostic location
|
||||
close_folds = { 'zM', 'zm' }, -- close all folds
|
||||
open_folds = { 'zR', 'zr' }, -- open all folds
|
||||
toggle_fold = { 'zA', 'za' }, -- toggle fold of current file
|
||||
previous = 'k', -- preview item
|
||||
next = 'j', -- next item
|
||||
},
|
||||
indent_lines = true, -- add an indent guide below the fold icons
|
||||
auto_open = false, -- automatically open the list when you have diagnostics
|
||||
auto_close = false, -- automatically close the list when you have no diagnostics
|
||||
auto_preview = false, -- automatically preview the location of the diagnostic. <esc> to close preview and go back to last window
|
||||
auto_fold = false, -- automatically fold a file trouble list at creation
|
||||
auto_jump = { 'lsp_definitions' }, -- for the given modes, automatically jump if there is only a single result
|
||||
signs = {
|
||||
-- icons / text used for a diagnostic
|
||||
error = '',
|
||||
warning = '',
|
||||
hint = '',
|
||||
information = '',
|
||||
other = '',
|
||||
},
|
||||
use_diagnostic_signs = false, -- enabling this will use the signs defined in your lsp client
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
138
lua/config/plugins/which-key.lua
Normal file
138
lua/config/plugins/which-key.lua
Normal file
@ -0,0 +1,138 @@
|
||||
local M = {
|
||||
'folke/which-key.nvim',
|
||||
lazy = false,
|
||||
-- event = "VeryLazy",
|
||||
}
|
||||
|
||||
function M.config()
|
||||
local wk = require 'which-key'
|
||||
|
||||
-- which-key {{{
|
||||
wk.setup {
|
||||
plugins = {
|
||||
marks = true, -- shows a list of your marks on ' and `
|
||||
registers = true, -- shows your registers on " in NORMAL or <C-r> in INSERT mode
|
||||
-- the presets plugin, adds help for a bunch of default keybindings in Neovim
|
||||
-- No actual key bindings are created
|
||||
presets = {
|
||||
operators = true, -- adds help for operators like d, y, ...
|
||||
motions = true, -- adds help for motions
|
||||
text_objects = false, -- help for text objects triggered after entering an operator
|
||||
windows = true, -- default bindings on <c-w>
|
||||
nav = true, -- misc bindings to work with windows
|
||||
z = true, -- bindings for folds, spelling and others prefixed with z
|
||||
g = true, -- bindings for prefixed with g
|
||||
},
|
||||
},
|
||||
icons = {
|
||||
breadcrumb = '»', -- symbol used in the command line area that shows your active key combo
|
||||
separator = '➜ ', -- symbol used between a key and it's label
|
||||
group = '+', -- symbol prepended to a group
|
||||
},
|
||||
window = {
|
||||
border = 'none', -- none, single, double, shadow
|
||||
position = 'bottom', -- bottom, top
|
||||
margin = { 1, 0, 1, 0 }, -- extra window margin [top, right, bottom, left]
|
||||
padding = { 1, 1, 1, 1 }, -- extra window padding [top, right, bottom, left]
|
||||
},
|
||||
layout = {
|
||||
height = { min = 4, max = 25 }, -- min and max height of the columns
|
||||
width = { min = 20, max = 50 }, -- min and max width of the columns
|
||||
spacing = 3, -- spacing between columns
|
||||
},
|
||||
hidden = { '<silent>', '<cmd>', '<Cmd>', '<CR>', 'call', 'lua', '^:', '^ ' }, -- hide mapping boilerplate
|
||||
show_help = true, -- show help message on the command line when the popup is visible
|
||||
}
|
||||
|
||||
local opts = {
|
||||
mode = 'n', -- NORMAL mode
|
||||
prefix = '<leader>',
|
||||
buffer = nil, -- Global mappings. Specify a buffer number for buffer local mappings
|
||||
silent = true, -- use `silent` when creating keymaps
|
||||
noremap = true, -- use `noremap` when creating keymaps
|
||||
nowait = false, -- use `nowait` when creating keymaps
|
||||
}
|
||||
-- }}}
|
||||
-- leader mappings {{{
|
||||
-- TODO create entire treesitter section
|
||||
local mappings = {
|
||||
['rr'] = 'Search and replace all',
|
||||
['rs'] = 'Search and replace',
|
||||
-- ["b"] = {"<cmd>FindrBuffers<cr>", "List buffers"},
|
||||
['k'] = { '<cmd>bd!<cr>', 'Kill buffer' },
|
||||
['n'] = { '<cmd>bn<cr>', 'Next buffer' },
|
||||
['p'] = { '<cmd>bp<cr>', 'Next buffer' },
|
||||
['h'] = { '<cmd>TSBufToggle highlight<cr>', 'Enable TS highlight' },
|
||||
-- ['t'] = { '<cmd>ToggleTerm direction=horizontal<cr>', 'HTerminal' },
|
||||
['T'] = { '<cmd>ToggleTerm direction=vertical<cr>', 'VTerminal' },
|
||||
['D'] = 'Type definition',
|
||||
['rn'] = 'Rename',
|
||||
['ca'] = 'Code action',
|
||||
['1'] = { '<cmd>b 1<cr>', 'Buffer 1' },
|
||||
['2'] = { '<cmd>b 2<cr>', 'Buffer 2' },
|
||||
['3'] = { '<cmd>b 3<cr>', 'Buffer 3' },
|
||||
['4'] = { '<cmd>b 4<cr>', 'Buffer 4' },
|
||||
['5'] = { '<cmd>b 5<cr>', 'Buffer 5' },
|
||||
['g'] = { '<cmd>LazyGit<cr>', 'Lazygit' },
|
||||
l = {
|
||||
name = 'LSP',
|
||||
f = 'Format',
|
||||
i = 'Lsp Info',
|
||||
I = 'Lsp Install Info',
|
||||
a = 'Code action',
|
||||
j = 'Next diagnostic',
|
||||
k = 'Prev diagnostic',
|
||||
r = 'Rename',
|
||||
s = 'Signature Help',
|
||||
q = 'Set LocList',
|
||||
},
|
||||
['<TAB>'] = {
|
||||
name = 'Tab',
|
||||
n = { '<cmd>tabnew<cr>', 'New' },
|
||||
p = { '<cmd>tabp<cr>', 'Previous' },
|
||||
d = { '<cmd>tabclose<cr>', 'Close' },
|
||||
['<TAB>'] = { '<cmd>tabnext<cr>', 'Next' },
|
||||
['1'] = { '1gt', 'Go to tab 1' },
|
||||
['2'] = { '2gt', 'Go to tab 2' },
|
||||
['3'] = { '3gt', 'Go to tab 3' },
|
||||
['4'] = { '4gt', 'Go to tab 4' },
|
||||
['5'] = { '5gt', 'Go to tab 5' },
|
||||
['6'] = { '6gt', 'Go to tab 6' },
|
||||
['7'] = { '7gt', 'Go to tab 7' },
|
||||
['8'] = { '8gt', 'Go to tab 8' },
|
||||
['9'] = { '9gt', 'Go to tab 9' },
|
||||
},
|
||||
w = {
|
||||
name = 'Window',
|
||||
v = { '<C-w>v', 'Vertical split' },
|
||||
h = { '<C-w>s', 'Horizontal split' },
|
||||
a = 'Add workspace folder',
|
||||
r = 'Remove workspace folder',
|
||||
l = 'List workspace folders',
|
||||
},
|
||||
t = {
|
||||
name = 'Telescope',
|
||||
f = { '<cmd>Telescope find_files<cr>', 'Files' },
|
||||
g = { '<cmd>Telescope live_grep<cr>', 'Grep' },
|
||||
b = { '<cmd>Telescope buffers<cr>', 'Buffers' },
|
||||
t = { '<cmd>Telescope<cr>', 'Pickers' },
|
||||
r = { '<cmd>Telescope lsp_references<cr>', 'Lsp references' },
|
||||
},
|
||||
-- d = {
|
||||
-- name = 'DAP',
|
||||
-- b = { "<cmd>lua require'dap'.toggle_breakpoint()<cr>", 'Toggle breakpoint' },
|
||||
-- c = { "<md>lua require'dap'.continue()<cr>", 'Continue' },
|
||||
-- i = { "<cmd>lua require'dap'.step_into()<cr>", 'Step into' },
|
||||
-- o = { "<cmd>lua require'dap'.step_over()<cr>", 'Step over' },
|
||||
-- O = { "<cmd>lua require'dap'.step_out()<cr>", 'Step out' },
|
||||
-- r = { "<cmd>lua require'dap'.repl_toggle()<cr>", 'Toggle repl' },
|
||||
-- l = { "<cmd>lua require'dap'.run_last()<cr>", 'Run last' },
|
||||
-- u = { "<cmd>lua require'dapui'.toggle()<cr>", 'UI' },
|
||||
-- t = { "<cmd>lua require'dap'.terminate()<cr>", 'Terminate' },
|
||||
-- },
|
||||
}
|
||||
-- }}}
|
||||
wk.register(mappings, opts)
|
||||
end
|
||||
|
||||
return M
|
89
lua/config/settings.lua
Normal file
89
lua/config/settings.lua
Normal file
@ -0,0 +1,89 @@
|
||||
local g = vim.g
|
||||
local opt = vim.opt
|
||||
local function add(value, str, sep)
|
||||
sep = sep or ','
|
||||
str = str or ''
|
||||
value = type(value) == 'table' and table.concat(value, sep) or value
|
||||
return str ~= '' and table.concat({ value, str }, sep) or value
|
||||
end
|
||||
-- local disabled_built_ins = {
|
||||
-- -- 'netrw',
|
||||
-- -- 'netrwPlugin',
|
||||
-- -- 'netrwSettings',
|
||||
-- -- 'netrwFileHandlers',
|
||||
-- -- 'getscript',
|
||||
-- -- 'getscriptPlugin',
|
||||
-- 'vimball',
|
||||
-- 'vimballPlugin',
|
||||
-- '2html_plugin',
|
||||
-- 'logipat',
|
||||
-- 'rrhelper',
|
||||
-- -- 'spellfile_plugin',
|
||||
-- 'matchit',
|
||||
-- }
|
||||
-- for _, plugin in pairs(disabled_built_ins) do
|
||||
-- g['loaded_' .. plugin] = 1
|
||||
-- end
|
||||
|
||||
-- Globals {{{
|
||||
-- g.do_filetype_lua = 1
|
||||
-- g.did_load_filetypes = 0
|
||||
g.netrw_liststyle = 1
|
||||
g.netrw_banner = 0
|
||||
g.mapleader = ' '
|
||||
g.tex_flavor = 'latex'
|
||||
-- }}}
|
||||
-- Opts {{{
|
||||
-- opt.formatoptions = ""
|
||||
opt.termguicolors = true
|
||||
opt.guifont = 'JetBrainsMono Nerd Font'
|
||||
opt.guicursor = 'n-v-c-sm:hor20,i-ci-ve:ver20,r-cr-o:Block'
|
||||
opt.mouse = 'vn'
|
||||
opt.path = '.,,**h'
|
||||
opt.pumheight = 10
|
||||
opt.fileencoding = 'utf-8'
|
||||
--opt.cmdheight = 2 " More space for displaying messages
|
||||
opt.splitbelow = true
|
||||
opt.splitright = true
|
||||
opt.ts = 4
|
||||
opt.sw = 4
|
||||
opt.smartindent = true
|
||||
--opt.expandtab " Converts tabs to spaces
|
||||
opt.showmode = false
|
||||
opt.undofile = true
|
||||
opt.updatetime = 300
|
||||
opt.backup = false
|
||||
opt.clipboard:prepend { 'unnamedplus' }
|
||||
opt.smartcase = true
|
||||
opt.cursorline = true
|
||||
opt.viewoptions = 'folds,cursor'
|
||||
opt.sessionoptions = 'folds'
|
||||
opt.foldmethod = 'marker'
|
||||
opt.foldlevel = 0
|
||||
opt.number = true
|
||||
opt.hidden = true
|
||||
--opt.shortmess+ = c " Don't pass messages to ins-completion-menu.
|
||||
opt.scrolloff = 15
|
||||
opt.iskeyword:prepend { '-' }
|
||||
opt.inccommand = 'nosplit'
|
||||
opt.completeopt = { 'menu', 'menuone', 'noselect' }
|
||||
opt.timeoutlen = 300
|
||||
opt.conceallevel = 0
|
||||
opt.concealcursor = 'n'
|
||||
opt['foldenable'] = false
|
||||
-- opt.fillchars = 'vert:▏'
|
||||
opt.fillchars.eob = ' '
|
||||
-- opt.fillchars.vert="▏"
|
||||
opt.sessionoptions = add { 'options', 'resize', 'winpos', 'terminal' }
|
||||
opt.autochdir = false
|
||||
-- }}}
|
||||
-- Commands and autocommands {{{
|
||||
vim.api.nvim_create_user_command('Pdf', '!pandoc % -o %:r.pdf', { nargs = 0 })
|
||||
vim.api.nvim_create_user_command('Slide', '!pandoc -t beamer % -o %:r.pdf', { nargs = 0 })
|
||||
vim.api.nvim_create_user_command('Cd', 'lcd %:p:h', { nargs = 0 })
|
||||
|
||||
vim.api.nvim_create_autocmd({ 'BufReadPost' }, { pattern = { '*' }, command = 'silent! g`"zz' })
|
||||
vim.api.nvim_create_autocmd({ 'BufWinLeave' }, { pattern = { '?*' }, command = 'mkview' })
|
||||
vim.api.nvim_create_autocmd({ 'BufReadPost' }, { pattern = { '?*' }, command = 'silent! loadview' })
|
||||
-- }}}
|
||||
|
Loading…
Reference in New Issue
Block a user