Compare commits

..

10 Commits

17 changed files with 214 additions and 236 deletions

View File

@ -19,11 +19,56 @@ if not vim.loop.fs_stat(lazypath) then
end end
vim.opt.rtp:prepend(lazypath) vim.opt.rtp:prepend(lazypath)
require 'options'
require 'autocmd'
require 'keymaps'
require('lazy').setup({ require('lazy').setup({
{ import = 'options' }, {
{ import = 'keymaps' }, -- NOTE: Theme
'sainnhe/gruvbox-material',
priority = 1000,
lazy = false,
config = function()
vim.g.gruvbox_material_background = 'soft'
vim.g.gruvbox_material_better_performance = 1
vim.g.gruvbox_material_enable_italic = 1
vim.cmd.colorscheme 'gruvbox-material'
end,
},
-- NOTE: First, some plugins that don't require any configuration
-- Git related plugins
'tpope/vim-fugitive',
'tpope/vim-rhubarb',
-- Detect tabstop and shiftwidth automatically
'tpope/vim-sleuth',
-- NOTE: Second, plugins that require setup call (done via opts)
-- Useful plugin to show you pending keybinds.
{ 'folke/which-key.nvim', opts = {} },
-- "gc" to comment visual regions/lines
{ 'numToStr/Comment.nvim', opts = {} },
-- colorize in files
{ 'norcalli/nvim-colorizer.lua', opts = {} },
-- autopairs on newline
{ 'windwp/nvim-autopairs', opts = {} },
-- highlighting for comments
{ 'folke/todo-comments.nvim', dependencies = 'nvim-lua/plenary.nvim', opts = {} },
-- cargo crates
{ 'saecki/crates.nvim', dependencies = 'nvim-lua/plenary.nvim', opts = {} },
-- import other plugins
{ import = 'plugins' }, { import = 'plugins' },
{ import = 'autocmd' },
}, {}) }, {})
-- The line beneath this is called `modeline`. See `:help modeline` -- The line beneath this is called `modeline`. See `:help modeline`

View File

@ -2,5 +2,3 @@ vim.api.nvim_create_autocmd({ 'BufEnter, BufWinEnter' }, { command = 'set colorc
vim.api.nvim_create_autocmd({ 'BufEnter, BufWinEnter' }, { command = 'set colorcolumn=80,100', pattern = { '*.rs' } }) vim.api.nvim_create_autocmd({ 'BufEnter, BufWinEnter' }, { command = 'set colorcolumn=80,100', pattern = { '*.rs' } })
vim.api.nvim_create_autocmd({ 'BufEnter, BufWinEnter' }, { command = 'set splitright', pattern = { '*' } }) vim.api.nvim_create_autocmd({ 'BufEnter, BufWinEnter' }, { command = 'set splitright', pattern = { '*' } })
vim.api.nvim_create_autocmd({ 'BufEnter, BufWinEnter' }, { command = 'set splitbelow', pattern = { '*' } }) vim.api.nvim_create_autocmd({ 'BufEnter, BufWinEnter' }, { command = 'set splitbelow', pattern = { '*' } })
return {}

View File

@ -18,7 +18,7 @@ vim.keymap.set('n', 'N', 'Nzzzv', { noremap = true, silent = true })
-- Remap for moving selected line / block of text in visual mode -- Remap for moving selected line / block of text in visual mode
vim.keymap.set('v', '<M-k>', ":m '<-2<cr>gv=gv", { desc = 'Move selected lines up' }) vim.keymap.set('v', '<M-k>', ":m '<-2<cr>gv=gv", { desc = 'Move selected lines up' })
vim.keymap.set('v', '<M-j>', ":m '>+1<cr>gv=gv", { desc = 'move selected lines down' }) vim.keymap.set('v', '<M-j>', ":m '>+1<cr>gv=gv", { desc = 'Move selected lines down' })
-- [[ Highlight on yank ]] -- [[ Highlight on yank ]]
-- See `:help vim.highlight.on_yank()` -- See `:help vim.highlight.on_yank()`
@ -37,18 +37,5 @@ vim.keymap.set('n', ']d', vim.diagnostic.goto_next)
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float) vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float)
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist) vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist)
-- terminal keymaps -- terminal
function _G.set_terminal_keymaps() vim.keymap.set('t', '<C-x>', vim.api.nvim_replace_termcodes('<C-\\><C-N>', true, true, true), { desc = 'Escape terminal mode' })
local opts = { buffer = 0 }
vim.keymap.set('t', '<esc>', [[<C-\><C-n>]], opts)
vim.keymap.set('t', '<C-h>', [[<Cmd>wincmd h<CR>]], opts)
vim.keymap.set('t', '<C-j>', [[<Cmd>wincmd j<CR>]], opts)
vim.keymap.set('t', '<C-k>', [[<Cmd>wincmd k<CR>]], opts)
vim.keymap.set('t', '<C-l>', [[<Cmd>wincmd l<CR>]], opts)
end
--
-- if you only want these mappings for toggle term use term://*toggleterm#* instead
vim.cmd 'autocmd! TermOpen term://* lua set_terminal_keymaps()'
return {}

