1
Fork 0

Merge branch 'master' of github.com:Mateiadrielrafael/nixos-config

This commit is contained in:
Matei Adriel 2022-08-25 00:11:41 +03:00
commit 93cde742ca
22 changed files with 83 additions and 180 deletions

View file

@ -1 +1,2 @@
vim.cmd("syntax hkf")
vim.api.nvim_buf_set_option(0, "commentstring", "-- %s")

View file

@ -1,5 +1,4 @@
local A = require("my.plugins.arpeggio")
local C = require("my.plugins.comment")
print("Initializing nix keybinds...")
@ -9,4 +8,4 @@ A.chordSilent("n", "ug",
{ settings = "b" })
-- Idk why this isn't here by default
C.setCommentString("nix", "# %s")
vim.api.nvim_buf_set_option(0, "commentstring", "# %s")

View file

@ -1,14 +0,0 @@
local M = {}
function M.augroup(name, inside)
vim.cmd('augroup ' .. name)
vim.cmd('autocmd!')
inside()
vim.cmd('augroup END')
end
function M.autocmd(event, glob, action)
vim.cmd('autocmd ' .. event .. ' ' .. glob .. ' ' .. action)
end
return M

View file

@ -3,11 +3,11 @@ local arpeggio = require("my.plugins.arpeggio")
local M = {}
function M.map(mode, lhs, rhs, opts)
local function map(mode, lhs, rhs, opts)
if string.len(mode) > 1 then
for i = 1, #mode do
local c = mode:sub(i, i)
M.map(c, lhs, rhs, opts)
map(c, lhs, rhs, opts)
end
else
local options = helpers.mergeTables(opts, { noremap = true })
@ -17,11 +17,11 @@ end
function M.mapSilent(mode, lhs, rhs, opts)
local options = helpers.mergeTables(opts, { silent = true })
M.map(mode, lhs, rhs, options)
map(mode, lhs, rhs, options)
end
function M.setup()
M.map("n", "qq", ":wq<cr>") -- Save and quit
vim.keymap.set("n", "qq", ":wq<cr>") -- Save and quit
-- Create chords
if arpeggio ~= nil then

View file

@ -2,14 +2,6 @@ local M = {}
function M.setup()
vim.o.foldmethod = "marker"
-- vim.cmd([[
-- augroup remember_folds
-- autocmd!
-- autocmd BufWinLeave *.* if &ft !=# 'help' | mkview | endif
-- autocmd BufWinEnter *.* if &ft !=# 'help' | silent! loadview | endif
-- augroup END
-- ]])
end
return M

View file

