move most important config to ansible
This commit is contained in:
2
roles/nvim/files/after/ftplugin/markdown.lua
Normal file
2
roles/nvim/files/after/ftplugin/markdown.lua
Normal file
@ -0,0 +1,2 @@
|
||||
vim.opt_local.expandtab = true
|
||||
vim.opt_local.shiftwidth = 2
|
||||
1
roles/nvim/files/after/ftplugin/scss.lua
Normal file
1
roles/nvim/files/after/ftplugin/scss.lua
Normal file
@ -0,0 +1 @@
|
||||
vim.opt_local.shiftwidth = 4
|
||||
1
roles/nvim/files/after/ftplugin/typescript.lua
Normal file
1
roles/nvim/files/after/ftplugin/typescript.lua
Normal file
@ -0,0 +1 @@
|
||||
vim.opt_local.shiftwidth = 4
|
||||
1
roles/nvim/files/after/ftplugin/vim.lua
Normal file
1
roles/nvim/files/after/ftplugin/vim.lua
Normal file
@ -0,0 +1 @@
|
||||
vim.opt_local.textwidth = 0
|
||||
2
roles/nvim/files/init.lua
Normal file
2
roles/nvim/files/init.lua
Normal file
@ -0,0 +1,2 @@
|
||||
require('config.core')
|
||||
require('config.lazy')
|
||||
41
roles/nvim/files/lazy-lock.json
Normal file
41
roles/nvim/files/lazy-lock.json
Normal file
@ -0,0 +1,41 @@
|
||||
{
|
||||
"LuaSnip": { "branch": "master", "commit": "458560534a73f7f8d7a11a146c801db00b081df0" },
|
||||
"alpha-nvim": { "branch": "main", "commit": "2b3cbcdd980cae1e022409289245053f62fb50f6" },
|
||||
"auto-session": { "branch": "main", "commit": "ee320d7a59c1dfe83df7c9d58150d9f194690d53" },
|
||||
"bufdelete.nvim": { "branch": "master", "commit": "f6bcea78afb3060b198125256f897040538bcb81" },
|
||||
"bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" },
|
||||
"cmp-path": { "branch": "main", "commit": "e52e640b7befd8113b3350f46e8cfcfe98fcf730" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
|
||||
"diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" },
|
||||
"dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" },
|
||||
"flutter-tools.nvim": { "branch": "main", "commit": "65b7399804315a1160933b64292d3c5330aa4e9f" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
|
||||
"lazygit.nvim": { "branch": "main", "commit": "cdd3527e251f96eb0527162b156ad839286fcd97" },
|
||||
"lspkind.nvim": { "branch": "master", "commit": "d79a1c3299ad0ef94e255d045bed9fa26025dab6" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "a94fc68960665e54408fe37dcf573193c4ce82c9" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "1a31f824b9cd5bc6f342fc29e9a53b60d74af245" },
|
||||
"mason-tool-installer.nvim": { "branch": "main", "commit": "517ef5994ef9d6b738322664d5fdd948f0fdeb46" },
|
||||
"mason.nvim": { "branch": "main", "commit": "4da89f3ab04783da990f9bd40aaa36c22e59375b" },
|
||||
"monokai-nightasty.nvim": { "branch": "main", "commit": "8182c45dcaf82e7316cfda6d439ee8ad783ae594" },
|
||||
"neodev.nvim": { "branch": "main", "commit": "46aa467dca16cf3dfe27098042402066d2ae242d" },
|
||||
"none-ls-extras.nvim": { "branch": "main", "commit": "924fe88a9983c7d90dbb31fc4e3129a583ea0a90" },
|
||||
"none-ls.nvim": { "branch": "main", "commit": "3ce66bc62eb363f19cceeb1fae2e71ea2bede56d" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "23320e75953ac82e559c610bec5a90d9c6dfa743" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" },
|
||||
"nvim-lsp-file-operations": { "branch": "master", "commit": "9744b738183a5adca0f916527922078a965515ed" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "4d3b3bb8815fbe37bcaf3dbdb12a22382bc11ebe" },
|
||||
"nvim-surround": { "branch": "main", "commit": "7a7a78a52219a3312c1fcabf880cea07a7956a5f" },
|
||||
"nvim-tree.lua": { "branch": "master", "commit": "a9156c013916d3c8a2905ab2e26e9dd74beb642e" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
|
||||
"nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "4a8369f4c78ef6f6f895f0cec349e48f74330574" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
|
||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" },
|
||||
"telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
|
||||
"todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" },
|
||||
"venv-selector.nvim": { "branch": "regexp", "commit": "c677caa1030808a9f90092e522de7cc20c1390dd" },
|
||||
"vim-floaterm": { "branch": "master", "commit": "fd4bdd66eca56c6cc59f2119e4447496d8cde2ea" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" }
|
||||
}
|
||||
2
roles/nvim/files/lua/config/core/init.lua
Normal file
2
roles/nvim/files/lua/config/core/init.lua
Normal file
@ -0,0 +1,2 @@
|
||||
require('config.core.keymaps')
|
||||
require('config.core.options')
|
||||
26
roles/nvim/files/lua/config/core/keymaps.lua
Normal file
26
roles/nvim/files/lua/config/core/keymaps.lua
Normal file
@ -0,0 +1,26 @@
|
||||
local keymap = vim.keymap
|
||||
|
||||
|
||||
local opts = { noremap = true, silent = true }
|
||||
|
||||
-- INSERT MODE
|
||||
|
||||
-- map `ctrl + backspace` to delete previous word in insert mode
|
||||
keymap.set('i', '<C-BS>', '<C-W>', opts)
|
||||
|
||||
-- map `ctrl + delete` to delete next word in insert mode
|
||||
keymap.set('i', '<C-Del>', '<C-o>dw', opts)
|
||||
|
||||
|
||||
-- NORMAL MODE
|
||||
|
||||
-- navigate in visual linewraps
|
||||
keymap.set('n', 'k', 'gk', opts)
|
||||
keymap.set('n', 'j', 'gj', opts)
|
||||
keymap.set('n', '<UP>', 'gk', opts)
|
||||
keymap.set('n', '<DOWN>', 'gj', opts)
|
||||
|
||||
-- COMMANDS
|
||||
|
||||
-- print current working directory
|
||||
vim.api.nvim_create_user_command('Cwd', function() print(vim.fn.getcwd()) end, {})
|
||||
44
roles/nvim/files/lua/config/core/options.lua
Normal file
44
roles/nvim/files/lua/config/core/options.lua
Normal file
@ -0,0 +1,44 @@
|
||||
local opt = vim.opt
|
||||
|
||||
-- numbers
|
||||
opt.relativenumber = true
|
||||
opt.number = true
|
||||
|
||||
-- enable mouse in all modes
|
||||
opt.mouse = 'a'
|
||||
-- opt.mousemoveevent = true
|
||||
|
||||
-- tabs
|
||||
opt.autoindent = true
|
||||
opt.tabstop = 4
|
||||
opt.softtabstop = 4
|
||||
opt.shiftwidth = 4
|
||||
opt.smarttab = true
|
||||
|
||||
-- default encodings to utf-8
|
||||
opt.encoding = 'utf-8'
|
||||
opt.fileencoding = 'utf-8'
|
||||
-- opt.termencoding = 'utf-8' -- currently broken
|
||||
|
||||
-- folds
|
||||
opt.foldmethod = 'indent'
|
||||
opt.foldlevelstart = 99
|
||||
opt.foldlevel = 1
|
||||
|
||||
-- search
|
||||
opt.ignorecase = true
|
||||
opt.smartcase = true
|
||||
|
||||
-- styling
|
||||
opt.scrolloff = 5
|
||||
opt.wrap = true
|
||||
opt.showbreak = '++'
|
||||
opt.breakindent = true
|
||||
opt.linebreak = true
|
||||
opt.termguicolors = true
|
||||
|
||||
-- Remove autoformatting of
|
||||
-- 't' text using textwidth
|
||||
-- 'c' comments using textwidth
|
||||
opt.formatoptions:remove('t')
|
||||
opt.formatoptions:remove('c')
|
||||
28
roles/nvim/files/lua/config/lazy.lua
Normal file
28
roles/nvim/files/lua/config/lazy.lua
Normal file
@ -0,0 +1,28 @@
|
||||
local lazypath = vim.fn.stdpath('data') .. 'lazy/lazy.nvim'
|
||||
|
||||
-- bootstrap lazy
|
||||
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||
local lazyrepo = 'https://github.com/folke/lazy.nvim.git'
|
||||
local out = vim.fn.system({ 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath })
|
||||
if vim.v.shell_error ~= 0 then
|
||||
vim.api.nvim_echo({
|
||||
{ 'Failed to clone lazy.nvim:\n', 'ErrorMsg' },
|
||||
{ out, 'WarningMsg' },
|
||||
{ '\nPress any key to exit...' },
|
||||
}, true, {})
|
||||
vim.fn.getchar()
|
||||
os.exit(1)
|
||||
end
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
vim.g.mapleader = ' '
|
||||
vim.g.maplocalleader = '\\'
|
||||
|
||||
-- setup lazy and import plugins
|
||||
require('lazy').setup({
|
||||
spec = {
|
||||
{ import = 'config.plugins' },
|
||||
{ import = 'config.plugins.lsp' },
|
||||
},
|
||||
})
|
||||
37
roles/nvim/files/lua/config/plugins/airline.lua#
Normal file
37
roles/nvim/files/lua/config/plugins/airline.lua#
Normal file
@ -0,0 +1,37 @@
|
||||
return {
|
||||
'vim-airline/vim-airline',
|
||||
dependencies = {
|
||||
'vim-airline/vim-airline-themes',
|
||||
-- 'nvim-tree/nvim-web-devicons',
|
||||
'ryanoasis/vim-devicons',
|
||||
},
|
||||
config = function()
|
||||
-- vim.g.airline_theme = 'base16_monokai'
|
||||
vim.g.airline_powerline_fonts = 1
|
||||
|
||||
-- vim.g.airline_symbols = {}
|
||||
|
||||
-- unicode symbols
|
||||
vim.g.airline_left_sep = '»'
|
||||
vim.g.airline_left_sep = '▶'
|
||||
vim.g.airline_right_sep = '«'
|
||||
vim.g.airline_right_sep = '◀'
|
||||
vim.g.airline_symbols.linenr = '␊'
|
||||
vim.g.airline_symbols.linenr = ''
|
||||
vim.g.airline_symbols.linenr = '¶'
|
||||
vim.g.airline_symbols.branch = '⎇'
|
||||
vim.g.airline_symbols.paste = 'ρ'
|
||||
vim.g.airline_symbols.paste = 'Þ'
|
||||
vim.g.airline_symbols.paste = '∥'
|
||||
vim.g.airline_symbols.whitespace = 'Ξ'
|
||||
|
||||
-- airline symbols
|
||||
vim.g.airline_left_sep = ''
|
||||
vim.g.airline_left_alt_sep = ''
|
||||
vim.g.airline_right_sep = ''
|
||||
vim.g.airline_right_alt_sep = ''
|
||||
vim.g.airline_symbols.branch = ''
|
||||
vim.g.airline_symbols.readonly = ''
|
||||
vim.g.airline_symbols.linenr = ''
|
||||
end,
|
||||
}
|
||||
40
roles/nvim/files/lua/config/plugins/alpha.lua
Normal file
40
roles/nvim/files/lua/config/plugins/alpha.lua
Normal file
@ -0,0 +1,40 @@
|
||||
return {
|
||||
'goolord/alpha-nvim',
|
||||
dependencies = {
|
||||
'nvim-tree/nvim-web-devicons',
|
||||
},
|
||||
event = 'VimEnter',
|
||||
config = function()
|
||||
local alpha = require('alpha')
|
||||
local startify = require('alpha.themes.startify')
|
||||
|
||||
-- startify.section.header.val = {
|
||||
-- '░▒▓███████▓▒░ ░▒▓████████▓▒░░▒▓██████▓▒░ ░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░░▒▓██████████████▓▒░ ',
|
||||
-- '░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░',
|
||||
-- '░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▒▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░',
|
||||
-- '░▒▓█▓▒░░▒▓█▓▒░░▒▓██████▓▒░ ░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▒▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░',
|
||||
-- '░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░',
|
||||
-- '░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░',
|
||||
-- '░▒▓█▓▒░░▒▓█▓▒░░▒▓████████▓▒░░▒▓██████▓▒░ ░▒▓██▓▒░ ░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░',
|
||||
-- ' '
|
||||
-- }
|
||||
|
||||
alpha.setup(startify.opts)
|
||||
|
||||
local alpha_start_group = vim.api.nvim_create_augroup('AlphaStart', { clear = true })
|
||||
vim.api.nvim_create_autocmd('TabNewEntered', {
|
||||
callback = function()
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
local bufname = vim.api.nvim_buf_get_name(bufnr)
|
||||
|
||||
-- Start alpha if no file associated with buffer
|
||||
if bufname == '' then
|
||||
alpha.start()
|
||||
end
|
||||
end,
|
||||
group = alpha_start_group
|
||||
})
|
||||
|
||||
-- vim.cmd([[autocmd FileType alpha setlocal nofoldenable]])
|
||||
end
|
||||
}
|
||||
57
roles/nvim/files/lua/config/plugins/auto-session.lua
Normal file
57
roles/nvim/files/lua/config/plugins/auto-session.lua
Normal file
@ -0,0 +1,57 @@
|
||||
return {
|
||||
'rmagatti/auto-session',
|
||||
lazy = false,
|
||||
config = function()
|
||||
local auto_session = require('auto-session')
|
||||
auto_session.setup({
|
||||
auto_save = false,
|
||||
auto_restore = false,
|
||||
post_restore_cmds = {
|
||||
function ()
|
||||
local buf_exists = function(bufname)
|
||||
for _, buf in ipairs(vim.fn.getbufinfo({ bufloaded = true })) do
|
||||
if buf.name:match(bufname) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
-- If NvimTree was opened when the session was saved, show it
|
||||
if buf_exists('NvimTree_') then
|
||||
local nvim_tree_api = require('nvim-tree.api')
|
||||
nvim_tree_api.tree.reload()
|
||||
nvim_tree_api.tree.open()
|
||||
end
|
||||
end
|
||||
}
|
||||
})
|
||||
|
||||
local opts = { silent = true, noremap = true }
|
||||
|
||||
local keymap = vim.keymap
|
||||
keymap.set('n', '<leader>ss', '<cmd>SessionSave<cr>', opts)
|
||||
keymap.set('n', '<leader>sq', '<cmd>SessionSave<cr><cmd>wa<cr><cmd>qa<cr>', opts)
|
||||
keymap.set('n', '<leader>sl', '<cmd>SessionSearch<cr>', opts)
|
||||
keymap.set('n', '<leader>sr', '<cmd>SessionRestore<cr>', opts)
|
||||
keymap.set('n', '<leader>sd', '<cmd>Autosession delete<cr>', opts)
|
||||
|
||||
local function named_save()
|
||||
vim.ui.input({ prompt = 'Enter Session name: ' }, function(input)
|
||||
auto_session.SaveSession(input)
|
||||
end)
|
||||
end
|
||||
keymap.set('n', '<leader>sS', named_save, opts)
|
||||
|
||||
local wk = require('which-key')
|
||||
wk.add({
|
||||
{ '<leader>s', group = 'auto-session' },
|
||||
{ '<leader>ss', desc = 'SessionSave' },
|
||||
{ '<leader>sS', desc = 'NamedSessionSave' },
|
||||
{ '<leader>sq', desc = 'Save and Quit' },
|
||||
{ '<leader>sl', desc = 'SessionList (SessionSearch)'},
|
||||
{ '<leader>sr', desc = 'SessionRestore'},
|
||||
{ '<leader>sd', desc = 'SessionDelete'},
|
||||
})
|
||||
end,
|
||||
}
|
||||
22
roles/nvim/files/lua/config/plugins/autopairs.lua
Normal file
22
roles/nvim/files/lua/config/plugins/autopairs.lua
Normal file
@ -0,0 +1,22 @@
|
||||
return {
|
||||
'windwp/nvim-autopairs',
|
||||
event = { 'InsertEnter' },
|
||||
dependencies = {
|
||||
'hrsh7th/nvim-cmp',
|
||||
},
|
||||
config = function()
|
||||
local autopairs = require('nvim-autopairs')
|
||||
|
||||
autopairs.setup({
|
||||
check_ts = true,
|
||||
ts_config = {
|
||||
javascript = { 'template_string' },
|
||||
},
|
||||
})
|
||||
|
||||
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
|
||||
local cmp = require('cmp')
|
||||
|
||||
cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done())
|
||||
end,
|
||||
}
|
||||
6
roles/nvim/files/lua/config/plugins/bufdelete.lua
Normal file
6
roles/nvim/files/lua/config/plugins/bufdelete.lua
Normal file
@ -0,0 +1,6 @@
|
||||
return {
|
||||
'famiu/bufdelete.nvim',
|
||||
config = function()
|
||||
vim.keymap.set('n', '<C-q>', '<cmd>Bdelete<cr>', { noremap = true, silent = true })
|
||||
end
|
||||
}
|
||||
33
roles/nvim/files/lua/config/plugins/bufferline.lua
Normal file
33
roles/nvim/files/lua/config/plugins/bufferline.lua
Normal file
@ -0,0 +1,33 @@
|
||||
return {
|
||||
'akinsho/bufferline.nvim',
|
||||
lazy = false,
|
||||
version = '*',
|
||||
dependencies = { 'nvim-tree/nvim-web-devicons' },
|
||||
config = function ()
|
||||
local bufferline = require('bufferline')
|
||||
bufferline.setup({
|
||||
options = {
|
||||
persist_buffer_sort = true,
|
||||
hover = {
|
||||
enabled = true,
|
||||
delay = 200,
|
||||
reveal = {'close'}
|
||||
},
|
||||
offsets = {
|
||||
{
|
||||
filetype = "NvimTree",
|
||||
text = "File Explorer",
|
||||
highlight = "Directory",
|
||||
separator = true,
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
local map = vim.keymap.set
|
||||
local opts = { noremap = true, silent = true }
|
||||
|
||||
map('n', '<A-Left>', '<cmd>BufferLineCyclePrev<cr>', opts)
|
||||
map('n', '<A-Right>', '<cmd>BufferLineCycleNext<cr>', opts)
|
||||
end
|
||||
}
|
||||
55
roles/nvim/files/lua/config/plugins/cmp.lua
Normal file
55
roles/nvim/files/lua/config/plugins/cmp.lua
Normal file
@ -0,0 +1,55 @@
|
||||
return {
|
||||
'hrsh7th/nvim-cmp',
|
||||
event = 'InsertEnter',
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-buffer", -- source for text in buffer
|
||||
"hrsh7th/cmp-path", -- source for file system paths
|
||||
{
|
||||
"L3MON4D3/LuaSnip",
|
||||
-- follow latest release.
|
||||
version = "v2.*", -- Replace <CurrentMajor> by the latest released major (first number of latest release)
|
||||
-- install jsregexp (optional!).
|
||||
build = "make install_jsregexp",
|
||||
},
|
||||
"saadparwaiz1/cmp_luasnip", -- for autocompletion
|
||||
"rafamadriz/friendly-snippets", -- useful snippets
|
||||
"onsails/lspkind.nvim", -- vs-code like pictograms
|
||||
},
|
||||
config = function()
|
||||
-- TODO keybindings
|
||||
local cmp = require('cmp')
|
||||
local luasnip = require('luasnip')
|
||||
local lspkind = require('lspkind')
|
||||
-- require('lspkind.loaders.from_vscode').lazy_load()
|
||||
|
||||
cmp.setup({
|
||||
-- preselect = nil,
|
||||
completion = {
|
||||
completeopt = 'menu,menuone,preview',
|
||||
},
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
['<C-e>'] = cmp.mapping.abort(),
|
||||
['<Tab>'] = cmp.mapping.confirm({ select = true }),
|
||||
['<Enter>'] = cmp.mapping.confirm({ select = true }),
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'luasnip' },
|
||||
{ name = 'buffer' },
|
||||
{ name = 'path' },
|
||||
}),
|
||||
-- formatting = {
|
||||
-- format = lspkind.cmp_format({
|
||||
-- maxwidth = 50,
|
||||
-- ellipsis_char = '...',
|
||||
-- }),
|
||||
-- },
|
||||
})
|
||||
end,
|
||||
}
|
||||
8
roles/nvim/files/lua/config/plugins/colorscheme.lua
Normal file
8
roles/nvim/files/lua/config/plugins/colorscheme.lua
Normal file
@ -0,0 +1,8 @@
|
||||
return {
|
||||
'polirritmico/monokai-nightasty.nvim',
|
||||
priority = 1000,
|
||||
config = function()
|
||||
require('monokai-nightasty').setup()
|
||||
vim.cmd('colorscheme monokai-nightasty')
|
||||
end,
|
||||
}
|
||||
3
roles/nvim/files/lua/config/plugins/diffview.lua
Normal file
3
roles/nvim/files/lua/config/plugins/diffview.lua
Normal file
@ -0,0 +1,3 @@
|
||||
return {
|
||||
'sindrets/diffview.nvim'
|
||||
}
|
||||
4
roles/nvim/files/lua/config/plugins/dressing.lua
Normal file
4
roles/nvim/files/lua/config/plugins/dressing.lua
Normal file
@ -0,0 +1,4 @@
|
||||
return {
|
||||
'stevearc/dressing.nvim',
|
||||
opts = {}
|
||||
}
|
||||
18
roles/nvim/files/lua/config/plugins/floaterm.lua
Normal file
18
roles/nvim/files/lua/config/plugins/floaterm.lua
Normal file
@ -0,0 +1,18 @@
|
||||
return {
|
||||
'voldikss/vim-floaterm',
|
||||
config = function ()
|
||||
local keymap = vim.keymap
|
||||
local opts = { noremap = true, silent = true }
|
||||
keymap.set('n', '<C-a>', '<cmd>FloatermToggle<cr>', opts)
|
||||
keymap.set('t', '<C-a>', '<cmd>FloatermToggle<cr>', opts)
|
||||
keymap.set('t', '<PageUp>', '<cmd>FloatermPrev<cr>', opts)
|
||||
keymap.set('t', '<PageDown>', '<cmd>FloatermNext<cr>', opts)
|
||||
|
||||
local wk = require('which-key')
|
||||
wk.add({
|
||||
{ '<leader>t', group = 'Floaterm', icon = { icon = ' ', color = 'red' } },
|
||||
{ '<leader>tn', '<leader>tn', desc = 'New Terminal', noremap = true, silent = true },
|
||||
{ '<leader>tt', '<leader>tt', desc = 'Toggle Terminal', noremap = true, silent = true },
|
||||
})
|
||||
end
|
||||
}
|
||||
9
roles/nvim/files/lua/config/plugins/flutter.lua
Normal file
9
roles/nvim/files/lua/config/plugins/flutter.lua
Normal file
@ -0,0 +1,9 @@
|
||||
return {
|
||||
'nvim-flutter/flutter-tools.nvim',
|
||||
lazy = false,
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
'stevearc/dressing.nvim', -- optional for vim.ui.select
|
||||
},
|
||||
config = true,
|
||||
}
|
||||
3
roles/nvim/files/lua/config/plugins/init.lua
Normal file
3
roles/nvim/files/lua/config/plugins/init.lua
Normal file
@ -0,0 +1,3 @@
|
||||
return {
|
||||
'nvim-lua/plenary.nvim', -- dependency of many plungins
|
||||
}
|
||||
14
roles/nvim/files/lua/config/plugins/lazygit.lua
Normal file
14
roles/nvim/files/lua/config/plugins/lazygit.lua
Normal file
@ -0,0 +1,14 @@
|
||||
return {
|
||||
'kdheepak/lazygit.nvim',
|
||||
lazy = true,
|
||||
cmd = {
|
||||
'LazyGit',
|
||||
'LazyGitConfig',
|
||||
'LazyGitCurrentFile',
|
||||
'LazyGitFilter',
|
||||
'LazyGitFilterCurrentFile',
|
||||
},
|
||||
depedencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
},
|
||||
}
|
||||
125
roles/nvim/files/lua/config/plugins/lsp/lspconfig.lua
Normal file
125
roles/nvim/files/lua/config/plugins/lsp/lspconfig.lua
Normal file
@ -0,0 +1,125 @@
|
||||
return {
|
||||
'neovim/nvim-lspconfig',
|
||||
event = { 'BufReadPre', 'BufNewFile' },
|
||||
dependencies = {
|
||||
'williamboman/mason.nvim',
|
||||
'hrsh7th/cmp-nvim-lsp',
|
||||
{ 'antosha417/nvim-lsp-file-operations', config = true },
|
||||
{ 'folke/neodev.nvim', opts = {} },
|
||||
},
|
||||
config = function()
|
||||
local lspconfig = require('lspconfig')
|
||||
local mason_lspconfig = require('mason-lspconfig')
|
||||
local cmp_nvim_lsp = require('cmp_nvim_lsp')
|
||||
local keymap = vim.keymap
|
||||
local wk = require('which-key')
|
||||
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
group = vim.api.nvim_create_augroup('UserLspConfig', {}),
|
||||
callback = function(ev)
|
||||
local function opts(desc)
|
||||
return { desc = desc, buffer = ev.buf, silent = true }
|
||||
end
|
||||
|
||||
keymap.set('n', 'gr', vim.lsp.buf.rename, opts('Rename'))
|
||||
keymap.set('n', 'K', vim.lsp.buf.hover, opts('Show documentation'))
|
||||
keymap.set('n', 'gR', '<cmd>Telescope lsp_references<cr>', opts('Show LSP references'))
|
||||
keymap.set('n', 'gD', vim.lsp.buf.declaration, opts('Go to declaration'))
|
||||
keymap.set('n', 'gd', '<cmd>Telescope lsp_definitions<cr>', opts('Show LSP definitions'))
|
||||
keymap.set('n', 'gi', '<cmd>Telescope lsp_implementations<cr>', opts('Show LSP implementations'))
|
||||
keymap.set('n', 'gt', '<cmd>Telescope lsp_type_definitions<cr>', opts('Show LSP type definitions'))
|
||||
keymap.set('n', 'gE', vim.diagnostic.open_float, opts('Show diagnostics'))
|
||||
keymap.set({ 'n', 'v' }, 'ga', vim.lsp.buf.code_action, opts('Show available code actions'))
|
||||
wk.add({
|
||||
{ '<leader>r', group = 'Rename' },
|
||||
{ '<leader>rn', vim.lsp.buf.rename, desc = 'Smart Rename' },
|
||||
})
|
||||
end,
|
||||
})
|
||||
|
||||
local capabilities = cmp_nvim_lsp.default_capabilities()
|
||||
mason_lspconfig.setup_handlers({
|
||||
-- default handler for installed servers
|
||||
function(server_name)
|
||||
lspconfig[server_name].setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
end,
|
||||
-- TODO add lsp configs
|
||||
['lua_ls'] = function()
|
||||
lspconfig['lua_ls'].setup({
|
||||
capabilities = capabilities,
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = {
|
||||
globals = { 'vim' },
|
||||
},
|
||||
completion = {
|
||||
callSnippet = 'Replace'
|
||||
},
|
||||
}
|
||||
}
|
||||
})
|
||||
end,
|
||||
['emmet_ls'] = function()
|
||||
-- capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||
lspconfig['emmet_ls'].setup({
|
||||
capabilities = capabilities,
|
||||
filetypes = {
|
||||
'html',
|
||||
'css',
|
||||
'sass',
|
||||
'scss',
|
||||
'less',
|
||||
'javascript',
|
||||
'javascriptreact',
|
||||
'typescript',
|
||||
'typescriptreact',
|
||||
'svelte',
|
||||
'vue',
|
||||
}
|
||||
})
|
||||
end,
|
||||
['ts_ls'] = function()
|
||||
lspconfig['ts_ls'].setup({
|
||||
capabilities = capabilities,
|
||||
cmd = { "typescript-language-server", "--stdio" },
|
||||
init_options = {
|
||||
hostInfo = "neovim",
|
||||
-- preferences = {
|
||||
-- includePackagesJsonAutoImports = "on",
|
||||
-- }
|
||||
}
|
||||
})
|
||||
end,
|
||||
-- ['pyright'] = function()
|
||||
-- lspconfig['pyright'].setup({
|
||||
-- -- cmd = { "pyright-langserver", "--stdio" },
|
||||
-- -- filetypes = { "python" },
|
||||
-- -- root_dir = function(filename)
|
||||
-- -- return util.root_pattern(unpack(root_files))(filename) or util.path.dirname(filename)
|
||||
-- -- end,
|
||||
-- -- settings = {
|
||||
-- -- python = {
|
||||
-- -- analysis = {
|
||||
-- -- autoSearchPaths = true,
|
||||
-- -- diagnosticMode = "workspace",
|
||||
-- -- useLibraryCodeForTypes = true
|
||||
-- -- }
|
||||
-- -- }
|
||||
-- -- }
|
||||
-- capabilities = capabilities,
|
||||
-- settings = {
|
||||
-- python = {
|
||||
-- analysis = {
|
||||
-- useLibraryCodeForTypes = true,
|
||||
-- typeCheckingMode = "basic",
|
||||
-- -- configPath = vim.fn.expand('./pyrightconfig.json')
|
||||
-- }
|
||||
-- }
|
||||
-- },
|
||||
-- })
|
||||
-- end,
|
||||
})
|
||||
end
|
||||
}
|
||||
45
roles/nvim/files/lua/config/plugins/lsp/mason.lua
Normal file
45
roles/nvim/files/lua/config/plugins/lsp/mason.lua
Normal file
@ -0,0 +1,45 @@
|
||||
return {
|
||||
{ 'williamboman/mason.nvim', commit = '4da89f3' },
|
||||
{ 'williamboman/mason-lspconfig.nvim', commit = '1a31f82' },
|
||||
{ 'WhoIsSethDaniel/mason-tool-installer.nvim' },
|
||||
config = function()
|
||||
local mason = require('mason')
|
||||
local mason_lspconfig = require('mason-lspconfig')
|
||||
local mason_tool_installer = require('mason-tool-installer')
|
||||
|
||||
mason.setup({
|
||||
ui = {
|
||||
icons = {
|
||||
package_installed = "✓",
|
||||
package_pending = "➜",
|
||||
package_uninstalled = "✗",
|
||||
},
|
||||
},
|
||||
pip = {
|
||||
upgrade_pip = true,
|
||||
}
|
||||
})
|
||||
|
||||
mason_lspconfig.setup({
|
||||
ensure_installed = {
|
||||
'lua_ls',
|
||||
'html',
|
||||
'cssls',
|
||||
-- 'pyright',
|
||||
-- 'emmet_ls',
|
||||
'bashls',
|
||||
'ts_ls',
|
||||
},
|
||||
})
|
||||
|
||||
mason_tool_installer.setup({
|
||||
ensure_installed = {
|
||||
'prettier',
|
||||
'isort',
|
||||
-- 'black',
|
||||
-- 'pylint',
|
||||
-- 'eslint_d',
|
||||
}
|
||||
})
|
||||
end,
|
||||
}
|
||||
41
roles/nvim/files/lua/config/plugins/lsp/null-ls.lua
Normal file
41
roles/nvim/files/lua/config/plugins/lsp/null-ls.lua
Normal file
@ -0,0 +1,41 @@
|
||||
return {
|
||||
'nvimtools/none-ls.nvim',
|
||||
dependencies = {
|
||||
'nvimtools/none-ls-extras.nvim'
|
||||
},
|
||||
config = function()
|
||||
local null_ls = require('null-ls')
|
||||
|
||||
local sources = {
|
||||
null_ls.builtins.formatting.prettier.with({
|
||||
filetypes = { 'javascript', 'typescript', 'typescriptreact', 'css', 'html', 'json', 'markdown', 'yaml' }
|
||||
}),
|
||||
-- null_ls.builtins.formatting.black,
|
||||
-- null_ls.builtins.formatting.djlint,
|
||||
null_ls.builtins.formatting.isort,
|
||||
null_ls.builtins.formatting.stylua,
|
||||
-- require('none-ls.diagnostics.eslint_d'),
|
||||
}
|
||||
|
||||
null_ls.setup({
|
||||
sources = sources,
|
||||
-- on_attach = function(client, bufnr)
|
||||
-- if client.server_capabilities.documentFormattingProvider then
|
||||
-- vim.
|
||||
-- end
|
||||
-- end,
|
||||
})
|
||||
|
||||
local keymap = vim.keymap
|
||||
local fmt_func = function()
|
||||
vim.lsp.buf.format({ async = true })
|
||||
end
|
||||
keymap.set('n', '<leader>ii', fmt_func, { noremap = true, silent = true })
|
||||
|
||||
local wk = require('which-key')
|
||||
wk.add({
|
||||
{ '<leader>i', group = 'Formatting' },
|
||||
{ '<leader>ii', desc = 'Format File' },
|
||||
})
|
||||
end,
|
||||
}
|
||||
46
roles/nvim/files/lua/config/plugins/lualine.lua
Normal file
46
roles/nvim/files/lua/config/plugins/lualine.lua
Normal file
@ -0,0 +1,46 @@
|
||||
return {
|
||||
'nvim-lualine/lualine.nvim',
|
||||
dependencies = { 'nvim-tree/nvim-web-devicons' },
|
||||
config = function()
|
||||
require('lualine').setup {
|
||||
options = {
|
||||
icons_enabled = true,
|
||||
theme = 'horizon',
|
||||
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 = { 'location' }
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = { 'filename' },
|
||||
lualine_x = { 'location' },
|
||||
lualine_y = {},
|
||||
lualine_z = {}
|
||||
},
|
||||
tabline = {},
|
||||
winbar = {},
|
||||
inactive_winbar = {},
|
||||
extensions = {}
|
||||
}
|
||||
end
|
||||
}
|
||||
35
roles/nvim/files/lua/config/plugins/nvim-tree.lua
Normal file
35
roles/nvim/files/lua/config/plugins/nvim-tree.lua
Normal file
@ -0,0 +1,35 @@
|
||||
return {
|
||||
'nvim-tree/nvim-tree.lua',
|
||||
dependencies = {
|
||||
'nvim-tree/nvim-web-devicons',
|
||||
},
|
||||
config = function ()
|
||||
local nvim_tree = require('nvim-tree')
|
||||
local api = require('nvim-tree.api')
|
||||
|
||||
vim.g.loaded_netrw = 1
|
||||
vim.g.loaded_netrwPlugin = 1
|
||||
|
||||
nvim_tree.setup({
|
||||
filters = {
|
||||
custom = { 'node_modules', '__pycache__' },
|
||||
exclude = { 'secrets' },
|
||||
},
|
||||
update_focused_file = {
|
||||
enable = true,
|
||||
update_cwd = true,
|
||||
}
|
||||
})
|
||||
|
||||
local keymap = vim.keymap
|
||||
keymap.set('n', '<leader>ee', api.tree.toggle, { noremap = true, silent = true })
|
||||
keymap.set('n', '<leader>ec', '<cmd>NvimTreeCD<cr>', { noremap = true, silent = true })
|
||||
|
||||
local wk = require('which-key')
|
||||
wk.add({
|
||||
{ '<leader>e', group = 'nvim-tree', icon = { icon = ' ', color = 'orange' } },
|
||||
{ '<leader>ee', group = 'Toggle tree' },
|
||||
{ '<leader>ec', group = 'Change tree root to CWD' }
|
||||
})
|
||||
end
|
||||
}
|
||||
6
roles/nvim/files/lua/config/plugins/surround.lua
Normal file
6
roles/nvim/files/lua/config/plugins/surround.lua
Normal file
@ -0,0 +1,6 @@
|
||||
return {
|
||||
'kylechui/nvim-surround',
|
||||
event = { 'BufReadPre', 'BufNewFile' },
|
||||
version = '*',
|
||||
config = true,
|
||||
}
|
||||
43
roles/nvim/files/lua/config/plugins/telescope.lua
Normal file
43
roles/nvim/files/lua/config/plugins/telescope.lua
Normal file
@ -0,0 +1,43 @@
|
||||
return {
|
||||
'nvim-telescope/telescope.nvim',
|
||||
branch = '0.1.x',
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
},
|
||||
config = function()
|
||||
local telescope = require('telescope')
|
||||
-- local actions = require('telescope.actions')
|
||||
-- local transform_mod = require('telescope.actions.mt').transform_mod
|
||||
-- local trouble = require('trouble')
|
||||
-- local trouble_telescope = require('trouble.sources.telescope')
|
||||
|
||||
telescope.setup({
|
||||
defaults = {
|
||||
path_display = { 'smart' },
|
||||
},
|
||||
})
|
||||
|
||||
telescope.load_extension('fzf')
|
||||
|
||||
local opts = { noremap = true, silent = true }
|
||||
|
||||
local keymap = vim.keymap
|
||||
local builtin = require('telescope.builtin')
|
||||
|
||||
keymap.set('n', '<leader>ff', builtin.find_files, opts)
|
||||
keymap.set('n', '<leader>fh', builtin.oldfiles, opts)
|
||||
keymap.set('n', '<leader>fs', builtin.live_grep, opts)
|
||||
keymap.set('n', '<leader>fc', builtin.grep_string, opts)
|
||||
|
||||
local wk = require('which-key')
|
||||
wk.add({
|
||||
{ '<leader>f', group = 'telescope' },
|
||||
{ '<leader>ff', desc = 'Find Files'},
|
||||
{ '<leader>fh', desc = 'Recent Files'},
|
||||
{ '<leader>fs', desc = 'Search Text in Files'},
|
||||
{ '<leader>fc', desc = 'Search Text under Cursor'},
|
||||
})
|
||||
end,
|
||||
}
|
||||
22
roles/nvim/files/lua/config/plugins/todo-comments.lua
Normal file
22
roles/nvim/files/lua/config/plugins/todo-comments.lua
Normal file
@ -0,0 +1,22 @@
|
||||
return {
|
||||
'folke/todo-comments.nvim',
|
||||
dependencies = { 'nvim-lua/plenary.nvim' },
|
||||
lazy = false,
|
||||
config = function()
|
||||
require("todo-comments").setup({
|
||||
-- keywords = {
|
||||
-- TODO = { icon = " ", color = "custom" },
|
||||
-- },
|
||||
-- colors = {
|
||||
-- custom = { fg = "#FF0000", bg = "#000000" },
|
||||
-- },
|
||||
highlight = {
|
||||
pattern = [[.*<(KEYWORDS)\s*]],
|
||||
},
|
||||
search = {
|
||||
pattern = [[\b(KEYWORDS)\b]],
|
||||
}
|
||||
|
||||
})
|
||||
end
|
||||
}
|
||||
51
roles/nvim/files/lua/config/plugins/treesitter.lua
Normal file
51
roles/nvim/files/lua/config/plugins/treesitter.lua
Normal file
@ -0,0 +1,51 @@
|
||||
return {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
build = ":TSUpdate",
|
||||
dependencies = {
|
||||
"windwp/nvim-ts-autotag",
|
||||
},
|
||||
config = function()
|
||||
local treesitter = require('nvim-treesitter.configs')
|
||||
|
||||
treesitter.setup({
|
||||
auto_install = true,
|
||||
sync_install = false,
|
||||
highlight = {
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
indent = { enable = true },
|
||||
autotag = { enable = true },
|
||||
ensure_installed = {
|
||||
'json',
|
||||
'javascript',
|
||||
'typescript',
|
||||
'yaml',
|
||||
'html',
|
||||
'htmldjango',
|
||||
'css',
|
||||
'scss',
|
||||
'markdown',
|
||||
'markdown_inline',
|
||||
'bash',
|
||||
'lua',
|
||||
'vim',
|
||||
'dockerfile',
|
||||
'python',
|
||||
'gitignore',
|
||||
'c',
|
||||
},
|
||||
ignore_install = {},
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
init_selection = '<C-Space>',
|
||||
node_incremental = '<C-Space>',
|
||||
scope_incremental = false,
|
||||
node_decremental = '<bs>',
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
||||
24
roles/nvim/files/lua/config/plugins/venv-selector.lua
Normal file
24
roles/nvim/files/lua/config/plugins/venv-selector.lua
Normal file
@ -0,0 +1,24 @@
|
||||
return {
|
||||
"linux-cultist/venv-selector.nvim",
|
||||
dependencies = {
|
||||
"neovim/nvim-lspconfig",
|
||||
-- "mfussenegger/nvim-dap", "mfussenegger/nvim-dap-python", --optional
|
||||
{ "nvim-telescope/telescope.nvim", branch = "0.1.x", dependencies = { "nvim-lua/plenary.nvim" } },
|
||||
},
|
||||
lazy = false,
|
||||
branch = "regexp", -- This is the regexp branch, use this for the new version
|
||||
config = function()
|
||||
require("venv-selector").setup({
|
||||
-- settings = {
|
||||
-- search = {
|
||||
-- my_envs = {
|
||||
-- command = "fd python$ ~/git/cerenim/backend/"
|
||||
-- }
|
||||
-- }
|
||||
-- }
|
||||
})
|
||||
end,
|
||||
keys = {
|
||||
{ ",v", "<cmd>VenvSelect<cr>" },
|
||||
},
|
||||
}
|
||||
12
roles/nvim/files/lua/config/plugins/which-key.lua
Normal file
12
roles/nvim/files/lua/config/plugins/which-key.lua
Normal file
@ -0,0 +1,12 @@
|
||||
return {
|
||||
'folke/which-key.nvim',
|
||||
event = 'VeryLazy',
|
||||
config = function()
|
||||
local wk = require('which-key')
|
||||
wk.add({
|
||||
{ '<leader>nh', '<cmd>nohl<cr>', desc = 'No Highlight' },
|
||||
{ '<leader>l', group = 'LazyGit', icon = { icon = '', color = 'cyan' } },
|
||||
{ '<leader>lg', '<cmd>LazyGit<cr>', desc = 'Open LazyGit', icon = { icon = '', color = 'cyan' } },
|
||||
})
|
||||
end
|
||||
}
|
||||
Reference in New Issue
Block a user