View File

@ -39,5 +39,3 @@ vim.o.timeoutlen = 300
vim.o.completeopt = 'menuone,noselect' vim.o.completeopt = 'menuone,noselect'
vim.o.termguicolors = true vim.o.termguicolors = true
return {}

7
lua/plugins/circles.lua Normal file
View File

@ -0,0 +1,7 @@
return {
'projekt0n/circles.nvim',
dependencies = { 'nvim-tree/nvim-web-devicons' },
opts = {
icons = { empty = '', filled = '', lsp_prefix = '' },
},
}

View File

@ -8,21 +8,15 @@ function leave_snippet()
end end
end end
local border = {
{ '', 'CmpBorder' },
{ '', 'CmpBorder' },
{ '', 'CmpBorder' },
{ '', 'CmpBorder' },
{ '', 'CmpBorder' },
{ '', 'CmpBorder' },
{ '', 'CmpBorder' },
{ '', 'CmpBorder' },
}
vim.api.nvim_command [[ vim.api.nvim_command [[
autocmd ModeChanged * lua leave_snippet() autocmd ModeChanged * lua leave_snippet()
]] ]]
vim.cmd 'highlight! link CmpPmenu Pmenu'
vim.cmd 'highlight! link CmpPmenuBorder Pmenu'
vim.cmd 'highlight! CmpPmenu guibg=#282828'
vim.cmd 'highlight! CmpPmenuBorder guifg=#615750'
return { return {
{ {
'hrsh7th/nvim-cmp', 'hrsh7th/nvim-cmp',
@ -30,14 +24,20 @@ return {
'hrsh7th/cmp-nvim-lsp', 'hrsh7th/cmp-nvim-lsp',
'L3MON4D3/LuaSnip', 'L3MON4D3/LuaSnip',
'saadparwaiz1/cmp_luasnip', 'saadparwaiz1/cmp_luasnip',
'rafamadriz/friendly-snippets',
}, },
config = function() config = function()
-- nvim-cmp setup -- nvim-cmp setup
local cmp = require 'cmp' local cmp = require 'cmp'
local luasnip = require 'luasnip' local luasnip = require 'luasnip'
require('luasnip.loaders.from_vscode').lazy_load()
local border = require('utils').nvim_open_win_border
luasnip.config.setup {} luasnip.config.setup {}
local highlight_opts = 'Normal:CmpPmenu,FloatBorder:CmpPmenuBorder,CursorLine:PmenuSel,Search:None'
cmp.setup { cmp.setup {
snippet = { snippet = {
expand = function(args) expand = function(args)
@ -78,7 +78,13 @@ return {
}, },
window = { window = {
completion = { completion = {
border = border, border = border 'CmpBorder',
side_padding = 1,
winhighlight = highlight_opts,
},
documentation = {
border = border 'CmpDocBorder',
winhighlight = highlight_opts,
}, },
}, },
} }

View File

@ -1,195 +0,0 @@
return {
-- NOTE: Theme
{
'sainnhe/gruvbox-material',
priority = 1000,
lazy = false,
config = function()
vim.g.gruvbox_material_background = 'soft'
vim.g.gruvbox_material_better_performance = 1
vim.g.gruvbox_material_enable_italic = 1
vim.cmd.colorscheme 'gruvbox-material'
end,
},
-- NOTE: First, some plugins that don't require any configuration
-- Git related plugins
'tpope/vim-fugitive',
'tpope/vim-rhubarb',
-- Detect tabstop and shiftwidth automatically
'tpope/vim-sleuth',
-- NOTE: Second, plugins that require setup call (done via opts)
-- Useful plugin to show you pending keybinds.
{ 'folke/which-key.nvim', opts = {} },
-- "gc" to comment visual regions/lines
{ 'numToStr/Comment.nvim', opts = {} },
-- colorize in files
{ 'norcalli/nvim-colorizer.lua', opts = {} },
-- autopairs on newline
{ 'windwp/nvim-autopairs', opts = {} },
-- highlighting for comments
{ 'folke/todo-comments.nvim', dependencies = 'nvim-lua/plenary.nvim', opts = {} },
-- cargo crates
{ 'saecki/crates.nvim', dependencies = 'nvim-lua/plenary.nvim', opts = {} },
-- newage search plugin
{
'ggandor/leap.nvim',
dependencies = { 'tpope/vim-repeat' },
config = function()
require('leap').add_default_mappings()
end,
},
-- permanent links to fileranges
{
'ruifm/gitlinker.nvim',
config = function()
require('gitlinker').setup {
callbacks = {
['git.aflabs.org'] = require('gitlinker.hosts').get_gitlab_type_url,
},
}
end,
},
-- NOTE: Third, plugins that require some setup, but not enugh for separate file
{
-- Adds git releated signs to the gutter, as well as utilities for managing changes
'lewis6991/gitsigns.nvim',
opts = {
-- See `:help gitsigns.txt`
signs = {
add = { text = '+' },
change = { text = '~' },
delete = { text = '_' },
topdelete = { text = '' },
changedelete = { text = '~' },
},
},
},
{
-- Set lualine as statusline
'nvim-lualine/lualine.nvim',
-- See `:help lualine.txt`
opts = {
options = {
icons_enabled = false,
theme = 'gruvbox-material',
statusline_style = 'mix',
component_separators = '|',
section_separators = '',
},
sections = {
lualine_c = {
{
'filename',
file_status = true,
path = 1,
},
},
},
},
},
{
-- Add indentation guides even on blank lines
'lukas-reineke/indent-blankline.nvim',
-- Enable `lukas-reineke/indent-blankline.nvim`
-- See `:help indent_blankline.txt`
opts = {
char = '',
show_trailing_blankline_indent = false,
},
},
{
-- git blame annotations
'f-person/git-blame.nvim',
init = function()
-- disable on startup
vim.g.gitblame_enabled = 0
end,
config = function()
vim.api.nvim_set_keymap('n', '<leader>gt', ':GitBlameToggle<CR>', { desc = '[G]it Blame [T]oggle', noremap = true })
vim.api.nvim_set_keymap('n', '<leader>gu', ':GitBlameOpenCommitURL<CR>', { desc = '[G]it Blame Open Commit [U]rl', noremap = true })
end,
},
{
-- a more adventurous wildmenu
'gelguy/wilder.nvim',
dependencies = { 'romgrk/fzy-lua-native' },
config = function()
local wilder = require 'wilder'
wilder.setup { modes = { ':', '/', '?' } }
-- Disable Python remote plugin
wilder.set_option('use_python_remote_plugin', 0)
wilder.set_option('pipeline', {
wilder.branch(
wilder.cmdline_pipeline {
fuzzy = 1,
fuzzy_filter = wilder.lua_fzy_filter(),
},
wilder.vim_search_pipeline()
),
})
wilder.set_option(
'renderer',
wilder.popupmenu_renderer(wilder.popupmenu_border_theme {
highlights = {
border = 'Normal',
},
border = 'rounded',
highlighter = wilder.lua_fzy_highlighter(),
left = { ' ', wilder.popupmenu_devicons() },
right = { ' ', wilder.popupmenu_scrollbar() },
})
)
end,
},
{
'projekt0n/circles.nvim',
dependencies = { 'nvim-tree/nvim-web-devicons' },
opts = {
icons = { empty = '', filled = '', lsp_prefix = '' },
},
},
-- file menu
{
'nvim-tree/nvim-tree.lua',
config = function()
require('nvim-tree').setup {
renderer = {
icons = {
glyphs = require('circles').get_nvimtree_glyphs(),
},
},
filters = {
custom = {
'__pycache__',
},
},
git = {
ignore = false,
},
}
end,
},
}

12
lua/plugins/gitblame.lua Normal file
View File

@ -0,0 +1,12 @@
return {
-- git blame annotations
'f-person/git-blame.nvim',
init = function()
-- disable on startup
vim.g.gitblame_enabled = 0
end,
config = function()
vim.api.nvim_set_keymap('n', '<leader>gt', ':GitBlameToggle<CR>', { desc = '[G]it Blame [T]oggle', noremap = true })
vim.api.nvim_set_keymap('n', '<leader>gu', ':GitBlameOpenCommitURL<CR>', { desc = '[G]it Blame Open Commit [U]rl', noremap = true })
end,
}

10
lua/plugins/gitlinker.lua Normal file
View File

@ -0,0 +1,10 @@
return {
'ruifm/gitlinker.nvim',
config = function()
require('gitlinker').setup {
callbacks = {
['git.aflabs.org'] = require('gitlinker.hosts').get_gitlab_type_url,
},
}
end,
}

14
lua/plugins/gitsigns.lua Normal file
View File

@ -0,0 +1,14 @@
return {
-- Adds git releated signs to the gutter, as well as utilities for managing changes
'lewis6991/gitsigns.nvim',
opts = {
-- See `:help gitsigns.txt`
signs = {
add = { text = '+' },
change = { text = '~' },
delete = { text = '_' },
topdelete = { text = '' },
changedelete = { text = '~' },
},
},
}

View File

@ -0,0 +1,10 @@
return {
-- Add indentation guides even on blank lines
'lukas-reineke/indent-blankline.nvim',
-- Enable `lukas-reineke/indent-blankline.nvim`
-- See `:help indent_blankline.txt`
opts = {
char = '',
show_trailing_blankline_indent = false,
},
}

7
lua/plugins/leap.lua Normal file
View File

@ -0,0 +1,7 @@
return {
'ggandor/leap.nvim',
dependencies = { 'tpope/vim-repeat' },
config = function()
require('leap').add_default_mappings()
end,
}

21
lua/plugins/lualine.lua Normal file
View File

@ -0,0 +1,21 @@
return {
'nvim-lualine/lualine.nvim',
opts = {
options = {
icons_enabled = false,
theme = 'gruvbox-material',
statusline_style = 'mix',
component_separators = '|',
section_separators = '',
},
sections = {
lualine_c = {
{
'filename',
file_status = true,
path = 1,
},
},
},
},
}

8
lua/plugins/oil.lua Normal file
View File

@ -0,0 +1,8 @@
return {
'stevearc/oil.nvim',
dependencies = { 'nvim-tree/nvim-web-devicons' },
config = function()
require('oil').setup()
vim.keymap.set('n', '-', require('oil').open, { desc = 'Open parent directory' })
end,
}

View File

@ -25,15 +25,10 @@ return {
keymaps = { keymaps = {
init_selection = '<C-Space>', init_selection = '<C-Space>',
node_incremental = '<C-Space>', node_incremental = '<C-Space>',
scope_incremental = '<C-Space>', scope_incremental = '<C-M-Space>',
node_decremental = '<C-Bslash>', node_decremental = '<C-Bslash>',
}, },
}, },
-- rainbow
rainbow = {
enable = true,
extended_mode = true,
},
-- refactor -- refactor
refactor = { refactor = {
highlight_definitions = { enable = true, clear_on_cursor_move = true }, highlight_definitions = { enable = true, clear_on_cursor_move = true },

39
lua/plugins/wilder.lua Normal file
View File

@ -0,0 +1,39 @@
return {
-- a more adventurous wildmenu
'gelguy/wilder.nvim',
dependencies = { 'romgrk/fzy-lua-native' },
config = function()
local wilder = require 'wilder'
wilder.setup { modes = { ':', '/', '?' } }
-- Disable Python remote plugin
wilder.set_option('use_python_remote_plugin', 0)
wilder.set_option('pipeline', {
wilder.branch(
wilder.cmdline_pipeline {
fuzzy = 1,
fuzzy_filter = wilder.lua_fzy_filter(),
},
wilder.vim_search_pipeline()
),
})
wilder.set_option(
'renderer',
wilder.popupmenu_renderer(wilder.popupmenu_border_theme {
highlights = {
border = 'Normal',
},
-- stylua: ignore
border = {
'', '', '',
'', '',
'', '', '',
},
highlighter = wilder.lua_fzy_highlighter(),
left = { ' ', wilder.popupmenu_devicons() },
right = { ' ', wilder.popupmenu_scrollbar() },
})
)
end,
}

16
lua/utils.lua Normal file
View File

@ -0,0 +1,16 @@
local M = {}
M.nvim_open_win_border = function(hl_name)
return {
{ '', hl_name },
{ '', hl_name },
{ '', hl_name },
{ '', hl_name },
{ '', hl_name },
{ '', hl_name },
{ '', hl_name },
{ '', hl_name },
}
end
return M