finish basic files refactor
This commit is contained in:
parent
94fd2627b9
commit
2754473139
28 changed files with 715 additions and 666 deletions
22
README.md
22
README.md
|
@ -74,6 +74,11 @@ Mason installs stuff in `.local/share/nvim/mason/packages` so they are independe
|
|||
:SudaWrite /etc/profile
|
||||
```
|
||||
|
||||
##### General
|
||||
|
||||
<table border="1" id="bkmrk-%3Cleader%3El-disable-%28s" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 50%;"></col><col style="width: 50%;"></col></colgroup><tbody><tr><td><leader>l
|
||||
</td><td>disable (search) highlighting</td></tr></tbody></table>
|
||||
|
||||
##### Opened files navigation:
|
||||
|
||||
<table border="1" id="bkmrk-ctrl-w-%3Carrow%3E-movin" style="border-collapse: collapse; width: 100%; height: 506.6px;"><colgroup><col style="width: 50%;"></col><col style="width: 50%;"></col></colgroup><tbody><tr style="height: 29.8px;"><td style="height: 29.8px;"><leader> m m
|
||||
|
@ -227,9 +232,24 @@ GitSings provides some commands for displaying git stuff:
|
|||
</td><td style="height: 29.8px;">list workspace folders
|
||||
</td></tr></tbody></table>
|
||||
|
||||
#####
|
||||
##### LSP diagnostics, etc:
|
||||
|
||||
|
||||
<table border="1" id="bkmrk-%3Cleader%3Exx-open-diag" style="border-collapse: collapse; width: 100%; height: 178.8px;"><colgroup><col style="width: 50%;"></col><col style="width: 50%;"></col></colgroup><tbody><tr style="height: 29.8px;"><td style="height: 29.8px;"><leader>xx
|
||||
</td><td style="height: 29.8px;">Open diagnostics window
|
||||
</td></tr><tr style="height: 29.8px;"><td style="height: 29.8px;"><leader>xw</td><td style="height: 29.8px;">workspace diagnostics
|
||||
</td></tr><tr style="height: 29.8px;"><td style="height: 29.8px;"><leader>xd</td><td style="height: 29.8px;">document diagnostics
|
||||
</td></tr><tr style="height: 29.8px;"><td style="height: 29.8px;"><leader>xl</td><td style="height: 29.8px;">loclist</td></tr><tr style="height: 29.8px;"><td style="height: 29.8px;"><leader>xq</td><td style="height: 29.8px;">quickfix</td></tr><tr style="height: 29.8px;"><td style="height: 29.8px;">gR
|
||||
</td><td style="height: 29.8px;">lsp references
|
||||
</td></tr></tbody></table>
|
||||
|
||||
##### Sessions
|
||||
|
||||
To save **new** session on specific path, just use `:SaveSession`, then when opening nvim there, without arguments, the session will be restored.
|
||||
|
||||
##### Notifications
|
||||
|
||||
<table border="1" id="bkmrk-%3Anotifications-show-" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 50%;"></col><col style="width: 50%;"></col></colgroup><tbody><tr><td>:Notifications
|
||||
</td><td>show recent notifications
|
||||
</td></tr><tr><td>:Telescope notify
|
||||
</td><td>show recent notifications in telescope gui</td></tr></tbody></table>
|
||||
|
|
31
init.lua
31
init.lua
|
@ -1,13 +1,20 @@
|
|||
require("initializer")
|
||||
vim.opt.mouse = "c" -- set mouse in command line mode
|
||||
vim.opt.colorcolumn = "80" -- highlight this column
|
||||
vim.opt.relativenumber = true
|
||||
vim.opt.number = true
|
||||
vim.opt.clipboard = "unnamedplus" -- synchronize with system clipboard
|
||||
vim.opt.swapfile = false
|
||||
vim.opt.cursorline = true
|
||||
--make sure Lazy is installed
|
||||
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",
|
||||
"https://github.com/folke/lazy.nvim.git",
|
||||
"--branch=stable", -- latest stable release
|
||||
lazypath,
|
||||
})
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
vim.opt.termguicolors = true
|
||||
vim.cmd [[
|
||||
highlight clear
|
||||
colorscheme dracula
|
||||
]]
|
||||
|
||||
-- load all plugins
|
||||
require("lazy-load")
|
||||
-- load general config
|
||||
require("general")
|
||||
|
|
|
@ -1,45 +0,0 @@
|
|||
require('bufferline').setup {
|
||||
options = {
|
||||
mode = "buffers", -- set to "tabs" to only show tabpages instead
|
||||
numbers = "buffer_id",
|
||||
close_command = "bdelete! %d", -- can be a string | function, see "Mouse actions"
|
||||
right_mouse_command = "bdelete! %d", -- can be a string | function, see "Mouse actions"
|
||||
left_mouse_command = "buffer %d", -- can be a string | function, see "Mouse actions"
|
||||
middle_mouse_command = nil, -- can be a string | function, see "Mouse actions"
|
||||
indicator = {
|
||||
icon = '>', -- this should be omitted if indicator style is not 'icon'
|
||||
style = 'icon',
|
||||
},
|
||||
buffer_close_icon = '',
|
||||
modified_icon = '●',
|
||||
close_icon = '',
|
||||
left_trunc_marker = '',
|
||||
right_trunc_marker = '',
|
||||
max_name_length = 18,
|
||||
max_prefix_length = 15, -- prefix used when a buffer is de-duplicated
|
||||
truncate_names = true, -- whether or not tab names should be truncated
|
||||
tab_size = 18,
|
||||
diagnostics = "coc",
|
||||
diagnostics_update_in_insert = false,
|
||||
-- The diagnostics indicator can be set to nil to keep the buffer name highlight but delete the highlighting
|
||||
color_icons = true, -- whether or not to add the filetype icon highlights
|
||||
show_buffer_icons = true, -- disable filetype icons for buffers
|
||||
show_buffer_close_icons = true,
|
||||
show_buffer_default_icon = true, -- whether or not an unrecognised filetype should show a default icon
|
||||
show_close_icon = false,
|
||||
show_tab_indicators = true,
|
||||
show_duplicate_prefix = true, -- whether to show duplicate buffer prefix
|
||||
persist_buffer_sort = true, -- whether or not custom sorted buffers should persist
|
||||
-- can also be a table containing 2 custom separators
|
||||
-- [focused and unfocused]. eg: { '|', '|' }
|
||||
separator_style = "thick",
|
||||
enforce_regular_tabs = false,
|
||||
always_show_bufferline = true,
|
||||
hover = {
|
||||
enabled = true,
|
||||
delay = 200,
|
||||
reveal = { 'close' }
|
||||
},
|
||||
sort_by = 'tabs',
|
||||
}
|
||||
}
|
|
@ -1,80 +0,0 @@
|
|||
require('gitsigns').setup {
|
||||
signs = {
|
||||
add = { hl = 'GitSignsAdd', text = '│', numhl = 'GitSignsAddNr', linehl = 'GitSignsAddLn' },
|
||||
change = { hl = 'GitSignsChange', text = '│', numhl = 'GitSignsChangeNr', linehl = 'GitSignsChangeLn' },
|
||||
delete = { hl = 'GitSignsDelete', text = '_', numhl = 'GitSignsDeleteNr', linehl = 'GitSignsDeleteLn' },
|
||||
topdelete = { hl = 'GitSignsDelete', text = '‾', numhl = 'GitSignsDeleteNr', linehl = 'GitSignsDeleteLn' },
|
||||
changedelete = { hl = 'GitSignsChange', text = '~', numhl = 'GitSignsChangeNr', linehl = 'GitSignsChangeLn' },
|
||||
untracked = { hl = 'GitSignsAdd', text = '┆', numhl = 'GitSignsAddNr', linehl = 'GitSignsAddLn' },
|
||||
},
|
||||
signcolumn = true, -- Toggle with `:Gitsigns toggle_signs`
|
||||
numhl = false, -- Toggle with `:Gitsigns toggle_numhl`
|
||||
linehl = false, -- Toggle with `:Gitsigns toggle_linehl`
|
||||
word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff`
|
||||
watch_gitdir = {
|
||||
interval = 1000,
|
||||
follow_files = true
|
||||
},
|
||||
attach_to_untracked = true,
|
||||
current_line_blame = true, -- Toggle with `:Gitsigns toggle_current_line_blame`
|
||||
current_line_blame_opts = {
|
||||
virt_text = true,
|
||||
virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align'
|
||||
delay = 1000,
|
||||
ignore_whitespace = false,
|
||||
},
|
||||
current_line_blame_formatter = '<author>, <author_time:%Y-%m-%d> - <summary>',
|
||||
sign_priority = 6,
|
||||
update_debounce = 100,
|
||||
status_formatter = nil, -- Use default
|
||||
max_file_length = 40000, -- Disable if file is longer than this (in lines)
|
||||
preview_config = {
|
||||
-- Options passed to nvim_open_win
|
||||
border = 'single',
|
||||
style = 'minimal',
|
||||
relative = 'cursor',
|
||||
row = 0,
|
||||
col = 1
|
||||
},
|
||||
yadm = {
|
||||
enable = false
|
||||
},
|
||||
on_attach = function(bufnr)
|
||||
local gs = package.loaded.gitsigns
|
||||
|
||||
local function map(mode, l, r, opts)
|
||||
opts = opts or {}
|
||||
opts.buffer = bufnr
|
||||
vim.keymap.set(mode, l, r, opts)
|
||||
end
|
||||
|
||||
-- Navigation
|
||||
map('n', ']c', function()
|
||||
if vim.wo.diff then return ']c' end
|
||||
vim.schedule(function() gs.next_hunk() end)
|
||||
return '<Ignore>'
|
||||
end, { expr = true })
|
||||
|
||||
map('n', '[c', function()
|
||||
if vim.wo.diff then return '[c' end
|
||||
vim.schedule(function() gs.prev_hunk() end)
|
||||
return '<Ignore>'
|
||||
end, { expr = true })
|
||||
|
||||
-- Actions
|
||||
map({ 'n', 'v' }, '<leader>hs', ':Gitsigns stage_hunk<CR>')
|
||||
map({ 'n', 'v' }, '<leader>hr', ':Gitsigns reset_hunk<CR>')
|
||||
map('n', '<leader>hS', gs.stage_buffer)
|
||||
map('n', '<leader>hu', gs.undo_stage_hunk)
|
||||
map('n', '<leader>hR', gs.reset_buffer)
|
||||
map('n', '<C-g>', gs.preview_hunk)
|
||||
map('n', '<leader>hb', function() gs.blame_line { full = true } end)
|
||||
map('n', '<leader>tb', gs.toggle_current_line_blame)
|
||||
map('n', '<leader>hd', gs.diffthis)
|
||||
map('n', '<leader>hD', function() gs.diffthis('~') end)
|
||||
map('n', '<leader>td', gs.toggle_deleted)
|
||||
|
||||
-- Text object
|
||||
map({ 'o', 'x' }, 'ih', ':<C-U>Gitsigns select_hunk<CR>')
|
||||
end
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
require('hlslens').setup()
|
||||
|
||||
local kopts = { noremap = true, silent = true }
|
||||
|
||||
vim.api.nvim_set_keymap('n', 'n',
|
||||
[[<Cmd>execute('normal! ' . v:count1 . 'n')<CR><Cmd>lua require('hlslens').start()<CR>]],
|
||||
kopts)
|
||||
vim.api.nvim_set_keymap('n', 'N',
|
||||
[[<Cmd>execute('normal! ' . v:count1 . 'N')<CR><Cmd>lua require('hlslens').start()<CR>]],
|
||||
kopts)
|
||||
vim.api.nvim_set_keymap('n', '*', [[*<Cmd>lua require('hlslens').start()<CR>]], kopts)
|
||||
vim.api.nvim_set_keymap('n', '#', [[#<Cmd>lua require('hlslens').start()<CR>]], kopts)
|
||||
vim.api.nvim_set_keymap('n', 'g*', [[g*<Cmd>lua require('hlslens').start()<CR>]], kopts)
|
||||
vim.api.nvim_set_keymap('n', 'g#', [[g#<Cmd>lua require('hlslens').start()<CR>]], kopts)
|
||||
|
||||
vim.api.nvim_set_keymap('n', '<Leader>l', ':noh<CR>', kopts)
|
|
@ -1,5 +0,0 @@
|
|||
require("indent_blankline").setup {
|
||||
space_char_blankline = " ",
|
||||
show_current_context = true,
|
||||
show_current_context_start = true,
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
require('lualine').setup {
|
||||
options = {
|
||||
icons_enabled = true,
|
||||
theme = 'dracula',
|
||||
component_separators = { left = '', right = '' },
|
||||
section_separators = { left = '', right = '' },
|
||||
disabled_filetypes = {
|
||||
statusline = {},
|
||||
winbar = {},
|
||||
},
|
||||
ignore_focus = {},
|
||||
always_divide_middle = true,
|
||||
globalstatus = false,
|
||||
refresh = {
|
||||
statusline = 1000,
|
||||
tabline = 1000,
|
||||
winbar = 1000,
|
||||
}
|
||||
},
|
||||
sections = {
|
||||
lualine_a = { 'mode' },
|
||||
lualine_b = { 'branch', 'diff', 'diagnostics' },
|
||||
lualine_c = { 'filename' },
|
||||
lualine_x = { 'encoding', 'fileformat', 'filetype' },
|
||||
lualine_y = { 'progress' },
|
||||
lualine_z = { 'tabs' }
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = { 'filename' },
|
||||
lualine_x = { 'location' },
|
||||
lualine_y = {},
|
||||
lualine_z = {}
|
||||
},
|
||||
tabline = {},
|
||||
winbar = {},
|
||||
inactive_winbar = {},
|
||||
extensions = {
|
||||
'quickfix',
|
||||
'nvim-tree',
|
||||
'symbols-outline',
|
||||
'fugitive',
|
||||
'man'
|
||||
}
|
||||
|
||||
}
|
|
@ -1,71 +0,0 @@
|
|||
local cmp = require 'cmp'
|
||||
local lspkind = require('lspkind')
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
-- REQUIRED - you must specify a snippet engine
|
||||
expand = function(args)
|
||||
require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
|
||||
end,
|
||||
},
|
||||
window = {
|
||||
completion = cmp.config.window.bordered(),
|
||||
documentation = cmp.config.window.bordered(),
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
['<C-e>'] = cmp.mapping.abort(),
|
||||
['<CR>'] = cmp.mapping.confirm({ select = false }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lsp' },
|
||||
--{ name = 'vsnip' }, -- For vsnip users.
|
||||
{ name = 'luasnip' }, -- For luasnip users.
|
||||
-- { name = 'ultisnips' }, -- For ultisnips users.
|
||||
-- { name = 'snippy' }, -- For snippy users.
|
||||
}, {
|
||||
{ name = 'buffer' },
|
||||
{ name = 'path' },
|
||||
}),
|
||||
formatting = {
|
||||
format = lspkind.cmp_format({
|
||||
--mode = 'symbol', -- show only symbol annotations
|
||||
maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters)
|
||||
ellipsis_char = '...', -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead (must define maxwidth first)
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
-- Set configuration for specific filetype.
|
||||
cmp.setup.filetype('gitcommit', {
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'cmp_git' }, -- You can specify the `cmp_git` source if you were installed it.
|
||||
}, {
|
||||
{ name = 'buffer' },
|
||||
})
|
||||
})
|
||||
|
||||
-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline({ '/', '?' }, {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = {
|
||||
{ name = 'buffer' }
|
||||
}
|
||||
})
|
||||
|
||||
-- `:` cmdline setup.
|
||||
cmp.setup.cmdline(':', {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'path' }
|
||||
}, {
|
||||
{
|
||||
name = 'cmdline',
|
||||
option = {
|
||||
ignore_cmds = { 'Man', '!' }
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
|
@ -1,69 +0,0 @@
|
|||
require("nvim-tree").setup({
|
||||
hijack_cursor = true,
|
||||
sync_root_with_cwd = true,
|
||||
view = {
|
||||
adaptive_size = true,
|
||||
},
|
||||
renderer = {
|
||||
full_name = true,
|
||||
group_empty = true,
|
||||
special_files = {},
|
||||
symlink_destination = false,
|
||||
indent_markers = {
|
||||
enable = true,
|
||||
},
|
||||
icons = {
|
||||
git_placement = "signcolumn",
|
||||
show = {
|
||||
file = true,
|
||||
folder = true,
|
||||
folder_arrow = true,
|
||||
git = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
update_focused_file = {
|
||||
enable = true,
|
||||
update_root = true,
|
||||
ignore_list = { "help" },
|
||||
},
|
||||
diagnostics = {
|
||||
enable = true,
|
||||
show_on_dirs = true,
|
||||
},
|
||||
filters = {
|
||||
custom = {},
|
||||
dotfiles = false,
|
||||
},
|
||||
actions = {
|
||||
change_dir = {
|
||||
enable = false,
|
||||
restrict_above_cwd = true,
|
||||
},
|
||||
open_file = {
|
||||
resize_window = true,
|
||||
},
|
||||
remove_file = {
|
||||
close_window = false,
|
||||
},
|
||||
},
|
||||
log = {
|
||||
enable = false,
|
||||
truncate = true,
|
||||
types = {
|
||||
all = false,
|
||||
config = false,
|
||||
copy_paste = false,
|
||||
diagnostics = false,
|
||||
git = false,
|
||||
profile = false,
|
||||
watcher = false,
|
||||
},
|
||||
},
|
||||
git = {
|
||||
enable = true,
|
||||
ignore = false,
|
||||
show_on_dirs = true,
|
||||
timeout = 400,
|
||||
},
|
||||
})
|
|
@ -1,42 +0,0 @@
|
|||
require'nvim-treesitter.configs'.setup {
|
||||
-- A list of parser names, or "all"
|
||||
ensure_installed = { "html", "dockerfile", "cpp", "css", "markdown", "c", "gitcommit", "bash", "phpdoc", "comment", "python", "http", "php", "regex", "json5", "lua", "gitattributes", "gitignore", "json", "git_rebase", "javascript", "perl", "sql", "yaml" },
|
||||
|
||||
-- Install parsers synchronously (only applied to `ensure_installed`)
|
||||
sync_install = true,
|
||||
|
||||
-- Automatically install missing parsers when entering buffer
|
||||
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
|
||||
auto_install = true,
|
||||
|
||||
-- List of parsers to ignore installing (for "all")
|
||||
--ignore_install = { "javascript" },
|
||||
|
||||
---- If you need to change the installation directory of the parsers (see -> Advanced Setup)
|
||||
-- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")!
|
||||
|
||||
highlight = {
|
||||
-- `false` will disable the whole extension
|
||||
enable = true,
|
||||
|
||||
-- NOTE: these are the names of the parsers and not the filetype. (for example if you want to
|
||||
-- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is
|
||||
-- the name of the parser)
|
||||
-- list of language that will be disabled
|
||||
--disable = { "c", "rust" },
|
||||
-- Or use a function for more flexibility, e.g. to disable slow treesitter highlight for large files
|
||||
--disable = function(lang, buf)
|
||||
--local max_filesize = 100 * 1024 -- 100 KB
|
||||
--local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
|
||||
--if ok and stats and stats.size > max_filesize then
|
||||
--return true
|
||||
--end
|
||||
--end,
|
||||
|
||||
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
|
||||
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
|
||||
-- Using this option may slow down your editor, and you may see some duplicate highlights.
|
||||
-- Instead of true it can also be a list of languages
|
||||
additional_vim_regex_highlighting = true, -- default=false
|
||||
},
|
||||
}
|
|
@ -27,3 +27,17 @@ map("i", "<S-Tab>", "<Esc><<i")
|
|||
map("n", "<Tab>", ">>")
|
||||
map("v", "<Tab>", ">gv")
|
||||
map("v", "<S-Tab>", "<gv")
|
||||
|
||||
|
||||
vim.opt.mouse = "c" -- set mouse in command line mode
|
||||
vim.opt.colorcolumn = "80" -- highlight this column
|
||||
vim.opt.relativenumber = true
|
||||
vim.opt.number = true
|
||||
vim.opt.clipboard = "unnamedplus" -- synchronize with system clipboard
|
||||
vim.opt.swapfile = false
|
||||
vim.opt.cursorline = true
|
||||
vim.cmd [[
|
||||
highlight clear
|
||||
colorscheme dracula
|
||||
]]
|
||||
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
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",
|
||||
"https://github.com/folke/lazy.nvim.git",
|
||||
"--branch=stable", -- latest stable release
|
||||
lazypath,
|
||||
})
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
-- load all modules
|
||||
require("lazy-setup")
|
||||
require("general")
|
||||
require("my-lint")
|
||||
require("conf-hlslens")
|
||||
require("conf-gitsigns")
|
||||
require("conf-lualine")
|
||||
require("conf-nvim-cmp")
|
||||
require("conf-nvim-tree")
|
||||
require("conf-bufferline")
|
||||
require("conf-treesitter")
|
||||
require("conf-indent-blankline")
|
||||
require("my-lspconfig") -- need to be after treesitter initialization
|
|
@ -1,55 +1,58 @@
|
|||
require("lazy").setup({
|
||||
-- NERDTree stuff
|
||||
-- Nvim-tree stuff
|
||||
{ 'nvim-tree/nvim-web-devicons' }, -- optional, for file icons
|
||||
{ 'nvim-tree/nvim-tree.lua',
|
||||
keys = {
|
||||
{ "<leader>n", "<cmd>NvimTreeFocus<cr>" },
|
||||
{ "<C-t>", "<cmd>NvimTreeToggle<cr>" }
|
||||
} },
|
||||
config = require('plugins.nvim-tree').config,
|
||||
keys = require('plugins.nvim-tree').keys },
|
||||
|
||||
-- neovim lsp plugins and depencencies
|
||||
{ 'neovim/nvim-lspconfig' },
|
||||
{ 'neovim/nvim-lspconfig',
|
||||
init = require('plugins.nvim-lspconfig').init },
|
||||
{ 'hrsh7th/cmp-nvim-lsp' },
|
||||
{ 'hrsh7th/cmp-buffer' },
|
||||
{ 'hrsh7th/cmp-cmdline' },
|
||||
{ 'hrsh7th/cmp-path' },
|
||||
{ 'hrsh7th/nvim-cmp' },
|
||||
{ 'hrsh7th/nvim-cmp',
|
||||
init = require('plugins.nvim-cmp').init,
|
||||
dependencies = { { 'onsails/lspkind.nvim' } } },
|
||||
{ 'williamboman/mason.nvim',
|
||||
config = {} },
|
||||
{ 'williamboman/mason-lspconfig.nvim',
|
||||
config = require('plugins.mason-lspconfig').config,
|
||||
dependencies = { 'williamboman/mason.nvim' } },
|
||||
{ 'mfussenegger/nvim-lint' },
|
||||
{ 'onsails/lspkind.nvim' },
|
||||
{ 'mfussenegger/nvim-lint',
|
||||
init = require('plugins.nvim-lint').init },
|
||||
{},
|
||||
{ 'folke/trouble.nvim',
|
||||
config = require('plugins.trouble').config,
|
||||
keys = require("plugins.trouble").keys
|
||||
},
|
||||
|
||||
-- various plugins
|
||||
{ 'lewis6991/gitsigns.nvim' },
|
||||
{ 'lewis6991/gitsigns.nvim',
|
||||
config = require('plugins.gitsigns').config },
|
||||
{ 'petertriho/nvim-scrollbar',
|
||||
config = {} },
|
||||
{ 'kevinhwang91/nvim-hlslens' },
|
||||
{ 'L3MON4D3/LuaSnip', version = '*' },
|
||||
{ 'kevinhwang91/nvim-hlslens', config = {},
|
||||
keys = require('plugins.hlslens').keys },
|
||||
{ 'L3MON4D3/LuaSnip', version = '*' },
|
||||
{ 'saadparwaiz1/cmp_luasnip' },
|
||||
{ 'lambdalisue/suda.vim' },
|
||||
{ 'akinsho/bufferline.nvim', version = '*' },
|
||||
{ 'akinsho/bufferline.nvim', version = '*',
|
||||
config = require('plugins.bufferline').config },
|
||||
{ 'gorbit99/codewindow.nvim',
|
||||
config = require('plugins.codewindow').config,
|
||||
init = require('plugins.codewindow').build
|
||||
},
|
||||
{ 'preservim/nerdcommenter',
|
||||
keys = {
|
||||
{ "<c-/>", "<plug>NERDCommenterToggle", mode = "v" },
|
||||
{ "<c-/>", "<plug>NERDCommenterToggle", mode = "n" }
|
||||
} },
|
||||
keys = require('plugins.nerdcommenter').keys },
|
||||
{ 'rmagatti/auto-session' },
|
||||
{ 'tpope/vim-fugitive' },
|
||||
{ 'Glench/Vim-Jinja2-Syntax' },
|
||||
{ 'vmware-archive/salt-vim' },
|
||||
{ 'stephpy/vim-yaml' },
|
||||
{ 'lukas-reineke/indent-blankline.nvim' },
|
||||
{ 'stephpy/vim-yaml' }, -- for proper sls syntax highlighting when jinja
|
||||
{ 'lukas-reineke/indent-blankline.nvim',
|
||||
config = require('plugins.indent-blankline').config },
|
||||
{ 'MunifTanjim/nui.nvim' },
|
||||
{ 'folke/noice.nvim',
|
||||
config = require("plugins.noice").config,
|
||||
|
@ -59,8 +62,9 @@ require("lazy").setup({
|
|||
-- `nvim-notify` is only needed, if you want to use the notification view.
|
||||
-- If not available, we use `mini` as the fallback
|
||||
"rcarriga/nvim-notify", } },
|
||||
|
||||
{ 'nvim-lualine/lualine.nvim' },
|
||||
{ 'rcarriga/nvim-notify', config = require('plugins.nvim-notify').config },
|
||||
{ 'nvim-lualine/lualine.nvim',
|
||||
config = require('plugins.lualine').config },
|
||||
{ 'RRethy/vim-illuminate' },
|
||||
{ 'sheerun/vim-polyglot' },
|
||||
|
||||
|
@ -90,7 +94,9 @@ require("lazy").setup({
|
|||
|
||||
},
|
||||
{ 'BurntSushi/ripgrep' },
|
||||
{ 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate' },
|
||||
{ 'nvim-treesitter/nvim-treesitter',
|
||||
config = require('plugins.treesitter').config,
|
||||
build = ':TSUpdate' },
|
||||
|
||||
},
|
||||
{
|
|
@ -1,37 +0,0 @@
|
|||
require('lint').linters_by_ft = {
|
||||
--python = {
|
||||
--'ruff'
|
||||
--'flake8',
|
||||
--'pylint',
|
||||
--'pycodestyle',
|
||||
--'pydocstyle'
|
||||
--},
|
||||
php = { 'phpcs' },
|
||||
markdown = { 'markdownlint' }
|
||||
}
|
||||
|
||||
--local pydocstyle = require('lint.linters.pydocstyle')
|
||||
--pydocstyle.args = {
|
||||
--'--ignore=D100,D203,D213', -- disable missing module docstring info
|
||||
---- disable one line before class docstring required
|
||||
---- disable multiline docstring summary
|
||||
---- should start at the second line
|
||||
--}
|
||||
--local pylint = require('lint.linters.pylint')
|
||||
--pylint.args = {
|
||||
--'-f',
|
||||
--'json',
|
||||
--'--disable=C0114', -- disable missing module docstring info
|
||||
--}
|
||||
|
||||
--vim.api.nvim_create_autocmd({ "BufWritePost" }, {
|
||||
--callback = function()
|
||||
--require("lint").try_lint()
|
||||
--end,
|
||||
--})
|
||||
|
||||
vim.api.nvim_create_autocmd({ "BufEnter" }, {
|
||||
callback = function()
|
||||
require("lint").try_lint()
|
||||
end,
|
||||
})
|
|
@ -1,193 +0,0 @@
|
|||
-- setup nvim-lspconfig
|
||||
-- Mappings.
|
||||
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
|
||||
local opts = { noremap = true, silent = true }
|
||||
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts)
|
||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
|
||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
|
||||
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts)
|
||||
|
||||
-- Use an on_attach function to only map the following keys
|
||||
-- after the language server attaches to the current buffer
|
||||
local on_attach = function(_, bufnr)
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||
|
||||
-- Mappings.
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
local bufopts = { noremap = true, silent = true, buffer = bufnr }
|
||||
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
|
||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
|
||||
vim.keymap.set('n', '<leader>k', vim.lsp.buf.hover, bufopts)
|
||||
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
|
||||
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts)
|
||||
vim.keymap.set('n', '<leader>wa', vim.lsp.buf.add_workspace_folder, bufopts)
|
||||
vim.keymap.set('n', '<leader>wr', vim.lsp.buf.remove_workspace_folder, bufopts)
|
||||
vim.keymap.set('n', '<leader>wl', function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, bufopts)
|
||||
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, bufopts)
|
||||
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, bufopts)
|
||||
vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts)
|
||||
vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
|
||||
vim.keymap.set('n', '<leader>f', function() vim.lsp.buf.format { async = true } end, bufopts)
|
||||
end
|
||||
|
||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||
|
||||
|
||||
-----------------
|
||||
-- attaching all lsp servers, order matters (for example in autocompletion)
|
||||
-----------------
|
||||
require 'lspconfig'.pylsp.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities
|
||||
, settings = {
|
||||
pylsp = {
|
||||
plugins = {
|
||||
rope_autoimport = { enabled = false, memory = true },
|
||||
rope_completion = { enabled = false, eager = true },
|
||||
jedi_completion = {
|
||||
enabled = true,
|
||||
include_params = true,
|
||||
include_class_objects = true,
|
||||
include_function_objects = true,
|
||||
fuzzy = true,
|
||||
eager = true,
|
||||
|
||||
},
|
||||
jedi_hover = { enabled = true },
|
||||
jedi_references = { enabled = true },
|
||||
jedi_signature_help = { enabled = true },
|
||||
jedi_symbols = { enabled = true },
|
||||
--ruff = { enabled = true },
|
||||
flake8 = {
|
||||
enabled = false -- ruff_lsp
|
||||
},
|
||||
pylint = {
|
||||
enabled = true,
|
||||
args = {
|
||||
-- disable missing module docstring info
|
||||
-- and temporarilt false cannot import errors
|
||||
'--disable=C0114,E0401'
|
||||
}
|
||||
},
|
||||
yapf = {
|
||||
enabled = true
|
||||
},
|
||||
autopep8 = {
|
||||
enabled = false
|
||||
},
|
||||
pyflakes = { enabled = false }, -- ruff_lsp
|
||||
pyodestyle = { enabled = false }, -- ruff_lsp
|
||||
pydocstyle = {
|
||||
enabled = true,
|
||||
ignore = {
|
||||
'D100', -- disable missing module docstring info
|
||||
'D203', -- disable one line before class docstring required
|
||||
'D213' -- disable multiline docstring summary
|
||||
-- should start at the second line
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
require'lspconfig'.ruff_lsp.setup{
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
require 'lspconfig'.pyright.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
require 'lspconfig'.sourcekit.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
require 'lspconfig'.bashls.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
require 'lspconfig'.dockerls.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
require 'lspconfig'.intelephense.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
require 'lspconfig'.eslint.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
require 'lspconfig'.tsserver.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
require 'lspconfig'.perlnavigator.setup {
|
||||
settings = {
|
||||
perlnavigator = {
|
||||
perlPath = 'perl',
|
||||
enableWarnings = true,
|
||||
perltidyProfile = '',
|
||||
perlcriticProfile = '',
|
||||
perlcriticEnabled = true,
|
||||
}
|
||||
},
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
|
||||
require 'lspconfig'.cssls.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
|
||||
require 'lspconfig'.cssmodules_ls.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
|
||||
require 'lspconfig'.diagnosticls.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
|
||||
require 'lspconfig'.jsonls.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
|
||||
require 'lspconfig'.sumneko_lua.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = {
|
||||
-- Get the language server to recognize the `vim` global
|
||||
globals = { 'vim' },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
require 'lspconfig'.sqlls.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
|
||||
require 'lspconfig'.yamlls.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
|
||||
require 'lspconfig'.lemminx.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
|
||||
require 'lspconfig'.marksman.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
47
lua/plugins/bufferline.lua
Normal file
47
lua/plugins/bufferline.lua
Normal file
|
@ -0,0 +1,47 @@
|
|||
return {
|
||||
config = {
|
||||
options = {
|
||||
mode = "buffers", -- set to "tabs" to only show tabpages instead
|
||||
numbers = "buffer_id",
|
||||
close_command = "bdelete! %d", -- can be a string | function, see "Mouse actions"
|
||||
right_mouse_command = "bdelete! %d", -- can be a string | function, see "Mouse actions"
|
||||
left_mouse_command = "buffer %d", -- can be a string | function, see "Mouse actions"
|
||||
middle_mouse_command = nil, -- can be a string | function, see "Mouse actions"
|
||||
indicator = {
|
||||
icon = '>', -- this should be omitted if indicator style is not 'icon'
|
||||
style = 'icon',
|
||||
},
|
||||
buffer_close_icon = '',
|
||||
modified_icon = '●',
|
||||
close_icon = '',
|
||||
left_trunc_marker = '',
|
||||
right_trunc_marker = '',
|
||||
max_name_length = 18,
|
||||
max_prefix_length = 15, -- prefix used when a buffer is de-duplicated
|
||||
truncate_names = true, -- whether or not tab names should be truncated
|
||||
tab_size = 18,
|
||||
diagnostics = "coc",
|
||||
diagnostics_update_in_insert = false,
|
||||
-- The diagnostics indicator can be set to nil to keep the buffer name highlight but delete the highlighting
|
||||
color_icons = true, -- whether or not to add the filetype icon highlights
|
||||
show_buffer_icons = true, -- disable filetype icons for buffers
|
||||
show_buffer_close_icons = true,
|
||||
show_buffer_default_icon = true, -- whether or not an unrecognised filetype should show a default icon
|
||||
show_close_icon = false,
|
||||
show_tab_indicators = true,
|
||||
show_duplicate_prefix = true, -- whether to show duplicate buffer prefix
|
||||
persist_buffer_sort = true, -- whether or not custom sorted buffers should persist
|
||||
-- can also be a table containing 2 custom separators
|
||||
-- [focused and unfocused]. eg: { '|', '|' }
|
||||
separator_style = "thick",
|
||||
enforce_regular_tabs = false,
|
||||
always_show_bufferline = true,
|
||||
hover = {
|
||||
enabled = true,
|
||||
delay = 200,
|
||||
reveal = { 'close' }
|
||||
},
|
||||
sort_by = 'tabs',
|
||||
}
|
||||
}
|
||||
}
|
82
lua/plugins/gitsigns.lua
Normal file
82
lua/plugins/gitsigns.lua
Normal file
|
@ -0,0 +1,82 @@
|
|||
return {
|
||||
config = {
|
||||
signs = {
|
||||
add = { hl = 'GitSignsAdd', text = '│', numhl = 'GitSignsAddNr', linehl = 'GitSignsAddLn' },
|
||||
change = { hl = 'GitSignsChange', text = '│', numhl = 'GitSignsChangeNr', linehl = 'GitSignsChangeLn' },
|
||||
delete = { hl = 'GitSignsDelete', text = '_', numhl = 'GitSignsDeleteNr', linehl = 'GitSignsDeleteLn' },
|
||||
topdelete = { hl = 'GitSignsDelete', text = '‾', numhl = 'GitSignsDeleteNr', linehl = 'GitSignsDeleteLn' },
|
||||
changedelete = { hl = 'GitSignsChange', text = '~', numhl = 'GitSignsChangeNr', linehl = 'GitSignsChangeLn' },
|
||||
untracked = { hl = 'GitSignsAdd', text = '┆', numhl = 'GitSignsAddNr', linehl = 'GitSignsAddLn' },
|
||||
},
|
||||
signcolumn = true, -- Toggle with `:Gitsigns toggle_signs`
|
||||
numhl = false, -- Toggle with `:Gitsigns toggle_numhl`
|
||||
linehl = false, -- Toggle with `:Gitsigns toggle_linehl`
|
||||
word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff`
|
||||
watch_gitdir = {
|
||||
interval = 1000,
|
||||
follow_files = true
|
||||
},
|
||||
attach_to_untracked = true,
|
||||
current_line_blame = true, -- Toggle with `:Gitsigns toggle_current_line_blame`
|
||||
current_line_blame_opts = {
|
||||
virt_text = true,
|
||||
virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align'
|
||||
delay = 1000,
|
||||
ignore_whitespace = false,
|
||||
},
|
||||
current_line_blame_formatter = '<author>, <author_time:%Y-%m-%d> - <summary>',
|
||||
sign_priority = 6,
|
||||
update_debounce = 100,
|
||||
status_formatter = nil, -- Use default
|
||||
max_file_length = 40000, -- Disable if file is longer than this (in lines)
|
||||
preview_config = {
|
||||
-- Options passed to nvim_open_win
|
||||
border = 'single',
|
||||
style = 'minimal',
|
||||
relative = 'cursor',
|
||||
row = 0,
|
||||
col = 1
|
||||
},
|
||||
yadm = {
|
||||
enable = false
|
||||
},
|
||||
on_attach = function(bufnr)
|
||||
local gs = package.loaded.gitsigns
|
||||
|
||||
local function map(mode, l, r, opts)
|
||||
opts = opts or {}
|
||||
opts.buffer = bufnr
|
||||
vim.keymap.set(mode, l, r, opts)
|
||||
end
|
||||
|
||||
-- Navigation
|
||||
map('n', ']c', function()
|
||||
if vim.wo.diff then return ']c' end
|
||||
vim.schedule(function() gs.next_hunk() end)
|
||||
return '<Ignore>'
|
||||
end, { expr = true })
|
||||
|
||||
map('n', '[c', function()
|
||||
if vim.wo.diff then return '[c' end
|
||||
vim.schedule(function() gs.prev_hunk() end)
|
||||
return '<Ignore>'
|
||||
end, { expr = true })
|
||||
|
||||
-- Actions
|
||||
map({ 'n', 'v' }, '<leader>hs', ':Gitsigns stage_hunk<CR>')
|
||||
map({ 'n', 'v' }, '<leader>hr', ':Gitsigns reset_hunk<CR>')
|
||||
map('n', '<leader>hS', gs.stage_buffer)
|
||||
map('n', '<leader>hu', gs.undo_stage_hunk)
|
||||
map('n', '<leader>hR', gs.reset_buffer)
|
||||
map('n', '<C-g>', gs.preview_hunk)
|
||||
map('n', '<leader>hb', function() gs.blame_line { full = true } end)
|
||||
map('n', '<leader>tb', gs.toggle_current_line_blame)
|
||||
map('n', '<leader>hd', gs.diffthis)
|
||||
map('n', '<leader>hD', function() gs.diffthis('~') end)
|
||||
map('n', '<leader>td', gs.toggle_deleted)
|
||||
|
||||
-- Text object
|
||||
map({ 'o', 'x' }, 'ih', ':<C-U>Gitsigns select_hunk<CR>')
|
||||
end
|
||||
}
|
||||
}
|
4
lua/plugins/hlslens.lua
Normal file
4
lua/plugins/hlslens.lua
Normal file
|
@ -0,0 +1,4 @@
|
|||
return {
|
||||
keys = {
|
||||
{ '<leader>l', '<cmd>nohl<cr>' } }
|
||||
}
|
7
lua/plugins/indent-blankline.lua
Normal file
7
lua/plugins/indent-blankline.lua
Normal file
|
@ -0,0 +1,7 @@
|
|||
return {
|
||||
config = {
|
||||
space_char_blankline = " ",
|
||||
show_current_context = true,
|
||||
show_current_context_start = true,
|
||||
}
|
||||
}
|
49
lua/plugins/lualine.lua
Normal file
49
lua/plugins/lualine.lua
Normal file
|
@ -0,0 +1,49 @@
|
|||
return {
|
||||
config = {
|
||||
options = {
|
||||
icons_enabled = true,
|
||||
theme = 'dracula',
|
||||
component_separators = { left = '', right = '' },
|
||||
section_separators = { left = '', right = '' },
|
||||
disabled_filetypes = {
|
||||
statusline = {},
|
||||
winbar = {},
|
||||
},
|
||||
ignore_focus = {},
|
||||
always_divide_middle = true,
|
||||
globalstatus = false,
|
||||
refresh = {
|
||||
statusline = 1000,
|
||||
tabline = 1000,
|
||||
winbar = 1000,
|
||||
}
|
||||
},
|
||||
sections = {
|
||||
lualine_a = { 'mode' },
|
||||
lualine_b = { 'branch', 'diff', 'diagnostics' },
|
||||
lualine_c = { 'filename' },
|
||||
lualine_x = { 'encoding', 'fileformat', 'filetype' },
|
||||
lualine_y = { 'progress' },
|
||||
lualine_z = { 'tabs' }
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = { 'filename' },
|
||||
lualine_x = { 'location' },
|
||||
lualine_y = {},
|
||||
lualine_z = {}
|
||||
},
|
||||
tabline = {},
|
||||
winbar = {},
|
||||
inactive_winbar = {},
|
||||
extensions = {
|
||||
'quickfix',
|
||||
'nvim-tree',
|
||||
'symbols-outline',
|
||||
'fugitive',
|
||||
'man'
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -15,7 +15,7 @@ return {
|
|||
"cssmodules_ls",
|
||||
"diagnosticls",
|
||||
"jsonls",
|
||||
"sumneko_lua",
|
||||
"lua_ls",
|
||||
"sqlls",
|
||||
"yamlls",
|
||||
"lemminx",
|
||||
|
|
6
lua/plugins/nerdcommenter.lua
Normal file
6
lua/plugins/nerdcommenter.lua
Normal file
|
@ -0,0 +1,6 @@
|
|||
return {
|
||||
keys = {
|
||||
{ "<c-/>", "<plug>NERDCommenterToggle", mode = "v" },
|
||||
{ "<c-/>", "<plug>NERDCommenterToggle", mode = "n" }
|
||||
}
|
||||
}
|
75
lua/plugins/nvim-cmp.lua
Normal file
75
lua/plugins/nvim-cmp.lua
Normal file
|
@ -0,0 +1,75 @@
|
|||
return {
|
||||
init = function()
|
||||
local cmp = require 'cmp'
|
||||
local lspkind = require('lspkind')
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
-- REQUIRED - you must specify a snippet engine
|
||||
expand = function(args)
|
||||
require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
|
||||
end,
|
||||
},
|
||||
window = {
|
||||
completion = cmp.config.window.bordered(),
|
||||
documentation = cmp.config.window.bordered(),
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
['<C-b>'] = cmp.mapping.scroll_docs( -4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
['<C-e>'] = cmp.mapping.abort(),
|
||||
['<CR>'] = cmp.mapping.confirm({ select = false }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lsp' },
|
||||
--{ name = 'vsnip' }, -- For vsnip users.
|
||||
{ name = 'luasnip' }, -- For luasnip users.
|
||||
-- { name = 'ultisnips' }, -- For ultisnips users.
|
||||
-- { name = 'snippy' }, -- For snippy users.
|
||||
}, {
|
||||
{ name = 'buffer' },
|
||||
{ name = 'path' },
|
||||
}),
|
||||
formatting = {
|
||||
format = lspkind.cmp_format({
|
||||
--mode = 'symbol', -- show only symbol annotations
|
||||
maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters)
|
||||
ellipsis_char = '...', -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead (must define maxwidth first)
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
-- Set configuration for specific filetype.
|
||||
cmp.setup.filetype('gitcommit', {
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'cmp_git' }, -- You can specify the `cmp_git` source if you were installed it.
|
||||
}, {
|
||||
{ name = 'buffer' },
|
||||
})
|
||||
})
|
||||
|
||||
-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline({ '/', '?' }, {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = {
|
||||
{ name = 'buffer' }
|
||||
}
|
||||
})
|
||||
|
||||
-- `:` cmdline setup.
|
||||
cmp.setup.cmdline(':', {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'path' }
|
||||
}, {
|
||||
{
|
||||
name = 'cmdline',
|
||||
option = {
|
||||
ignore_cmds = { 'Man', '!' }
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
end
|
||||
}
|
41
lua/plugins/nvim-lint.lua
Normal file
41
lua/plugins/nvim-lint.lua
Normal file
|
@ -0,0 +1,41 @@
|
|||
return {
|
||||
init = function()
|
||||
require('lint').linters_by_ft = {
|
||||
--python = {
|
||||
--'ruff'
|
||||
--'flake8',
|
||||
--'pylint',
|
||||
--'pycodestyle',
|
||||
--'pydocstyle'
|
||||
--},
|
||||
php = { 'phpcs' },
|
||||
markdown = { 'markdownlint' }
|
||||
}
|
||||
|
||||
--local pydocstyle = require('lint.linters.pydocstyle')
|
||||
--pydocstyle.args = {
|
||||
--'--ignore=D100,D203,D213', -- disable missing module docstring info
|
||||
---- disable one line before class docstring required
|
||||
---- disable multiline docstring summary
|
||||
---- should start at the second line
|
||||
--}
|
||||
--local pylint = require('lint.linters.pylint')
|
||||
--pylint.args = {
|
||||
--'-f',
|
||||
--'json',
|
||||
--'--disable=C0114', -- disable missing module docstring info
|
||||
--}
|
||||
|
||||
--vim.api.nvim_create_autocmd({ "BufWritePost" }, {
|
||||
--callback = function()
|
||||
--require("lint").try_lint()
|
||||
--end,
|
||||
--})
|
||||
|
||||
vim.api.nvim_create_autocmd({ "BufEnter" }, {
|
||||
callback = function()
|
||||
require("lint").try_lint()
|
||||
end,
|
||||
})
|
||||
end
|
||||
}
|
197
lua/plugins/nvim-lspconfig.lua
Normal file
197
lua/plugins/nvim-lspconfig.lua
Normal file
|
@ -0,0 +1,197 @@
|
|||
return {
|
||||
init = function()
|
||||
-- setup nvim-lspconfig
|
||||
-- Mappings.
|
||||
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
|
||||
local opts = { noremap = true, silent = true }
|
||||
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts)
|
||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
|
||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
|
||||
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts)
|
||||
|
||||
-- Use an on_attach function to only map the following keys
|
||||
-- after the language server attaches to the current buffer
|
||||
local on_attach = function(_, bufnr)
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||
|
||||
-- Mappings.
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
local bufopts = { noremap = true, silent = true, buffer = bufnr }
|
||||
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
|
||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
|
||||
vim.keymap.set('n', '<leader>k', vim.lsp.buf.hover, bufopts)
|
||||
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
|
||||
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts)
|
||||
vim.keymap.set('n', '<leader>wa', vim.lsp.buf.add_workspace_folder, bufopts)
|
||||
vim.keymap.set('n', '<leader>wr', vim.lsp.buf.remove_workspace_folder, bufopts)
|
||||
vim.keymap.set('n', '<leader>wl', function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, bufopts)
|
||||
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, bufopts)
|
||||
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, bufopts)
|
||||
vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts)
|
||||
vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
|
||||
vim.keymap.set('n', '<leader>f', function() vim.lsp.buf.format { async = true } end, bufopts)
|
||||
end
|
||||
|
||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||
|
||||
|
||||
-----------------
|
||||
-- attaching all lsp servers, order matters (for example in autocompletion)
|
||||
-----------------
|
||||
require 'lspconfig'.pylsp.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities
|
||||
, settings = {
|
||||
pylsp = {
|
||||
plugins = {
|
||||
rope_autoimport = { enabled = false, memory = true },
|
||||
rope_completion = { enabled = false, eager = true },
|
||||
jedi_completion = {
|
||||
enabled = true,
|
||||
include_params = true,
|
||||
include_class_objects = true,
|
||||
include_function_objects = true,
|
||||
fuzzy = true,
|
||||
eager = true,
|
||||
|
||||
},
|
||||
jedi_hover = { enabled = true },
|
||||
jedi_references = { enabled = true },
|
||||
jedi_signature_help = { enabled = true },
|
||||
jedi_symbols = { enabled = true },
|
||||
--ruff = { enabled = true },
|
||||
flake8 = {
|
||||
enabled = false -- ruff_lsp
|
||||
},
|
||||
pylint = {
|
||||
enabled = true,
|
||||
args = {
|
||||
-- disable missing module docstring info
|
||||
-- and temporarilt false cannot import errors
|
||||
'--disable=C0114,E0401'
|
||||
}
|
||||
},
|
||||
yapf = {
|
||||
enabled = true
|
||||
},
|
||||
autopep8 = {
|
||||
enabled = false
|
||||
},
|
||||
pyflakes = { enabled = false }, -- ruff_lsp
|
||||
pyodestyle = { enabled = false }, -- ruff_lsp
|
||||
pydocstyle = {
|
||||
enabled = true,
|
||||
ignore = {
|
||||
'D100', -- disable missing module docstring info
|
||||
'D203', -- disable one line before class docstring required
|
||||
'D213' -- disable multiline docstring summary
|
||||
-- should start at the second line
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
require 'lspconfig'.ruff_lsp.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
require 'lspconfig'.pyright.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
require 'lspconfig'.sourcekit.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
require 'lspconfig'.bashls.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
require 'lspconfig'.dockerls.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
require 'lspconfig'.intelephense.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
require 'lspconfig'.eslint.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
require 'lspconfig'.tsserver.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
require 'lspconfig'.perlnavigator.setup {
|
||||
settings = {
|
||||
perlnavigator = {
|
||||
perlPath = 'perl',
|
||||
enableWarnings = true,
|
||||
perltidyProfile = '',
|
||||
perlcriticProfile = '',
|
||||
perlcriticEnabled = true,
|
||||
}
|
||||
},
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
|
||||
require 'lspconfig'.cssls.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
|
||||
require 'lspconfig'.cssmodules_ls.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
|
||||
require 'lspconfig'.diagnosticls.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
|
||||
require 'lspconfig'.jsonls.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
|
||||
require 'lspconfig'.lua_ls.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = {
|
||||
-- Get the language server to recognize the `vim` global
|
||||
globals = { 'vim' },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
require 'lspconfig'.sqlls.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
|
||||
require 'lspconfig'.yamlls.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
|
||||
require 'lspconfig'.lemminx.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
|
||||
require 'lspconfig'.marksman.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
end
|
||||
}
|
5
lua/plugins/nvim-notify.lua
Normal file
5
lua/plugins/nvim-notify.lua
Normal file
|
@ -0,0 +1,5 @@
|
|||
return {
|
||||
config = {
|
||||
timeout = 2500
|
||||
}
|
||||
}
|
75
lua/plugins/nvim-tree.lua
Normal file
75
lua/plugins/nvim-tree.lua
Normal file
|
@ -0,0 +1,75 @@
|
|||
return {
|
||||
config = {
|
||||
hijack_cursor = true,
|
||||
sync_root_with_cwd = true,
|
||||
view = {
|
||||
adaptive_size = true,
|
||||
},
|
||||
renderer = {
|
||||
full_name = true,
|
||||
group_empty = true,
|
||||
special_files = {},
|
||||
symlink_destination = false,
|
||||
indent_markers = {
|
||||
enable = true,
|
||||
},
|
||||
icons = {
|
||||
git_placement = "signcolumn",
|
||||
show = {
|
||||
file = true,
|
||||
folder = true,
|
||||
folder_arrow = true,
|
||||
git = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
update_focused_file = {
|
||||
enable = true,
|
||||
update_root = true,
|
||||
ignore_list = { "help" },
|
||||
},
|
||||
diagnostics = {
|
||||
enable = true,
|
||||
show_on_dirs = true,
|
||||
},
|
||||
filters = {
|
||||
custom = {},
|
||||
dotfiles = false,
|
||||
},
|
||||
actions = {
|
||||
change_dir = {
|
||||
enable = false,
|
||||
restrict_above_cwd = true,
|
||||
},
|
||||
open_file = {
|
||||
resize_window = true,
|
||||
},
|
||||
remove_file = {
|
||||
close_window = false,
|
||||
},
|
||||
},
|
||||
log = {
|
||||
enable = false,
|
||||
truncate = true,
|
||||
types = {
|
||||
all = false,
|
||||
config = false,
|
||||
copy_paste = false,
|
||||
diagnostics = false,
|
||||
git = false,
|
||||
profile = false,
|
||||
watcher = false,
|
||||
},
|
||||
},
|
||||
git = {
|
||||
enable = true,
|
||||
ignore = false,
|
||||
show_on_dirs = true,
|
||||
timeout = 400,
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
{ "<leader>n", "<cmd>NvimTreeFocus<cr>" },
|
||||
{ "<C-t>", "<cmd>NvimTreeToggle<cr>" }
|
||||
}
|
||||
}
|
44
lua/plugins/treesitter.lua
Normal file
44
lua/plugins/treesitter.lua
Normal file
|
@ -0,0 +1,44 @@
|
|||
return {
|
||||
config = {
|
||||
-- A list of parser names, or "all"
|
||||
ensure_installed = { "html", "dockerfile", "cpp", "css", "markdown", "c", "gitcommit", "bash", "phpdoc", "comment", "python", "http", "php", "regex", "json5", "lua", "gitattributes", "gitignore", "json", "git_rebase", "javascript", "perl", "sql", "yaml" },
|
||||
|
||||
-- Install parsers synchronously (only applied to `ensure_installed`)
|
||||
sync_install = false,
|
||||
|
||||
-- Automatically install missing parsers when entering buffer
|
||||
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
|
||||
auto_install = true,
|
||||
|
||||
-- List of parsers to ignore installing (for "all")
|
||||
--ignore_install = { "javascript" },
|
||||
|
||||
---- If you need to change the installation directory of the parsers (see -> Advanced Setup)
|
||||
-- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")!
|
||||
|
||||
highlight = {
|
||||
-- `false` will disable the whole extension
|
||||
enable = true,
|
||||
|
||||
-- NOTE: these are the names of the parsers and not the filetype. (for example if you want to
|
||||
-- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is
|
||||
-- the name of the parser)
|
||||
-- list of language that will be disabled
|
||||
--disable = { "c", "rust" },
|
||||
-- Or use a function for more flexibility, e.g. to disable slow treesitter highlight for large files
|
||||
--disable = function(lang, buf)
|
||||
--local max_filesize = 100 * 1024 -- 100 KB
|
||||
--local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
|
||||
--if ok and stats and stats.size > max_filesize then
|
||||
--return true
|
||||
--end
|
||||
--end,
|
||||
|
||||
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
|
||||
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
|
||||
-- Using this option may slow down your editor, and you may see some duplicate highlights.
|
||||
-- Instead of true it can also be a list of languages
|
||||
additional_vim_regex_highlighting = true, -- default=false
|
||||
},
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue