WIP: Switch to NixOS #5

Draft
FunctionalHacker wants to merge 1349 commits from nix into main
11 changed files with 277 additions and 285 deletions
Showing only changes of commit fa8e0e7331 - Show all commits

View file

@ -12,8 +12,9 @@ require('jdtls').start_or_attach({
'java.base/java.util=ALL-UNNAMED', '--add-opens', 'java.base/java.util=ALL-UNNAMED', '--add-opens',
'java.base/java.lang=ALL-UNNAMED', '-jar', nvim_local_dir .. 'java.base/java.lang=ALL-UNNAMED', '-jar', nvim_local_dir ..
'/mason/packages/jdtls/plugins/org.eclipse.equinox.launcher_1.6.400.v20210924-0641.jar', '/mason/packages/jdtls/plugins/org.eclipse.equinox.launcher_1.6.400.v20210924-0641.jar',
'-configuration', nvim_local_dir .. '/mason/packages/jdtls/config_linux', '-configuration',
'-data', workspace_dir nvim_local_dir .. '/mason/packages/jdtls/config_linux', '-data',
workspace_dir
} }
}) })

View file

@ -2,4 +2,4 @@
require 'common' require 'common'
MapKey('n', 'q', '<cmd>q<CR>') MapKey('n', 'q', '<cmd>q<CR>')
--vim.cmd('set nomodifiable') -- vim.cmd('set nomodifiable')

View file

@ -1,68 +1,62 @@
return function() return function()
-- Setup git completion source -- Setup git completion source
require("cmp_git").setup() require("cmp_git").setup()
-- Set completeopt to have a better completion experience -- Set completeopt to have a better completion experience
vim.o.completeopt = 'menuone,noselect' vim.o.completeopt = 'menuone,noselect'
-- luasnip setup -- luasnip setup
local luasnip = require 'luasnip' local luasnip = require 'luasnip'
-- nvim-cmp setup -- nvim-cmp setup
local cmp = require 'cmp' local cmp = require 'cmp'
cmp.setup { cmp.setup {
snippet = { snippet = {
expand = function(args) expand = function(args)
require('luasnip').lsp_expand(args.body) require('luasnip').lsp_expand(args.body)
end, end
}, },
mapping = { mapping = {
['<C-p>'] = cmp.mapping.select_prev_item(), ['<C-p>'] = cmp.mapping.select_prev_item(),
['<C-n>'] = cmp.mapping.select_next_item(), ['<C-n>'] = cmp.mapping.select_next_item(),
['<C-d>'] = cmp.mapping.scroll_docs(-4), ['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4), ['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(), ['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.close(), ['<C-e>'] = cmp.mapping.close(),
['<CR>'] = cmp.mapping.confirm { ['<CR>'] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace, behavior = cmp.ConfirmBehavior.Replace,
select = true, select = true
}, },
['<Tab>'] = function(fallback) ['<Tab>'] = function(fallback)
if cmp.visible() then if cmp.visible() then
cmp.select_next_item() cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump() luasnip.expand_or_jump()
else else
fallback() fallback()
end end
end, end,
['<S-Tab>'] = function(fallback) ['<S-Tab>'] = function(fallback)
if cmp.visible() then if cmp.visible() then
cmp.select_prev_item() cmp.select_prev_item()
elseif luasnip.jumpable(-1) then elseif luasnip.jumpable(-1) then
luasnip.jump(-1) luasnip.jump(-1)
else else
fallback() fallback()
end end
end, end
}, },
sources = { sources = {
{ name = 'nvim_lsp' }, {name = 'nvim_lsp'}, {name = 'luasnip'}, {name = 'path'},
{ name = 'luasnip' }, {name = 'git'}, {name = 'buffer'}
{ name = 'path' }, }
{ name = 'git' }, }
{ name = 'buffer' },
},
}
-- Enable autopairs when enter is processed -- Enable autopairs when enter is processed
-- on completion -- on completion
local cmp_autopairs = require 'nvim-autopairs.completion.cmp' local cmp_autopairs = require 'nvim-autopairs.completion.cmp'
cmp.event:on( cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done())
'confirm_done',
cmp_autopairs.on_confirm_done()
)
-- load friendly-snippets to luasnip -- load friendly-snippets to luasnip
require('luasnip/loaders/from_vscode').lazy_load() require('luasnip/loaders/from_vscode').lazy_load()
end end

View file

