From 99c3efc1910184a436769e9a09bccb4c924d7d4c Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Tue, 20 Jun 2023 19:28:14 -0500 Subject: [PATCH] Moved to more Nix neovim config --- darwin/default.nix | 10 +- flake.lock | 188 ++++++++++++++++++++++++++++++++- flake.nix | 41 +++++--- home/home.nix | 2 + home/init.lua | 242 ------------------------------------------- home/vim.nix | 130 +++++++++++++++++++---- home/vim/extra.lua | 44 ++++++++ home/vim/extra.vimrc | 33 ++++++ home/vim/init.lua | 88 ++++++++++++++++ home/{ => vim}/vimrc | 0 10 files changed, 494 insertions(+), 284 deletions(-) delete mode 100644 home/init.lua create mode 100644 home/vim/extra.lua create mode 100644 home/vim/extra.vimrc create mode 100644 home/vim/init.lua rename home/{ => vim}/vimrc (100%) diff --git a/darwin/default.nix b/darwin/default.nix index 88b5962..2124885 100644 --- a/darwin/default.nix +++ b/darwin/default.nix @@ -1,27 +1,27 @@ -{ agenix, darwin, nixstable, nixunstable, overlays, hm, flake-utils, ... }: +{ inputs, overlays, ... }: let mac = { system ? "aarch64-darwin", name, - channel ? nixunstable, + channel ? inputs.nixunstable, extraMods ? [] }: let nixpkgs = import channel { inherit system overlays; }; - in darwin.lib.darwinSystem { + in inputs.darwin.lib.darwinSystem { inherit system; specialArgs = { inherit nixpkgs; }; modules = [ { nixpkgs.overlays = overlays; } - agenix.nixosModules.default - hm.darwinModules.home-manager + inputs.hm.darwinModules.home-manager { home-manager = { useGlobalPkgs = true; users."gregory.hellings" = import ../home/home.nix; extraSpecialArgs = { + inherit inputs; gnome = false; gui = true; home = "/Users/gregory.hellings"; diff --git a/flake.lock b/flake.lock index 1f4bad2..df5caac 100644 --- a/flake.lock +++ b/flake.lock @@ -82,6 +82,22 @@ } }, "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1650374568, + "narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "b4a34015c698c7793d592d66adbab377907a2be8", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_2": { "flake": false, "locked": { "lastModified": 1673956053, @@ -130,6 +146,24 @@ "type": "github" } }, + "flake-utils_3": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1685518550, + "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "hm": { "inputs": { "nixpkgs": [ @@ -172,6 +206,92 @@ "type": "github" } }, + "home-manager_2": { + "inputs": { + "nixpkgs": [ + "nixneovim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1687081547, + "narHash": "sha256-/JV70TxhvP2r4xYtTlbQ2rrRDcj7MqHnF13r5ZE0oFc=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "28c823032cabfaa340a09e1d84cf45d11375c644", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "nix-flake-tests": { + "locked": { + "lastModified": 1677844186, + "narHash": "sha256-ErJZ/Gs1rxh561CJeWP5bohA2IcTq1rDneu1WT6CVII=", + "owner": "antifuchs", + "repo": "nix-flake-tests", + "rev": "bbd9216bd0f6495bb961a8eb8392b7ef55c67afb", + "type": "github" + }, + "original": { + "owner": "antifuchs", + "repo": "nix-flake-tests", + "type": "github" + } + }, + "nixneovim": { + "inputs": { + "flake-utils": "flake-utils_2", + "home-manager": "home-manager_2", + "nix-flake-tests": "nix-flake-tests", + "nixneovimplugins": "nixneovimplugins", + "nixpkgs": "nixpkgs_3", + "nmd": "nmd", + "nmt": "nmt" + }, + "locked": { + "lastModified": 1687097946, + "narHash": "sha256-G0NcZlgFXXpDcjJcUzNsfEKoB2XGQucYfnV1S/gWKiY=", + "owner": "NixNeovim", + "repo": "NixNeovim", + "rev": "479fa83a868c0b3d34bd20688a7fe4d956b98563", + "type": "github" + }, + "original": { + "owner": "NixNeovim", + "repo": "NixNeovim", + "type": "github" + } + }, + "nixneovimplugins": { + "inputs": { + "flake-compat": "flake-compat", + "flake-utils": [ + "nixneovim", + "flake-utils" + ], + "nixpkgs": [ + "nixneovim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1687097822, + "narHash": "sha256-2zWuuT6VROxbnpoPpoXVQB3bGpIowBXM0uxg9ZtfHxo=", + "owner": "nixneovim", + "repo": "nixneovimplugins", + "rev": "a57cef180723b7538828149ba0155189499884f1", + "type": "github" + }, + "original": { + "owner": "nixneovim", + "repo": "nixneovimplugins", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1677676435, @@ -204,6 +324,22 @@ "type": "github" } }, + "nixpkgs_3": { + "locked": { + "lastModified": 1686960236, + "narHash": "sha256-AYCC9rXNLpUWzD9hm+askOfpliLEC9kwAo7ITJc4HIw=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "04af42f3b31dba0ef742d254456dc4c14eedac86", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "nixstable": { "locked": { "lastModified": 1685094109, @@ -236,6 +372,38 @@ "type": "github" } }, + "nmd": { + "flake": false, + "locked": { + "lastModified": 1683614069, + "narHash": "sha256-iq5HgZyr5oStuu6sj5xQkYiBRfFvyyfPBYDKwjklPcY=", + "owner": "~rycee", + "repo": "nmd", + "rev": "07a6db31ae19d728ef1e4dc02b9687a6c359c216", + "type": "sourcehut" + }, + "original": { + "owner": "~rycee", + "repo": "nmd", + "type": "sourcehut" + } + }, + "nmt": { + "flake": false, + "locked": { + "lastModified": 1683843030, + "narHash": "sha256-2K9tFpypgSORyUTRAL7MFRKCXU4GykmhIDrrIydtPdI=", + "owner": "jooooscha", + "repo": "nmt", + "rev": "f30b96093eb056f1bcc60199545344b4e4a72c5a", + "type": "github" + }, + "original": { + "owner": "jooooscha", + "repo": "nmt", + "type": "github" + } + }, "nurpkgs": { "locked": { "lastModified": 1687203925, @@ -258,6 +426,7 @@ "ffmac": "ffmac", "flake-utils": "flake-utils", "hm": "hm", + "nixneovim": "nixneovim", "nixstable": "nixstable", "nixunstable": "nixunstable", "nurpkgs": "nurpkgs", @@ -279,10 +448,25 @@ "type": "github" } }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "wsl": { "inputs": { - "flake-compat": "flake-compat", - "flake-utils": "flake-utils_2", + "flake-compat": "flake-compat_2", + "flake-utils": "flake-utils_3", "nixpkgs": [ "nixunstable" ] diff --git a/flake.nix b/flake.nix index a8d3a32..3af30dc 100644 --- a/flake.nix +++ b/flake.nix @@ -5,27 +5,41 @@ description = "Greg's machines!"; inputs = { - nixstable.url = "github:nixos/nixpkgs/nixos-23.05"; - nixunstable.url = "github:nixos/nixpkgs/nixos-unstable"; agenix.url = "github:ryantm/agenix"; + darwin = { + url = "github:lnl7/nix-darwin/master"; + inputs.nixpkgs.follows = "nixunstable"; + }; + ffmac.url = "github:bandithedoge/nixpkgs-firefox-darwin"; flake-utils.url = "github:numtide/flake-utils"; hm = { url = "github:nix-community/home-manager/release-23.05"; inputs.nixpkgs.follows = "nixstable"; }; - darwin = { - url = "github:lnl7/nix-darwin/master"; - inputs.nixpkgs.follows = "nixunstable"; - }; + nixneovim.url = "github:NixNeovim/NixNeovim"; + nixstable.url = "github:nixos/nixpkgs/nixos-23.05"; + nixunstable.url = "github:nixos/nixpkgs/nixos-unstable"; + nurpkgs.url = "github:nix-community/NUR"; wsl = { url = "github:nix-community/NixOS-WSL"; inputs.nixpkgs.follows = "nixunstable"; }; - nurpkgs.url = "github:nix-community/NUR"; - ffmac.url = "github:bandithedoge/nixpkgs-firefox-darwin"; }; - outputs = {nixstable, nixunstable, agenix, hm, nurpkgs, self, wsl, flake-utils, darwin, ...}@inputs: + outputs = { + agenix, + darwin, + ffmac, + flake-utils, + hm, + nixneovim, + nixstable, + nixunstable, + nurpkgs, + wsl, + + self, + ...}@inputs: let pkg-sets = ( final: prev: { @@ -37,20 +51,21 @@ agenix.overlays.default pkg-sets local_overlay + nixneovim.overlays.default nurpkgs.overlay - inputs.ffmac.overlay + ffmac.overlay ]; in { - nixosConfigurations = (import ./hosts { inherit nixstable nixunstable overlays wsl agenix; }); + nixosConfigurations = (import ./hosts { inherit inputs overlays; }); - darwinConfigurations = (import ./darwin { inherit agenix darwin nixstable nixunstable overlays hm flake-utils; }); + darwinConfigurations = (import ./darwin { inherit inputs overlays; }); defaultPackage = flake-utils.lib.eachDefaultSystemMap (system: inputs.self.homeConfigurations.gui."${system}".activationPackage); homeConfigurations = ( import ./home { - inherit nixunstable agenix hm overlays flake-utils; + inherit inputs overlays; nixpkgs = nixunstable; } ); diff --git a/home/home.nix b/home/home.nix index 8bf0e4d..e4f1561 100644 --- a/home/home.nix +++ b/home/home.nix @@ -1,8 +1,10 @@ { pkgs, lib, gui, gnome, + inputs, ...}: { imports = [ + inputs.nixneovim.nixosModules.default ./modules ./ansible.nix ./bash.nix diff --git a/home/init.lua b/home/init.lua deleted file mode 100644 index a5477aa..0000000 --- a/home/init.lua +++ /dev/null @@ -1,242 +0,0 @@ --- Core vim settings -vim.opt.background="dark" -vim.opt.copyindent=true -vim.opt.expandtab=false -vim.opt.hidden=true -vim.opt.ignorecase=true -vim.opt.mouse="a" -vim.opt.number=true -vim.opt.relativenumber=true -vim.opt.shiftwidth=4 -vim.opt.smartcase=true -vim.opt.tabstop=4 -vim.opt.preserveindent=true -vim.opt.softtabstop=0 -vim.opt.wrap=false -vim.opt.showcmd=true -vim.opt.cursorline=true -vim.opt.lazyredraw=true -vim.opt.showmatch=true -vim.opt.hlsearch=true -vim.opt.backup=false -vim.opt.writebackup=false -vim.opt.signcolumn="yes" -vim.opt.listchars="tab:→ ,extends:→,precedes:←,trail:·,eol:¬" -vim.opt.list=true - --- dunno about these? --- syntax enable -- on by default in neovim -vim.cmd [[colorscheme gruvbox]] - --- ====================================================================== --- --- nvim-cmp configuration --- --- ====================================================================== ---local cmp = require'cmp' - ---cmp.setup({ - --snippet = { - --expand = function(args) - --vim.fn["vsnip#anonymous"](args.body) - --end, - --}, - --window = { - ---- completion = cmp.config.window.bordered(), - ---- documentation = cmp.config.window.bordered(), - --}, - --mapping = cmp.mapping.preset.insert({ - --[''] = cmp.mapping.scroll_docs(-4), - --[''] = cmp.mapping.scroll_docs(4), - --[''] = cmp.mapping.complete(), - --[''] = cmp.mapping.abort(), - --[''] = cmp.mapping.confirm({ select = true }), - --}), - --sources = cmp.config.sources({ - --{ name = 'nvim_lspconfig' }, - --{ name = 'vsnip' }, - --},{ - --{ name = 'buffer' } - --}) ---}) --- ---cmp.setup.filetype('gitcommit', { - --sources = cmp.config.sources({ - --{ name = 'git' } - --},{ - --{ name = 'buffer' } - --}) ---}) --- ---cmp.setup.cmdline({ '/', '?' }, { - --mapping = cmp.mapping.preset.cmdline(), - --sources = { { name = 'buffer' } } ---}) --- ---cmp.setup.cmdline(':', { - --mapping = cmp.mapping.preset.cmdline(), - --sources = cmp.config.sources({ - --{ name = 'path' } - --},{ - --{ name = 'cmdline' } - --}) ---}) --- ---local capabilities = require('cmp_nvim_lsp').default_capabilities() ---local lspconfig = require('lspconfig') ----- Add each LSP that you have configured here -----require('lspconfig')[''].setup { ----- capabilities = capabilities -----} -----lspconfig.pyright.setup { capabilities = capabilities } ---lspconfig.ansiblels.setup { capabilities = capabilities } ---lspconfig.jedi_language_server.setup { capabilities = capabilities } - --- ====================================================================== --- --- automatic commands --- --- ====================================================================== -local api = vim.api - --- Highlights bad whitespace ---api.nvim_create_autocmd("ColorScheme", { command = "highlight ExtraWhitespace ctermbg=red guibg=red" }) ---api.nvim_create_autocmd("BufWinEnter", { command = "match ExtraWhitespace /\s\+$/" }) ---api.nvim_create_autocmd("InsertEnter", { command = "match ExtraWhitespace /\s\+\%#\@ \be --- imap \be -vim.keymap.set(all, "", "\\be") --- map :NERDTreeToggle -vim.keymap.set(all, "", ":NERDTreeToggle") --- Which file list to pop up --- silent !git rev-parse --is-inside-work-tree --- if v:shell_error == 0 --- map :GFiles --cached --others --exclude-standard --- map :GFiles? ---else --- map :Files ---endif -if api.nvim_command_output("!git rev-parse --is-inside-work-tree") == true then - vim.keymap.set(all, "", ":GFiles --cached --others --exclude-standard") - vim.keymap.set(all, "", ":GFiles?") -else - vim.keymap.set(all, "", ":Files") -end --- map :Files -vim.keymap.set(all, "", ":Files") - --- Allows navigating splits --- map j --- map k --- map h --- map l -vim.keymap.set(all, "", "j") -vim.keymap.set(all, "", "k") -vim.keymap.set(all, "", "h") -vim.keymap.set(all, "", "l") - --- ============================================================================ --- User functions to just make life easier --- ============================================================================ --- Creates the directory for a file if it doesn't already exist. -bufWritePres = vim.cmd [[ - function! s:MkNonExDir(file, buf) - if empty(getbufvar(a:buf, '&buftype')) && a:file!~#'\v^\w+\:\/' - let dir=fnamemodify(a:file, ':h') - if !isdirectory(dir) - call mkdir(dir, 'p') - endif - endif - endfunction - augroup BWCCreateDir - autocmd! - autocmd BufWritePre * :call s:MkNonExDir(expand(''), +expand('')) - augroup END -]] - --- Return indent (all whitespace at start of a line), converted from --- tabs to spaces if what = 1, or from spaces to tabs otherwise. --- When converting to tabs, result has no redundant spaces. -vim.cmd [[ -function! Indenting(indent, what, cols) - let spccol = repeat(' ', a:cols) - let result = substitute(a:indent, spccol, '\t', 'g') - let result = substitute(result, ' \+\ze\t', ''', 'g') - if a:what == 1 - let result = substitute(result, '\t', spccol, 'g') - endif - return result -endfunction -]] - ---Convert whitespace used for indenting (before first non-whitespace). ---what = 0 (convert spaces to tabs), or 1 (convert tabs to spaces). ---cols = string with number of columns per tab, or empty to use 'tabstop'. ---The cursor position is restored, but the cursor will be in a different ---column when the number of characters in the indent of the line is changed. -vim.cmd [[ -function! IndentConvert(line1, line2, what, cols) - let savepos = getpos('.') - let cols = empty(a:cols) ? &tabstop : a:cols - execute a:line1 . ',' . a:line2 . 's/^\s\+/\=Indenting(submatch(0), a:what, cols)/e' - call histdel('search', -1) - call setpos('.', savepos) -endfunction -command! -nargs=? -range=% Space2Tab call IndentConvert(,,0,) -command! -nargs=? -range=% Tab2Space call IndentConvert(,,1,) -command! -nargs=? -range=% RetabIndent call IndentConvert(,,&et,) -]] diff --git a/home/vim.nix b/home/vim.nix index 60a7e50..1546038 100644 --- a/home/vim.nix +++ b/home/vim.nix @@ -27,39 +27,125 @@ in pyright ]; - programs.neovim = { + #programs.neovim = { + # enable = true; + # viAlias = true; + # vimAlias = true; + # vimdiffAlias = true; + # plugins = with pkgs.vimPlugins; [ + # ansible-vim + # bufexplorer +# +# #cmp-nvim-lsp +# #cmp-vsnip +# #nvim-lspconfig +# nvim-cmp +# +# jedi-vim +# +# context-vim +# direnv-vim +# fzf-vim +# nerdtree +# nvim-notify +# vim-airline +# vim-gitgutter +# vim-flake8 +# vim-fugitive +# vim-indent-guides +# vim-packer +# vim-rooter +# vim-xonsh +# gruvbox +# ]; +# extraLuaConfig = builtins.readFile ./init.lua; +# coc = { +# # Currently waiting on resolution of https://github.com/NixOS/nixpkgs/issues/236560 +# enable = false; +# }; +# }; + programs.nixneovim = { enable = true; - viAlias = true; - vimAlias = true; - vimdiffAlias = true; - plugins = with pkgs.vimPlugins; [ - ansible-vim + colorscheme = "gruvbox"; + globals = { + indent_guides_enable_on_vim_startup = 1; + nix_recommended_style = 0; + NERDTreeIgnore = [ + "\\.pyc$" + "\\.pyo$" + "\\.o$" + "\\.class$" + ]; + }; + options = { + background = "dark"; + backup = false; + copyindent = true; + cursorline = true; + expandtab = false; + hidden = true; + hlsearch = true; + ignorecase = true; + lazyredraw = true; + list = true; + listchars = "tab:→ ,extends:→,precedes:←,trail:·,eol:¬"; + mouse = "a"; + number = true; + preserveindent = true; + relativenumber = true; + shiftwidth = 4; + showcmd = true; + showmatch = true; + signcolumn = "yes"; + smartcase = true; + softtabstop = 4; + tabstop = 4; + # Setting for CtrlP + wildignore = "*.swp,*.pyc,*.class,.tox"; + wrap = false; + writebackup = false; + }; + mappings = { + normalVisualOp = { + "" = ''":BufExplorer"''; + "" = ''":NERDTreeToggle"''; + "" = ''":Files"''; + "" = ''"j"''; + "" = ''"k"''; + "" = ''"h"''; + "" = ''"l"''; + }; + }; + plugins = { + airline.enable = true; + gitgutter.enable = true; + gruvbox.enable = true; + fugitive.enable = true; + notify.enable = true; + packer = { + enable = true; + plugins = [ + ]; + }; + }; + extraConfigLua = builtins.readFile ./vim/extra.lua; + extraConfigVim = builtins.readFile ./vim/extra.vimrc; + extraPlugins = with pkgs.vimPlugins; [ bufexplorer + nerdtree + nvim-cmp - #cmp-nvim-lsp - #cmp-vsnip - #nvim-lspconfig - #nvim-cmp + jedi-vim context-vim direnv-vim fzf-vim - nerdtree - nvim-notify - vim-airline - vim-gitgutter vim-flake8 - vim-fugitive vim-indent-guides - vim-packer vim-rooter vim-xonsh - gruvbox ]; - #extraConfig = builtins.readFile ./vimrc; - extraLuaConfig = builtins.readFile ./init.lua; - coc = { - enable = true; - }; + viAlias = true; + vimAlias = true; }; } diff --git a/home/vim/extra.lua b/home/vim/extra.lua new file mode 100644 index 0000000..7aac317 --- /dev/null +++ b/home/vim/extra.lua @@ -0,0 +1,44 @@ +-- ====================================================================== +-- +-- automatic commands +-- +-- ====================================================================== +local api = vim.api +local all = {"n", "v", "i"} + +-- Highlights bad whitespace +--api.nvim_create_autocmd("ColorScheme", { command = "highlight ExtraWhitespace ctermbg=red guibg=red" }) +--api.nvim_create_autocmd("BufWinEnter", { command = "match ExtraWhitespace /\s\+$/" }) +--api.nvim_create_autocmd("InsertEnter", { command = "match ExtraWhitespace /\s\+\%#\@", ":GFiles --cached --others --exclude-standard") + vim.keymap.set(all, "", ":GFiles?") +else + vim.keymap.set(all, "", ":Files") +end diff --git a/home/vim/extra.vimrc b/home/vim/extra.vimrc new file mode 100644 index 0000000..2390437 --- /dev/null +++ b/home/vim/extra.vimrc @@ -0,0 +1,33 @@ +function! s:MkNonExDir(file, buf) + if empty(getbufvar(a:buf, '&buftype')) && a:file!~#'\v^\w+\:\/' + let dir=fnamemodify(a:file, ':h') + if !isdirectory(dir) + call mkdir(dir, 'p') + endif + endif +endfunction +augroup BWCCreateDir + autocmd! + autocmd BufWritePre * :call s:MkNonExDir(expand(''), +expand('')) +augroup END + +function! Indenting(indent, what, cols) + let spccol = repeat(' ', a:cols) + let result = substitute(a:indent, spccol, '\t', 'g') + let result = substitute(result, ' \+\ze\t', ''', 'g') + if a:what == 1 + let result = substitute(result, '\t', spccol, 'g') + endif + return result +endfunction + +function! IndentConvert(line1, line2, what, cols) + let savepos = getpos('.') + let cols = empty(a:cols) ? &tabstop : a:cols + execute a:line1 . ',' . a:line2 . 's/^\s\+/\=Indenting(submatch(0), a:what, cols)/e' + call histdel('search', -1) + call setpos('.', savepos) +endfunction +command! -nargs=? -range=% Space2Tab call IndentConvert(,,0,) +command! -nargs=? -range=% Tab2Space call IndentConvert(,,1,) +command! -nargs=? -range=% RetabIndent call IndentConvert(,,&et,) diff --git a/home/vim/init.lua b/home/vim/init.lua new file mode 100644 index 0000000..0031df6 --- /dev/null +++ b/home/vim/init.lua @@ -0,0 +1,88 @@ +-- ====================================================================== +-- +-- nvim-cmp configuration +-- +-- ====================================================================== +local cmp = require'cmp' + +cmp.setup({ + snippet = { + expand = function(args) + vim.fn["vsnip#anonymous"](args.body) + end, + }, + window = { + -- completion = cmp.config.window.bordered(), + -- documentation = cmp.config.window.bordered(), + }, + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.abort(), + [''] = cmp.mapping.confirm({ select = true }), + }), + sources = cmp.config.sources({ + { name = 'nvim_lspconfig' }, + { name = 'vsnip' }, + },{ + { name = 'buffer' } + }) +}) + +cmp.setup.filetype('gitcommit', { + sources = cmp.config.sources({ + { name = 'git' } + },{ + { name = 'buffer' } + }) +}) + +cmp.setup.cmdline({ '/', '?' }, { + mapping = cmp.mapping.preset.cmdline(), + sources = { { name = 'buffer' } } +}) + +cmp.setup.cmdline(':', { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { name = 'path' } + },{ + { name = 'cmdline' } + }) +}) + +local capabilities = require('cmp_nvim_lsp').default_capabilities() +local lspconfig = require('lspconfig') +-- Add each LSP that you have configured here +--require('lspconfig')[''].setup { +-- capabilities = capabilities +--} +--lspconfig.pyright.setup { capabilities = capabilities } +lspconfig.ansiblels.setup { capabilities = capabilities } +--lspconfig.jedi_language_server.setup { capabilities } + +-- ====================================================================== +-- +-- Plugin configurations +-- +-- ====================================================================== +-- Set filetype to the way I want it +-- Settings for CtrlP +vim.opt.wildignore="*.swp,*.pyc,*.class,.tox" +-- Settings for NerdTree +vim.g.NERDTreeIgnore = {'\\.pyc$', '\\.o$', '\\.class$'} +-- indent guides +vim.g.indent_guides_enable_on_vim_startup = 1 +-- Tell syntastic to use yamllint +vim.g.syntastic_yaml_checkers = {'yamllint'} +vim.g.syntastic_yaml_yamllint_args = {} +vim.g.syntastic_shell = "${pkgs.bash}/bin/bash" +-- Shortcuts for resolving git diff conflicts +vim.g.diffget_local_map = "gl" +vim.g.diffget_upstream_map = "gu" + + +-- ============================================================================ +-- User functions to just make life easier +-- ============================================================================ diff --git a/home/vimrc b/home/vim/vimrc similarity index 100% rename from home/vimrc rename to home/vim/vimrc