neovim reconfiguration

and configuring st
This commit is contained in:
ISnortPennies 2022-09-21 20:05:23 -04:00
parent b4ea6ab031
commit 532ae0d63e
14 changed files with 783 additions and 118 deletions

View file

@ -0,0 +1,72 @@
-- settings
-- keybind modifier
vim.g.mapleader = "'"
vim.opt.updatetime = 300
vim.opt.incsearch = true
-- backups bad
vim.opt.swapfile = false
vim.opt.backup = false
vim.opt.writebackup = false
--formatting
vim.opt.expandtab = true
vim.opt.shiftwidth = 2
vim.opt.tabstop = 2
-- pretty numbers
vim.opt.signcolumn = "yes:2"
vim.opt.number = true
vim.opt.relativenumber = true
-- mouse
vim.opt.mouse = "a"
-- no wrapping bs
vim.wo.wrap = false
-- dark background
vim.opt.background = "dark"
vim.opt.termguicolors = true
-- hide bottom bar for lightling
vim.g.noshowmode = true
-- stop hiding double quotes in json files
vim.g.indentLine_setConceal = 0
-- plugin setups
-- file expolorer
vim.g.loaded = 1
vim.g.loaded_netrwPlugin = 1
require("nvim-tree").setup {
open_on_setup = true,
sort_by = "case_sensitive",
actions = {
open_file = {
quit_on_open = true,
},
},
}
require("nvim-web-devicons").setup()
-- language support
require("nvim-treesitter.configs").setup {
ensure_installed = "",
sync_install = false,
auto_install = false,
highlight = {
enable = true,
additional_vim_regex_highlighting = false
},
rainbow = {
enable = true,
extended_mode = true,
max_file_lines = nil,
},
}
-- shapes and colors
vim.cmd[[colorscheme moonfly]]
-- pretty colors
require"colorizer".setup()
require("telescope").load_extension("fzy_native")
require("gitsigns").setup()
require("nvim-autopairs").setup()
-- telescope keybinds
vim.keymap.set( "n", "<Leader>s", "<cmd>Telescope find_files<cr>")
-- show tree
vim.keymap.set("n", "<Leader>t", ":NvimTreeToggle<CR>")
-- lightnline load colorscheme
vim.g.lightline = { colorscheme = "moonfly" }

View file

@ -0,0 +1,24 @@
local lspc = require'lspconfig'
local buf_map = function(bufnr, mode, lhs, rhs, opts)
vim.api.nvim_buf_set_keymap(bufnr, mode, lhs, rhs, opts or {
silent = true,
})
end
lspc.tsserver.setup({
on_attach = function(client, bufnr)
client.resolved_capabilities.document_formatting = false
client.resolved_capabilities.document_range_formatting = false
local ts_utils = require("nvim-lsp-ts-utils")
ts_utils.setup({})
ts_utils.setup_client(client)
buf_map(bufnr, "n", "gs", ":TSLspOrganize<CR>")
buf_map(bufnr, "n", "gi", ":TSLspRenameFile<CR>")
buf_map(bufnr, "n", "go", ":TSLspImportAll<CR>")
on_attach(client, bufnr)
end,
})

View file

@ -0,0 +1,72 @@
local has_words_before = function()
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end
local feedkey = function(key, mode)
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(key, true, true, true), mode, true)
end
local cmp = require("cmp")
local lspkind = require("lspkind")
cmp.setup({
sources = {
{ name = "nvim_lsp" },
{ name = "cmp_tabnine" },
{ name = "treesitter" },
{ name = "buffer" },
{ name = "path" },
{ name = "vsnip" },
},
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 = "[Lua]",
latex_symbols = "[Latex]",
treesitter = "[TS]",
cmp_tabnine = "[TN]",
vsnip = "[Snip]",
},
}),
},
mapping = {
["<CR>"] = cmp.mapping.confirm({ select = true }),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif vim.fn["vsnip#available"](1) == 1 then
feedkey("<Plug>(vsnip-expand-or-jump)", "")
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end, {
"i",
"s",
}),
["<S-Tab>"] = cmp.mapping(function()
if cmp.visible() then
cmp.select_prev_item()
elseif vim.fn["vsnip#jumpable"](-1) == 1 then
feedkey("<Plug>(vsnip-jump-prev)", "")
end
end, {
"i",
"s",
}),
},
})

View file

@ -0,0 +1,51 @@
{pkgs, ... }:
let
luaRequire = module:
builtins.readFile (builtins.toString
./config
+ "/${module}.lua");
luaConfig = builtins.concatStringsSep "\n" (map luaRequire [
"init"
"lspconfig"
"nvim-cmp"
]);
in
{
programs.neovim = {
enable = true;
viAlias = true;
vimAlias = true;
vimdiffAlias = true;
luaInit = true;
extraPackages = with pkgs; [gcc ripgrep fd];
plugins = with pkgs.vimPlugins; [
(nvim-treesitter.withPlugins (plugins: pkgs.tree-sitter.allGrammars)) #syntax highlighting
rainbow nvim-ts-rainbow # rainbow for tree-sitter
nvim-colorizer-lua # colors
nvim-tree-lua # file browser
nvim-web-devicons # for tree-lua
vim-smoothie #smooth scrolling
undotree # better undotree
indentLine # indentlines
vim-smoothie #smooth scrolling
#non-trash auto completion
nvim-cmp
cmp-buffer
cmp-nvim-lsp
cmp-path
cmp-spell
cmp-treesitter
cmp-vsnip
vim-vsnip
lspkind-nvim
nvim-lspconfig
nvim-autopairs # auto brackets
telescope-nvim #search feature
telescope-fzy-native-nvim # search plugin
gitsigns-nvim #in buffer git blame
vim-moonfly #color scheme
lightline-vim #bottom bar
];
extraConfig = luaConfig;
};
}