@ -1,51 +1,54 @@
return function () return function()
require('catppuccin').setup({ require('catppuccin').setup({
transparent_background = false, transparent_background = false,
term_colors = false, term_colors = false,
compile = {enabled = true, path = vim.fn.stdpath 'cache' .. '/catppuccin'}, compile = {
styles = { enabled = true,
comments = {'italic'}, path = vim.fn.stdpath 'cache' .. '/catppuccin'
functions = {'italic'}, },
keywords = {'italic'}, styles = {
strings = {}, comments = {'italic'},
variables = {} functions = {'italic'},
}, keywords = {'italic'},
integrations = { strings = {},
treesitter = true, variables = {}
native_lsp = { },
enabled = true, integrations = {
virtual_text = { treesitter = true,
errors = {'italic'}, native_lsp = {
hints = {'italic'}, enabled = true,
warnings = {'italic'}, virtual_text = {
information = {'italic'} errors = {'italic'},
}, hints = {'italic'},
underlines = { warnings = {'italic'},
errors = {'underline'}, information = {'italic'}
hints = {'underline'}, },
warnings = {'underline'}, underlines = {
information = {'underline'} errors = {'underline'},
} hints = {'underline'},
}, warnings = {'underline'},
lsp_trouble = false, information = {'underline'}
lsp_saga = false, }
gitgutter = true, },
gitsigns = false, lsp_trouble = false,
telescope = true, lsp_saga = false,
nvimtree = {enabled = false, show_root = false}, gitgutter = true,
which_key = false, gitsigns = false,
indent_blankline = {enabled = true, colored_indent_levels = false}, telescope = true,
dashboard = false, nvimtree = {enabled = false, show_root = false},
neogit = false, which_key = false,
vim_sneak = false, indent_blankline = {enabled = true, colored_indent_levels = false},
fern = false, dashboard = false,
barbar = false, neogit = false,
bufferline = false, vim_sneak = false,
markdown = false, fern = false,
lightspeed = false, barbar = false,
ts_rainbow = false, bufferline = false,
hop = false markdown = false,
} lightspeed = false,
}) ts_rainbow = false,
vim.cmd [[colorscheme catppuccin]] hop = false
}
})
vim.cmd [[colorscheme catppuccin]]
end end

View file

@ -1,8 +1,8 @@
return function () return function()
vim.opt.list = true vim.opt.list = true
require('indent_blankline').setup { require('indent_blankline').setup {
space_char_blankline = ' ', space_char_blankline = ' ',
show_current_context = true, show_current_context = true,
show_current_context_start = true, show_current_context_start = true
} }
end end

View file

