remove current vim config

This commit is contained in:
Charlotte 🦝 Delenk 2022-08-09 15:56:01 +01:00
parent 2034b5667d
commit 7ebb8e948b
Signed by: darkkirb
GPG key ID: AB2BD8DAF2E37122
12 changed files with 1 additions and 269 deletions

View file

@ -1,2 +0,0 @@
vim.api.nvim_set_var("airline_powerline_fonts", 1)
vim.api.nvim_set_var("airline_highlighting_cache", 1)

View file

@ -1,19 +0,0 @@
local o = vim.o
local wo = vim.wo
local bo = vim.bo
local map = vim.api.nvim_set_keymap
o.mouse = "ar"
o.clipboard = "unnamedplus" -- The correct default clipboard
o.cmdheight = 2 -- more space for displaying messages
-- Having longer updatetime (default is 4000ms = 4s) leads to noticeable delays and poor user experience
o.updatetime = 300
-- dont pass messages to |ins-completion-menu|
o.shortmess = o.shortmess .. "c"
wo.number = true
wo.relativenumber = true
bo.tabstop = 2
bo.shiftwidth = 2
bo.expandtab = true

View file

@ -1,41 +0,0 @@
-- nvim-cmp setup
local luasnip = require("luasnip")
local cmp = require("cmp")
cmp.setup {
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end
},
mapping = cmp.mapping.preset.insert({
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<CR>'] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace,
select = true,
},
['<Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end, { 'i', 's' }),
['<S-Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { 'i', 's' }),
}),
sources = {
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
},
}

View file

@ -1,2 +0,0 @@
vim.api.nvim_set_var("ctrlp_map", "<c-p>")
vim.api.nvim_set_var("ctrlp_cmd", "CtrlP")

View file

@ -1,91 +1 @@
{pkgs, ...}: let
dsquotes = "''";
nvim-jdtls = pkgs.stdenvNoCC.mkDerivation rec {
name = "nvim-jdtls.lua";
src = ./nvim-jdtls.lua;
dontUnpack = true;
java = pkgs.openjdk;
jdtLanguageServer = pkgs.jdt-language-server;
buildInputs = [java jdtLanguageServer];
buildPhase = ''
export launcher="$(ls $jdtLanguageServer/share/java/plugins/org.eclipse.equinox.launcher_* | sort -V | tail -n1)"
substituteAll $src nvim-jdtls.lua
'';
installPhase = ''
cp nvim-jdtls.lua $out
'';
};
in {
programs.neovim = {
enable = true;
extraPackages = with pkgs; [
universal-ctags
rust-analyzer
nodejs-16_x
ripgrep
gopls
];
extraConfig = ''
lua require("base")
'';
plugins = with pkgs.vimPlugins; [
{
plugin = nerdtree;
config = "lua dofile(\"${./nerdtree.lua}\")";
}
{
plugin = nerdtree-git-plugin;
config = "lua dofile(\"${./nerdtree-git.lua}\")";
}
vim-devicons
{
plugin = ctrlp-vim;
config = "lua dofile(\"${./ctrlp.lua}\")";
}
vim-nix
{
plugin = tagbar;
config = "lua dofile(\"${./tagbar.lua}\")";
}
{
plugin = vim-airline;
config = "lua dofile(\"${./airline.lua}\")";
}
copilot-vim
rust-vim # for proper syntax highlighting
luasnip
cmp-nvim-lsp
cmp_luasnip
{
plugin = nvim-cmp;
config = "lua dofile(\"${./cmp.lua}\")";
}
{
plugin = nvim-lspconfig;
config = "lua dofile(\"${./lsp.lua}\")";
}
vim-gitgutter
nvim-web-devicons
{
plugin = bufferline-nvim;
config = "lua require(\"bufferline\").setup{}";
}
plenary-nvim
telescope-ui-select-nvim
{
plugin = telescope-nvim;
config = "lua dofile(\"${./telescope.lua}\")";
}
{
plugin = rust-tools-nvim;
config = "lua dofile(\"${./rust-tools.lua}\")";
}
{
plugin = nvim-jdtls;
config = "lua dofile(\"${nvim-jdtls}\")";
}
nvim-dap
];
};
xdg.configFile."nvim/lua/base.lua".source = ./base.lua;
}
_: {}

