more working plugins

This commit is contained in:
Noah Masur
2022-11-27 17:21:18 -07:00
parent bb200016cb
commit 47a1823af4
9 changed files with 244 additions and 206 deletions

View File

@ -2,42 +2,11 @@
-- Settings
-- ===========================================================================
vim.o.termguicolors = true --- Set to truecolor
vim.o.hidden = true --- Don't unload buffers when leaving them
vim.wo.number = true --- Show line numbers
vim.wo.relativenumber = true --- Relative numbers instead of absolute
vim.o.list = true --- Reveal whitespace with dashes
vim.o.expandtab = true --- Tabs into spaces
vim.o.shiftwidth = 4 --- Amount to shift with > key
vim.o.softtabstop = 4 --- Amount to shift with <TAB> key
vim.o.ignorecase = true --- Ignore case when searching
vim.o.smartcase = true --- Check case when using capitals in search
vim.o.infercase = true --- Don't match cases when completing suggestions
vim.o.incsearch = true --- Search while typing
vim.o.visualbell = true --- No sounds
vim.o.scrolljump = 1 --- Number of lines to scroll
vim.o.scrolloff = 3 --- Margin of lines to see while scrolling
vim.o.splitright = true --- Vertical splits on the right side
vim.o.splitbelow = true --- Horizontal splits on the bottom side
vim.o.pastetoggle = "<F3>" --- Use F3 to enter raw paste mode
vim.o.clipboard = "unnamedplus" --- Uses system clipboard for yanking
vim.o.updatetime = 300 --- Faster diagnostics
vim.o.mouse = "nv" --- Mouse interaction / scrolling
-- Neovim features
vim.o.inccommand = "split" --- Live preview search and replace
--- Required for nvim-cmp completion
vim.opt.completeopt = {
"menu",
"menuone",
"noselect",
}
-- Remember last position when reopening file
vim.api.nvim_exec(
[[
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
]],
]] ,
false
)
@ -54,7 +23,7 @@ vim.api.nvim_exec(
if !isdirectory(&backupdir)
call mkdir(&backupdir, "p")
endif
]],
]] ,
false
)
@ -63,7 +32,7 @@ vim.api.nvim_exec(
[[
au FileType tex inoremap ;bf \textbf{}<Esc>i
au BufWritePost *.tex silent! execute "!pdflatex -output-directory=%:p:h % >/dev/null 2>&1" | redraw!
]],
]] ,
false
)
@ -71,7 +40,7 @@ vim.api.nvim_exec(
vim.api.nvim_exec(
[[
au TextYankPost * silent! lua vim.highlight.on_yank { timeout = 250 }
]],
]] ,
false
)

View File