@ -3,182 +3,179 @@ local fn = vim.fn
-- Install packer if it's not yet installed -- Install packer if it's not yet installed
local install_path = fn.stdpath('data') .. '/site/pack/packer/opt/packer.nvim' local install_path = fn.stdpath('data') .. '/site/pack/packer/opt/packer.nvim'
if fn.empty(fn.glob(install_path)) > 0 then if fn.empty(fn.glob(install_path)) > 0 then
print('Installing Packer') print('Installing Packer')
Packer_installed = fn.system({ Packer_installed = fn.system({
'git', 'clone', '--depth', '1', 'git', 'clone', '--depth', '1',
'https://github.com/wbthomason/packer.nvim', install_path 'https://github.com/wbthomason/packer.nvim', install_path
}) })
vim.o.runtimepath = vim.fn.stdpath('data') .. '/site/pack/*/start/*,' .. vim.o.runtimepath = vim.fn.stdpath('data') .. '/site/pack/*/start/*,' ..
vim.o.runtimepath vim.o.runtimepath
print('Installed Packer') print('Installed Packer')
end end
-- Configure packer -- Configure packer
vim.cmd [[packadd packer.nvim]] vim.cmd [[packadd packer.nvim]]
require('packer').startup(function() require('packer').startup(function()
local use = require('packer').use local use = require('packer').use
-- The plugin manager itself -- The plugin manager itself
use {'wbthomason/packer.nvim', opt=true} use {'wbthomason/packer.nvim', opt = true}
-- Colorscheme -- Colorscheme
use { use {
'catppuccin/nvim', 'catppuccin/nvim',
as = 'catppuccin', as = 'catppuccin',
config = require('plugins.colorscheme'), config = require('plugins.colorscheme')
} }
-- Git in signcolumn -- Git in signcolumn
use 'airblade/vim-gitgutter' use 'airblade/vim-gitgutter'
-- Statusline -- Statusline
use { use {
'hoob3rt/lualine.nvim', 'hoob3rt/lualine.nvim',
requires = { 'kyazdani42/nvim-web-devicons', opt = true }, requires = {'kyazdani42/nvim-web-devicons', opt = true},
config = function() config = function()
require('lualine').setup { require('lualine').setup {options = {theme = 'catppuccin'}}
options = { theme = 'catppuccin' } end
} }
end,
}
-- Tabline/bufferline -- Tabline/bufferline
use { use {
'akinsho/nvim-bufferline.lua', 'akinsho/nvim-bufferline.lua',
tag = '*', tag = '*',
requires = 'kyazdani42/nvim-web-devicons', requires = 'kyazdani42/nvim-web-devicons',
config = function() require('bufferline').setup {} end config = function() require('bufferline').setup {} end
} }
-- Git commands -- Git commands
use 'tpope/vim-fugitive' use 'tpope/vim-fugitive'
-- Indent characters -- Indent characters
use { use {
'lukas-reineke/indent-blankline.nvim', 'lukas-reineke/indent-blankline.nvim',
config = require('plugins.indent-blankline') config = require('plugins.indent-blankline')
} }
-- Tree explorer -- Tree explorer
use { use {
'kyazdani42/nvim-tree.lua', 'kyazdani42/nvim-tree.lua',
requires = 'kyazdani42/nvim-web-devicons', requires = 'kyazdani42/nvim-web-devicons',
config = function() require('nvim-tree').setup {} end config = function() require('nvim-tree').setup {} end
} }
-- Telescope -- Telescope
use { use {
'nvim-telescope/telescope.nvim', 'nvim-telescope/telescope.nvim',
config = require('plugins.telescope'), config = require('plugins.telescope'),
requires = { requires = {
{ 'nvim-lua/plenary.nvim' }, -- Internal dep for telescope {'nvim-lua/plenary.nvim'}, -- Internal dep for telescope
{ 'nvim-telescope/telescope-fzf-native.nvim', run = 'make' }, -- Use fzf for fuzzy finder {'nvim-telescope/telescope-fzf-native.nvim', run = 'make'}, -- Use fzf for fuzzy finder
{ 'nvim-telescope/telescope-ui-select.nvim' } -- Replace vim built in select with telescope {'nvim-telescope/telescope-ui-select.nvim'} -- Replace vim built in select with telescope
} }
} }
-- Do stuff as sudo -- Do stuff as sudo
use 'lambdalisue/suda.vim' use 'lambdalisue/suda.vim'
-- Display possible keybinds -- Display possible keybinds
use { use {
'folke/which-key.nvim', 'folke/which-key.nvim',
config = function() require('which-key').setup {} end config = function()
} require('which-key').setup {spelling = {enabled = true}}
end
}
-- Read editorconfig settings -- Read editorconfig settings
use 'editorconfig/editorconfig-vim' use 'editorconfig/editorconfig-vim'
-- Install LSP server executables -- Install LSP server executables
use { use {
'williamboman/mason.nvim', 'williamboman/mason.nvim',
config = function() require('mason').setup {} end config = function() require('mason').setup {} end
} }
use { use {
'williamboman/mason-lspconfig.nvim', 'williamboman/mason-lspconfig.nvim',
config = function() config = function()
require('mason-lspconfig').setup { automatic_installation = true } require('mason-lspconfig').setup {automatic_installation = true}
end end
} }
-- Configs for built-in LSP -- Configs for built-in LSP
use { use {'neovim/nvim-lspconfig', config = require('plugins.lspconfig').setup}
'neovim/nvim-lspconfig',
config = require('plugins.lspconfig').setup
}
-- Additional LSP features for Java -- Additional LSP features for Java
use 'mfussenegger/nvim-jdtls' use 'mfussenegger/nvim-jdtls'
-- Display function signature -- Display function signature
use 'ray-x/lsp_signature.nvim' use 'ray-x/lsp_signature.nvim'
-- Completion -- Completion
use { use {
'hrsh7th/nvim-cmp', 'hrsh7th/nvim-cmp',
requires = { requires = {
{ 'hrsh7th/cmp-nvim-lsp' }, -- LSP source {'hrsh7th/cmp-nvim-lsp'}, -- LSP source
{ 'hrsh7th/cmp-path' }, -- Path source {'hrsh7th/cmp-path'}, -- Path source
{ 'petertriho/cmp-git', requires = "nvim-lua/plenary.nvim" }, -- Git source {'petertriho/cmp-git', requires = "nvim-lua/plenary.nvim"}, -- Git source
{ 'hrsh7th/cmp-buffer' }, -- Buffer source {'hrsh7th/cmp-buffer'}, -- Buffer source
{ 'saadparwaiz1/cmp_luasnip' }, -- Snippets source {'saadparwaiz1/cmp_luasnip'}, -- Snippets source
{ 'L3MON4D3/LuaSnip' }, -- Snippets plugin {'L3MON4D3/LuaSnip'}, -- Snippets plugin
{ 'rafamadriz/friendly-snippets' }, -- Snippets collection {'rafamadriz/friendly-snippets'} -- Snippets collection
}, },
config = require('plugins.cmp'), config = require('plugins.cmp')
} }
-- Automatic brackets -- Automatic brackets
use { use {
'windwp/nvim-autopairs', 'windwp/nvim-autopairs',
config = function() require('nvim-autopairs').setup{} end config = function() require('nvim-autopairs').setup {} end
} }
-- treesitter -- treesitter
use { use {
'nvim-treesitter/nvim-treesitter', 'nvim-treesitter/nvim-treesitter',
run = function() run = function()
require('nvim-treesitter.install').update({ with_sync = true }) require('nvim-treesitter.install').update({with_sync = true})
end, end,
config = require('plugins.treesitter') config = require('plugins.treesitter')
} }
-- treesitter plugin for commentstring -- treesitter plugin for commentstring
use 'JoosepAlviste/nvim-ts-context-commentstring' use 'JoosepAlviste/nvim-ts-context-commentstring'
-- Additional plugins for formats not supported -- Additional plugins for formats not supported
-- by treesitter -- by treesitter
use 'jamespeapen/swayconfig.vim' use 'jamespeapen/swayconfig.vim'
-- mappings for commenting in code -- mappings for commenting in code
use 'tpope/vim-commentary' use 'tpope/vim-commentary'
-- we all know this one -- we all know this one
use 'tpope/vim-surround' use 'tpope/vim-surround'
-- Formatter plugin -- Formatter plugin
use 'sbdchd/neoformat' use 'sbdchd/neoformat'
-- Make editing passwords safer -- Make editing passwords safer
use { use {
'https://git.zx2c4.com/password-store', 'https://git.zx2c4.com/password-store',
rtp = 'contrib/vim/redact_pass.vim' rtp = 'contrib/vim/redact_pass.vim'
} }
-- Neovim inside Firefox -- Neovim inside Firefox
use { use {
'glacambre/firenvim', 'glacambre/firenvim',
run = function() vim.fn['firenvim#install'](0) end run = function() vim.fn['firenvim#install'](0) end
} }
-- Vim <3 Asciidoctor -- Vim <3 Asciidoctor
use 'habamax/vim-asciidoctor' use 'habamax/vim-asciidoctor'
end) end)
-- Sync plugins if Packer was just -- Sync plugins if Packer was just
-- installed -- installed
if Packer_installed then if Packer_installed then
print('Syncing plugins') print('Syncing plugins')
require('packer').sync() require('packer').sync()
end end

