Skip to content

Commit

Permalink
config
Browse files Browse the repository at this point in the history
  • Loading branch information
rentziass committed Mar 13, 2023
1 parent c8cbaa8 commit 3292b28
Show file tree
Hide file tree
Showing 6 changed files with 180 additions and 147 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
vim/.config/nvim/plugin
nvim.log

14 changes: 5 additions & 9 deletions vim/.config/nvim/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,14 @@

vim.g.mapleader = ' '

local load = function(mod)
package.loaded[mod] = nil
return require(mod)
end

if vim.g.vscode then
-- VSCode extension
load 'rentziass.vscode'
require 'rentziass.vscode'
else
-- ordinary Neovim
load 'rentziass.utils'
load 'rentziass.plugins'
load 'rentziass.editor'
require 'rentziass.utils'
require 'rentziass.plugins'
require 'rentziass.editor'
end

vim.keymap.set("n", "<leader>z", require("lazy").home)
1 change: 0 additions & 1 deletion vim/.config/nvim/lazy-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
"telescope.nvim": { "branch": "master", "commit": "a3f17d3baf70df58b9d3544ea30abe52a7a832c2" },
"todo-comments.nvim": { "branch": "main", "commit": "6ccb0bebeb22dbe31940776a750db54b844ae653" },
"tokyonight.nvim": { "branch": "main", "commit": "27203d70747094527d13575ed08f6a714e7a43f8" },
"trouble.nvim": { "branch": "main", "commit": "67337644e38144b444d026b0df2dc5fa0038930f" },
"vim-fugitive": { "branch": "master", "commit": "5b52a0f395065d6cb7b65a00a5e17eaf9ebd64d5" },
"vim-githubinator": { "branch": "master", "commit": "150c8ac86321cc8274174007384d829e6cf3fc65" },
"vim-helm": { "branch": "master", "commit": "c2e7b85711d410e1d73e64eb5df7b70b1c4c10eb" },
Expand Down
178 changes: 173 additions & 5 deletions vim/.config/nvim/lua/rentziass/plugins/bundle.lua
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ require('lazy').setup({

{
'crispgm/nvim-go',
ft = 'go',
config = function ()
require('go').setup({
-- notify: use nvim-notify
Expand Down Expand Up @@ -175,8 +176,14 @@ require('lazy').setup({
vim.cmd([[ colorscheme tokyonight ]])
end,
},
'ellisonleao/gruvbox.nvim',
'projekt0n/github-nvim-theme',
{
'ellisonleao/gruvbox.nvim',
lazy = true,
},
{
'projekt0n/github-nvim-theme',
lazy = true,
},

-- Completion
{
Expand All @@ -191,7 +198,140 @@ require('lazy').setup({
'hrsh7th/cmp-nvim-lsp',
'hrsh7th/cmp-nvim-lsp-document-symbol',
'hrsh7th/cmp-vsnip',
}
},
config = function()
local cmp = require "cmp"
local lspkind = require "lspkind"

cmp.setup {
mapping = {
["<C-d>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-e>"] = cmp.mapping.close(),
["<CR>"] = cmp.mapping(
cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Insert,
select = false,
},
{ "i", "c" }
),

["<c-space>"] = cmp.mapping {
i = cmp.mapping.complete(),
c = function(
_ --[[fallback]]
)
if cmp.visible() then
if not cmp.confirm { select = true } then
return
end
else
cmp.complete()
end
end,
},

-- Testing
["<c-q>"] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace,
select = true,
},

["<Tab>"] = function(fallback)
if cmp.visible() then
cmp.select_next_item()
else
fallback()
end
end,
["<Down>"] = function(fallback)
if cmp.visible() then
cmp.select_next_item()
else
fallback()
end
end,
["<S-Tab>"] = function(fallback)
if cmp.visible() then
cmp.select_prev_item()
else
fallback()
end
end,
["<Up>"] = function(fallback)
if cmp.visible() then
cmp.select_prev_item()
else
fallback()
end
end,
},

sources = {
{ name = "nvim_lsp" },
{ name = "vsnip" },
{ name = "orgmode" },
{ name = "path" },
{ name = "buffer", keyword_length = 5 },
{ name = "nvim_lua" },
},

snippet = {
expand = function(args)
vim.fn["vsnip#anonymous"](args.body)
end,
},

formatting = {
format = lspkind.cmp_format {
with_text = true,
menu = {
buffer = "[buf]",
nvim_lsp = "[LSP]",
nvim_lua = "[api]",
path = "[path]",
luasnip = "[snip]",
gh_issues = "[issues]",
tn = "[TabNine]",
},
},
},

experimental = {
-- Let's play with this for a day or two
ghost_text = true,
},
}

-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline({'/', '?'}, {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = 'buffer' }
}
})

-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline(':', {
-- mapping = cmp.mapping.preset.insert({
-- ['<CR>'] = cmp.mapping.confirm({ select = false }),
-- }),
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = 'path' }
}, {
{ name = 'cmdline', keyword_length = 5 }
})
})

local capabilities = require('cmp_nvim_lsp').default_capabilities()
local servers = { 'gopls', 'lua_ls', 'tsserver', 'yamlls', 'rust_analyzer' }
for _, server in pairs(servers) do
require('lspconfig')[server].setup {
capabilities = capabilities
}
end
end
},

'jiangmiao/auto-pairs',
Expand All @@ -207,8 +347,12 @@ require('lazy').setup({
'numToStr/Comment.nvim',
config = true,
},

'tpope/vim-surround',
'AndrewRadev/splitjoin.vim',

{
'AndrewRadev/splitjoin.vim',
},

'tjdevries/colorbuddy.nvim',
'nvim-lua/popup.nvim',
Expand Down Expand Up @@ -274,7 +418,10 @@ telescope.load_extension("ui-select")
},

'kyazdani42/nvim-web-devicons',
'towolf/vim-helm',
{
'towolf/vim-helm',
ft = 'yaml',
},
'github/copilot.vim',
-- use {
-- 'zbirenbaum/copilot.lua',
Expand Down Expand Up @@ -324,4 +471,25 @@ telescope.load_extension("ui-select")
},
'stevearc/dressing.nvim',
'nvim-orgmode/orgmode',
}, {
ui = {
custom_keys = {
-- you can define custom key maps here.
-- To disable one of the defaults, set it to false

-- open lazygit log
["<leader>u"] = function(plugin)
require("lazy.util").float_term({ "lazygit", "log" }, {
cwd = plugin.dir,
})
end,

-- open a terminal for the plugin dir
["<localleader>t"] = function(plugin)
require("lazy.util").float_term(nil, {
cwd = plugin.dir,
})
end,
},
},
})
131 changes: 0 additions & 131 deletions vim/.config/nvim/lua/rentziass/plugins/cmp.lua

This file was deleted.

1 change: 0 additions & 1 deletion vim/.config/nvim/lua/rentziass/plugins/init.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
require('rentziass.plugins.bundle')

require('rentziass.plugins.cmp')
require('rentziass.plugins.orgmode')
require('rentziass.plugins.todo-comments')
require('rentziass.plugins.vsnip')
Expand Down

0 comments on commit 3292b28

Please sign in to comment.