@ -24,13 +24,10 @@ in {
cmp-buffer = (withSrc prev.vimPlugins.cmp-buffer inputs.cmp-buffer);
plenary-nvim = (withSrc prev.vimPlugins.plenary-nvim inputs.plenary-nvim);
null-ls-nvim = (withSrc prev.vimPlugins.null-ls-nvim inputs.null-ls-nvim);
vim-surround = (withSrc prev.vimPlugins.vim-surround inputs.vim-surround);
vim-repeat = (withSrc prev.vimPlugins.vim-repeat inputs.vim-repeat);
comment-nvim = (withSrc prev.vimPlugins.comment-nvim inputs.comment-nvim);
impatient-nvim =
(withSrc prev.vimPlugins.impatient-nvim inputs.impatient-nvim);
nvim-treesitter =
(withSrc prev.vimPlugins.nvim-treesitter inputs.nvim-treesitter);
vim-matchup = (withSrc prev.vimPlugins.vim-matchup inputs.vim-matchup);
telescope-nvim =
(withSrc prev.vimPlugins.telescope-nvim inputs.telescope-nvim);
telescope-project-nvim = (withSrc prev.vimPlugins.telescope-project-nvim
@ -39,11 +36,8 @@ in {
(withSrc prev.vimPlugins.toggleterm-nvim inputs.toggleterm-nvim);
gitsigns-nvim = (withSrc prev.vimPlugins.gitsigns-nvim inputs.gitsigns-nvim);
lualine-nvim = (withSrc prev.vimPlugins.lualine-nvim inputs.lualine-nvim);
nvim-web-devicons =
(withSrc prev.vimPlugins.nvim-web-devicons inputs.nvim-web-devicons);
bufferline-nvim =
(withSrc prev.vimPlugins.bufferline-nvim inputs.bufferline-nvim);
vim-bbye = (withSrc prev.vimPlugins.vim-bbye inputs.vim-bbye);
nvim-tree-lua = (withSrc prev.vimPlugins.nvim-tree-lua inputs.nvim-tree-lua);
# Packaging plugins with Nix

View File

@ -0,0 +1,22 @@
{ pkgs, ... }: {
plugins = [
pkgs.vimPlugins.bufferline-nvim
pkgs.vimPlugins.vim-bbye # Better closing of buffers
];
setup.bufferline = {
options = {
diagnostics = "nvim_lsp";
always_show_bufferline = false;
separator_style = "slant";
offsets = [{ filetype = "NvimTree"; }];
};
};
lua = ''
-- Move buffers
vim.keymap.set("n", "L", ":BufferLineCycleNext<CR>", { silent = true })
vim.keymap.set("n", "H", ":BufferLineCyclePrev<CR>", { silent = true })
-- Kill buffer
vim.keymap.set("n", "<Leader>x", " :Bdelete<CR>", { silent = true })
'';
}

View File

@ -1,6 +1,4 @@
{ pkgs, dsl, ... }:
# with dsl;
{
{ pkgs, lib, ... }: {
plugins = [
pkgs.vimPlugins.vim-surround
pkgs.vimPlugins.vim-eunuch
@ -8,9 +6,38 @@
pkgs.vimPlugins.vim-fugitive
pkgs.vimPlugins.vim-repeat
pkgs.vimPlugins.comment-nvim
pkgs.vimPlugins.impatient-nvim
];
setup.Comment = { };
lua = ''
vim.o.termguicolors = true; # Set to truecolor
vim.o.hidden = true; # Don't unload buffers when leaving them
vim.wo.number = true; # Show line numbers
vim.wo.relativenumber = true; # Relative numbers instead of absolute
vim.o.list = true; # Reveal whitespace with dashes
vim.o.expandtab = true; # Tabs into spaces
vim.o.shiftwidth = 4; # Amount to shift with > key
vim.o.softtabstop = 4; # Amount to shift with <TAB> key
vim.o.ignorecase = true; # Ignore case when searching
vim.o.smartcase = true; # Check case when using capitals in search
vim.o.infercase = true; # Don't match cases when completing suggestions
vim.o.incsearch = true; # Search while typing
vim.o.visualbell = true; # No sounds
vim.o.scrolljump = 1; # Number of lines to scroll
vim.o.scrolloff = 3; # Margin of lines to see while scrolling
vim.o.splitright = true; # Vertical splits on the right side
vim.o.splitbelow = true; # Horizontal splits on the bottom side
vim.o.pastetoggle = "<F3>"; # Use F3 to enter raw paste mode
vim.o.clipboard = "unnamedplus"; # Uses system clipboard for yanking
vim.o.updatetime = 300; # Faster diagnostics
vim.o.mouse = "nv"; # Mouse interaction / scrolling
vim.o.inccommand = "split"; # Live preview search and replace
# Required for nvim-cmp completion
vim.opt.completeopt = [ "menu" "menuone" "noselect" ];
lua = lib.mkBefore ''
require("impatient")
${builtins.readFile ../lua/keybinds.lua};
${builtins.readFile ../lua/settings.lua};
'';

View File

@ -0,0 +1,9 @@
{ pkgs, ... }: {
plugins = [ pkgs.vimPlugins.lualine-nvim ];
setup.lualine = {
options = {
theme = "gruvbox";
icons_enabled = true;
};
};
}

View File

@ -0,0 +1,52 @@
{ pkgs, ... }: {
plugins = [
(pkgs.vimPlugins.nvim-treesitter.withPlugins (plugins:
with pkgs.tree-sitter-grammars; [
tree-sitter-hcl
tree-sitter-python
tree-sitter-lua
tree-sitter-nix
tree-sitter-fish
tree-sitter-toml
tree-sitter-yaml
tree-sitter-json
]))
pkgs.vimPlugins.vim-matchup # Better % jumping in languages
pkgs.vimPlugins.nginx-vim
pkgs.vimPlugins.vim-helm
pkgs.vimPlugins.vim-puppet
];
setup."nvim-treesitter.configs" = {
highlight = { enable = true; };
indent = { enable = true; };
textobjects = {
select = {
enable = true;
lookahead = true; # Jump forward automatically
keymaps = {
"['af']" = "@function.outer";
"['if']" = "@function.inner";
"['ac']" = "@class.outer";
"['ic']" = "@class.inner";
"['al']" = "@loop.outer";
"['il']" = "@loop.inner";
"['aa']" = "@call.outer";
"['ia']" = "@call.inner";
"['ar']" = "@parameter.outer";
"['ir']" = "@parameter.inner";
"['aC']" = "@comment.outer";
"['iC']" = "@comment.outer";
"['a/']" = "@comment.outer";
"['i/']" = "@comment.outer";
"['a;']" = "@statement.outer";
"['i;']" = "@statement.outer";
};
};
};
};
}

View File

@ -0,0 +1,108 @@
{ pkgs, dsl, ... }:
with dsl;
{
plugins = [
pkgs.vimPlugins.telescope-nvim
pkgs.vimPlugins.telescope-project-nvim
pkgs.vimPlugins.telescope-fzy-native-nvim
pkgs.vimPlugins.telescope-file-browser-nvim
pkgs.vimPlugins.telescope-zoxide
];
setup.telescope = {
defaults = {
mappings = {
i = {
"['<esc>']" = rawLua "require('telescope.actions').close";
"['<C-h>']" = "which_key";
};
};
};
pickers = {
find_files = { theme = "ivy"; };
oldfiles = { theme = "ivy"; };
buffers = { theme = "dropdown"; };
};
extensions = {
fzy_native = { };
zoxide = { };
project = { base_dirs = [ "~/dev" ]; };
};
};
lua = ''
local telescope = require("telescope.builtin")
vim.keymap.set("n", "<Leader>k", telescope.keymaps)
vim.keymap.set("n", "<Leader>/", telescope.live_grep)
vim.keymap.set("n", "<Leader>ff", telescope.find_files)
vim.keymap.set("n", "<Leader>fp", telescope.git_files)
vim.keymap.set("n", "<Leader>fw", telescope.grep_string)
vim.keymap.set("n", "<Leader>b", telescope.buffers)
vim.keymap.set("n", "<Leader>hh", telescope.help_tags)
vim.keymap.set("n", "<Leader>fr", telescope.oldfiles)
vim.keymap.set("n", "<Leader>cc", telescope.commands)
vim.keymap.set("n", "<Leader>gc", telescope.git_commits)
vim.keymap.set("n", "<Leader>gf", telescope.git_bcommits)
vim.keymap.set("n", "<Leader>gb", telescope.git_branches)
vim.keymap.set("n", "<Leader>gs", telescope.git_status)
vim.keymap.set("n", "<Leader>s", telescope.current_buffer_fuzzy_find)
vim.keymap.set("n", "<Leader>N", function()
local opts = {
prompt_title = "Search Notes",
cwd = "$NOTES_PATH",
}
telescope.live_grep(opts)
end)
vim.keymap.set("n", "<Leader>fN", function()
local opts = {
prompt_title = "Find Notes",
cwd = "$NOTES_PATH",
}
telescope.find_files(opts)
end)
vim.keymap.set("n", "<Leader>cr", function()
local opts = require("telescope.themes").get_ivy({
layout_config = {
bottom_pane = {
height = 15,
},
},
})
telescope.command_history(opts)
end)
-- zoxide
vim.keymap.set("n", "<Leader>fz", require("telescope").extensions.zoxide.list)
-- project
require("telescope").load_extension("project")
vim.keymap.set("n", "<C-p>", function()
local opts = require("telescope.themes").get_ivy({
layout_config = {
bottom_pane = {
height = 10,
},
},
})
require("telescope").extensions.project.project(opts)
end)
-- file browser
require("telescope").load_extension("file_browser")
vim.keymap.set("n", "<Leader>fa", require("telescope").extensions.file_browser.file_browser)
vim.keymap.set("n", "<Leader>fD", function()
local opts = {
prompt_title = "Find Downloads",
cwd = "~/downloads",
}
require("telescope").extensions.file_browser.file_browser(opts)
end)
'';
}