View file

@ -1,55 +0,0 @@
-- Grab capabilties
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities)
-- Mappings.
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
local opts = { noremap=true, silent=true }
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts)
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts)
-- Use an on_attach function to only map the following keys
-- after the language server attaches to the current buffer
local on_attach = function(client, bufnr)
-- Enable completion triggered by <c-x><c-o>
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
-- Mappings.
-- See `:help vim.lsp.*` for documentation on any of the below functions
local bufopts = { noremap=true, silent=true, buffer=bufnr }
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts)
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts)
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, bufopts)
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, bufopts)
vim.keymap.set('n', '<space>wl', function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end, bufopts)
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, bufopts)
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts)
vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts)
vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
vim.keymap.set('n', '<space>f', vim.lsp.buf.formatting, bufopts)
end
-- Use a loop to conveniently call 'setup' on multiple servers and
-- map buffer local keybindings when the language server attaches
require('lspconfig')[lsp].setup {
on_attach = on_attach,
settings = {
["rust-analyzer"] = {
checkOnSave = {
allTargets = false,
command = "clippy",
},
procMacro = {
enable = true
}
}
},
capabilities = capabilities
}

View file

@ -1 +0,0 @@
vim.api.nvim_set_var("NERDTreeGitStatusUseNerdFonts", 1)

View file

@ -1,12 +0,0 @@
-- Automatically open NERDTree and move to the previous window
vim.api.nvim_create_autocmd("VimEnter", {
command = "NERDTree | wincmd p"
})
-- Close vim when NERDTree is the only window left
vim.api.nvim_create_autocmd("BufEnter", {
command = "if winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif"
})
-- Ban replacing NERDTree
vim.api.nvim_create_autocmd("BufEnter", {
command = "if bufname('#') =~ 'NERD_tree_\\d\\+' && bufname('%') !~ 'NERD_tree_\\d\\+' && winnr('$') > 1 | let buf=bufnr() | buffer# | execute \"normal! \\<C-W>w\" | execute 'buffer'.buf | endif"
})

View file

@ -1,36 +0,0 @@
vim.api.nvim_create_autocmd({"FileType"}, {
pattern = {"java"},
callback = function()
local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ':p:h:t')
local workspace_dir = '@userhome@/.cache/jdtls/' .. project_name
local config = {
cmd = {
'@java@',
'-Declipse.application=org.eclipse.jdt.ls.core.id1',
'-Dosgi.bundles.defaultStartLevel=4',
'-Declipse.product=org.eclipse.jdt.ls.core.product',
'-Dlog.protocol=true',
'-Dlog.level=ALL',
'-Xms1g',
'--add-modules=ALL-SYSTEM',
'--add-opens', 'java.base/java.util=ALL-UNNAMED',
'--add-opens', 'java.base/java.lang=ALL-UNNAMED',
'-jar', '@launcher@',
'-configuration', '@jdtLanguageServer@/share/config',
'-data', workspace_dir,
}
root_dir = require('jdtls.setup').find_root({'.git', 'mvnw', 'gradlew'}),
settings = {
java = {
}
},
init_options = {
bundles = {}
},
};
require('jdtls').start_or_attach(config)
end
})

View file

@ -1 +0,0 @@
require('rust-tools').setup({})

View file

@ -1 +0,0 @@
map('n', "<F8>", ":TagbarToggle<CR>")

View file

@ -1,8 +0,0 @@
require("telescope").setup {
["ui-select"] = {
require("telescope.themes").get_dropdown {
}
}
}
require("telescope").load_extension("ui-select")