@ -3,7 +3,8 @@ local M = {}
function M.setup()
local paq = require("paq")
local themePackages = require("my.theme").deps
local base = { "neovim/nvim-lspconfig", -- configures lsps for me
local base = {
"neovim/nvim-lspconfig", -- configures lsps for me
"windwp/nvim-autopairs", -- closes pairs for me (should look for a better one)
"nvim-lua/plenary.nvim", -- async utility lib it seems?
"nvim-telescope/telescope.nvim", -- fuzzy search for say opening files
@ -44,7 +45,13 @@ function M.setup()
"easymotion/vim-easymotion", -- removes the need for spamming w or e
"tpope/vim-surround", -- work with brackets, quotes, tags, etc
"MunifTanjim/nui.nvim", -- ui stuff required by idris2
"ShinKage/idris2-nvim" -- idris2 support
"ShinKage/idris2-nvim", -- idris2 support
"udalov/kotlin-vim", -- kotlin support
"haringsrob/nvim_context_vt", -- show context on closing parenthesis
"vuki656/package-info.nvim", -- shows latest versions in package.json
-- Git stuff
"ruifm/gitlinker.nvim", -- generate permalinks for code
"TimUntersberger/neogit" -- magit clone
}
table.insert(base, "nvim-treesitter/nvim-treesitter")

View file

@ -1,26 +0,0 @@
local A = require("my.helpers.augroup")
local M = {}
local extraCommentStrings = { lean = "/- %s -/", bkf = "-- %s" }
-- Update comments for certain languages
function M.setCommentString(extension, commentString)
A.augroup('set-commentstring-' .. extension, function()
local action =
':lua vim.api.nvim_buf_set_option(0, "commentstring", "' ..
commentString .. '")'
A.autocmd('BufEnter', '*.' .. extension, action)
A.autocmd('BufFilePost', '*.' .. extension, action)
end)
end
function M.setup()
require('nvim_comment').setup()
for lang, commentString in pairs(extraCommentStrings) do
M.setCommentString(lang, commentString)
end
end
return M

View file

@ -1,5 +1,3 @@
local mapSilent = require("my.keymaps").mapSilent
local M = {}
local bindings = {
@ -13,7 +11,7 @@ local bindings = {
function M.setup()
for action, keybind in pairs(bindings) do
-- Maps the keybind to the action
mapSilent('n', keybind, "<cmd>lua require('fzf-lua')." .. action .. "()<CR>")
vim.keymap.set('n', keybind, require('fzf-lua')[action])
end
end

View file

@ -3,7 +3,9 @@ local M = {}
function M.setup()
require('nvim-autopairs').setup()
--
require "gitlinker".setup()
require('nvim_comment').setup()
vscode.unless(function()
require("presence"):setup({})
require("my.plugins.dashboard").setup()
@ -14,13 +16,12 @@ function M.setup()
require("my.plugins.nvim-tree").setup()
require("my.plugins.vimtex").setup()
require("my.plugins.lean").setup()
require("my.plugins.lualine").setup()
require("my.plugins.vimux").setup()
end)
require("my.plugins.vim-tmux-navigator").setup()
require("my.plugins.lualine").setup()
require("my.plugins.comment").setup()
require("my.plugins.neogit").setup()
require("my.plugins.telescope").setup()
require("my.plugins.vimux").setup()
-- require("my.plugins.idris").setup()
-- require("which-key").setup()

View file

@ -1,54 +0,0 @@
local A = require("my.helpers.augroup")
local map = require("my.keymaps").mapSilent
local arpeggio = require("my.plugins.arpeggio")
local M = {}
local extraBrackets = {
lean = {{"", ""}}, -- lean
all = {
-- {"(", ")"}, {"[", "]"}, {"'", "'"}, {'"', '"'}, {"{", "}"}, {"`", "`"}
} -- more general stuff
}
function M.createBracketCommand(lhs, rhs, isGlobal, opts)
local suffix = ""
if isGlobal then suffix = "!" end
return ":Brackets" .. suffix .. " " .. lhs .. " " .. rhs .. " " ..
(opts or "")
end
function M.createBracket(lhs, rhs, isGlobal, opts)
vim.cmd(M.createBracketCommand(lhs, rhs, isGlobal, opts))
end
function M.setup()
if arpeggio == nil then return end
vim.g.marker_define_jump_mappings = 0 -- disable automatic binding of marker jumping (conflicts with tmux-vim-navigator)
arpeggio.chord("nv", "sj", '<Plug>MarkersJumpF')
arpeggio.chord("nv", "sk", '<Plug>MarkersJumpB')
arpeggio.chord("nv", "mi", '<Plug>MarkersMark')
arpeggio.chord("nv", "ml", '<Plug>MarkersCloseAllAndJumpToLast')
arpeggio.chord("nv", "mo", '<Plug>MarkersJumpOutside')
for key, brackets in pairs(extraBrackets) do
A.augroup('custom-brackets' .. key, function()
for _, v in ipairs(brackets) do
local action = M.createBracketCommand(v[1], v[2], 0, v[3] or "")
local glob = '*.' .. key
if key == "all" then
-- The all key just matches everything
glob = "*"
end
A.autocmd('BufEnter', glob, action)
end
end)
end
end
return M

View file

@ -1,7 +1,6 @@
local M = {}
local function map(buf, mode, lhs, rhs, opts)
local options = { noremap = true, silent = true }
if opts then options = vim.tbl_extend('force', options, opts) end
vim.api.nvim_buf_set_keymap(buf, mode, lhs, rhs, options)
@ -11,14 +10,14 @@ function M.on_attach(client, bufnr)
-- Enable completion triggered by <c-x><c-o>
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
if client.server_capabilities.documentFormattingProvider then
print("Initializing formatter...")
vim.cmd([[
augroup LspFormatting
autocmd! * <buffer>
autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_sync()
augroup END
]])
vim.api.nvim_create_autocmd("BufWritePre", {
group = vim.api.nvim_create_augroup("LspFormatting", {}),
callback = vim.lsp.buf.formatting_sync
})
end
print("Setting up keybinds...")

View file

@ -4,20 +4,20 @@ function M.setup()
require('lualine').setup({
theme = vim.g.lualineTheme,
options = {
section_separators = {left = '', right = ''},
component_separators = {left = '', right = ''}
section_separators = { left = '', right = '' },
component_separators = { left = '', right = '' }
},
sections = {
lualine_a = {'mode'},
lualine_b = {'branch', 'diff', 'diagnostics'},
lualine_c = {'filename'},
lualine_a = { 'mode' },
lualine_b = { 'branch', 'diff', 'diagnostics' },
lualine_c = { 'filename' },
lualine_x = {},
-- lualine_y = {'encoding', 'fileformat', 'filetype'},
lualine_y = {'filetype'},
lualine_z = {'location'}
lualine_y = { 'filetype' },
lualine_z = { 'location' }
},
-- Integration with other plugins
extensions = {"nvim-tree"}
extensions = { "nvim-tree" }
})
end

View file

@ -0,0 +1,11 @@
local M = {}
function M.setup()
local neogit = require("neogit")
neogit.setup()
vim.keymap.set("n", "<C-g>", neogit.open)
end
return M

View file

@ -1,11 +1,9 @@
local mapSilent = require("my.keymaps").mapSilent
local M = {}
function M.setup()
require'nvim-tree'.setup()
-- Toggle nerdtree with Control-t
mapSilent("n", "<C-n>", ":NvimTreeToggle<CR>")
require 'nvim-tree'.setup()
-- Toggle nerdtree with Control-n
vim.keymap.set("n", "<C-n>", ":NvimTreeToggle<CR>")
end
return M

View file

@ -5,13 +5,15 @@ function M.setup()
ensure_installed = {
"bash", "javascript", "typescript", "c", "cpp", "css", "dockerfile",
"elixir", "fish", "html", "json", "latex", "python", "rust", "scss",
"toml", "tsx", "vim", "yaml", "nix"
"toml", "tsx", "vim", "yaml", "nix", "kotlin"
},
sync_install = false,
indent = { enable = true },
highlight = {
enable = true,
disable = { "kotlin" },
-- 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.

View file

@ -1,15 +0,0 @@
local map = require("my.keymaps").map
local M = {}
-- For some reason the default mappings do not work for me
function M.setup()
vim.g.tmux_navigator_no_mappings = 1
map("n", "<C-h>", ":TmuxNavigateLeft<cr>")
map("n", "<C-j>", ":TmuxNavigateDown<cr>")
map("n", "<C-k>", ":TmuxNavigateUp<cr>")
map("n", "<C-l>", ":TmuxNavigateRight<cr>")
end
return M

View file

@ -3,8 +3,8 @@ let
paq = pkgs.fetchFromGitHub {
owner = "savq";
repo = "paq-nvim";
rev = "cbbb8a550e35b1e6c9ddf7b098b25e6c2d8b1e86";
sha256 = "0fsbww2kqwayi1azhglsjal6mwh68n03ylxxqzq17v7sar17vx4c";
rev = "bc5950b990729464f2493b1eaab5a7721bd40bf5";
sha256 = "0rsv3j5rxfv7ys9zvq775f63vy6w880b0xhyr164y8fcadhpypb3";
};
theme = pkgs.myThemes.current;

View file

@ -3,6 +3,8 @@
home.packages = with pkgs; [
kotlin
gradle
jdk
android-studio
];
};
}

View file

@ -52,6 +52,7 @@ in
};
# Vim plugins
myVimPlugins = {
githubNvimTheme = foreign.githubNvimTheme;

View file

@ -7,8 +7,8 @@ lib.lists.map (theme: pkgs.callPackage theme { }) [
(catppuccin {
# wallpaper = "os/nix-magenta-pink-1920x1080.png";
# wallpaper = "minimalistic/tetris.png";
# wallpaper = "os/nix-black-4k.png";
wallpaper = "misc/comfy-home.png";
wallpaper = "os/nix-black-4k.png";
# wallpaper = "misc/comfy-home.png";
# wallpaper = "landscapes/forrest.png";
# wallpaper = "landscapes/salty_mountains.png";
# wallpaper = "misc/rainbow.png";

View file

@ -56,6 +56,7 @@ in
accelSpeed = "3.5";
tappingDragLock = false;
disableWhileTyping = true;
};
};
};