View file

@ -1,3 +1 @@
require'lualine'.setup { require'lualine'.setup {options = {theme = 'catppuccin'}}
options = {theme = 'catppuccin'},
}

View file

@ -1,6 +1,6 @@
return function () return function()
local telescope = require('telescope') local telescope = require('telescope')
telescope.setup {} telescope.setup {}
telescope.load_extension('fzf') telescope.load_extension('fzf')
telescope.load_extension('ui-select') telescope.load_extension('ui-select')
end end

View file

@ -1,16 +1,17 @@
return function () return function()
require'nvim-treesitter.configs'.setup { require'nvim-treesitter.configs'.setup {
ensure_installed = { ensure_installed = {
'bash', 'c', 'css', 'dockerfile', 'html', 'http', 'java', 'json', 'bash', 'c', 'css', 'dockerfile', 'html', 'http', 'java', 'json',
'json5', 'latex', 'lua', 'make', 'markdown', 'php', 'python', 'regex', 'json5', 'latex', 'lua', 'make', 'markdown', 'php', 'python',
'rst', 'scss', 'toml', 'tsx', 'typescript', 'javascript', 'yaml' 'regex', 'rst', 'scss', 'toml', 'tsx', 'typescript', 'javascript',
}, 'yaml'
highlight = {enable = true}, },
indent = {enable = true}, highlight = {enable = true},
incremental_selection = {enable = true}, indent = {enable = true},
context_commentstring = {enable = true} incremental_selection = {enable = true},
} context_commentstring = {enable = true}
}
--vim.wo.foldmethod = 'expr' -- vim.wo.foldmethod = 'expr'
--im.wo.foldexpr = 'nvim_treesitter#foldexpr()' -- im.wo.foldexpr = 'nvim_treesitter#foldexpr()'
end end

View file

@ -38,12 +38,10 @@ cmd 'highlight SignColumn guibg=transparent'
-- Use suda by default -- Use suda by default
g.suda_smart_edit = 1 g.suda_smart_edit = 1
-- Split direction -- Split direction
o.splitbelow = true o.splitbelow = true
o.splitright = true o.splitright = true
-- Case insensitive search -- Case insensitive search
o.ignorecase = true o.ignorecase = true
o.smartcase = true o.smartcase = true