aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md8
-rw-r--r--flake.lock19
-rw-r--r--flake.nix73
-rw-r--r--init.lua548
4 files changed, 321 insertions, 327 deletions
diff --git a/README.md b/README.md
index 349a53b..9c57ef6 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,11 @@
# Neovim Setup
Run with `nix run git+https://git.codyhiar.com/config/nvim`
+
+Don't have nix installed? Try with docker:
+
+```
+docker run -ti -v $(pwd):/src nixos/nix
+cd /src
+nix run --extra-experimental-features "nix-command flakes" git+https://git.codyhiar.com/config/nvim
+```
diff --git a/flake.lock b/flake.lock
index c00c3dd..cb3c5ec 100644
--- a/flake.lock
+++ b/flake.lock
@@ -17,7 +17,24 @@
},
"root": {
"inputs": {
- "nixpkgs": "nixpkgs"
+ "nixpkgs": "nixpkgs",
+ "vim-angry-reviewer": "vim-angry-reviewer"
+ }
+ },
+ "vim-angry-reviewer": {
+ "flake": false,
+ "locked": {
+ "lastModified": 1643181068,
+ "narHash": "sha256-06V+aAnL2ER5yP26VQWVRP0yB4SpB28RX4K38bm52y4=",
+ "owner": "anufrievroman",
+ "repo": "vim-angry-reviewer",
+ "rev": "9bf1179c71b8137a2d4845d4dfe477b08ac5b85b",
+ "type": "github"
+ },
+ "original": {
+ "owner": "anufrievroman",
+ "repo": "vim-angry-reviewer",
+ "type": "github"
}
}
},
diff --git a/flake.nix b/flake.nix
index af59dc8..7b0aae7 100644
--- a/flake.nix
+++ b/flake.nix
@@ -3,9 +3,13 @@
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
+ vim-angry-reviewer = {
+ url = "github:anufrievroman/vim-angry-reviewer";
+ flake = false;
+ };
};
- outputs = { self, nixpkgs }:
+ outputs = { self, nixpkgs, ... }@inputs:
let
system = "x86_64-linux";
pkgs = import nixpkgs {
@@ -20,10 +24,9 @@
};
in rec {
# For nix < 2.7
- # For nix >= 2.7 they should grab from:
+ # For nix >= 2.7 they should grab automatically from:
# apps.${system}.default
# packages.${system}.default
- # automatically
defaultApp.${system} = apps.${system}.default;
defaultPackage.${system} = packages.${system}.default;
@@ -34,15 +37,73 @@
};
default = nvim;
};
- packages.${system} = with pkgs; rec {
+ # Read the init.lua from the repo.
+ initfile = pkgs.lib.readFile ./init.lua;
+ packages.${system} = with pkgs; let
+ # Vim angry reviewer wasn't packaged when I build this. Easy enough to
+ # package myself.
+ vim-angry-reviewer = vimUtils.buildVimPluginFrom2Nix {
+ pname = "vim-angry-reviewer";
+ version = "HEAD";
+ src = inputs.vim-angry-reviewer;
+ };
+ # My custom neovim with my init file and all the plugins I use.
+ myneovim = (neovim.override {
+ configure = {
+ customRC = ''
+ lua << EOF
+ ${initfile}
+ EOF
+ '';
+ packages.myPlugins = with vimPlugins; {
+ start = [
+ # Colorscheme
+ nord-nvim
+
+ # Syntax coloring
+ nvim-ts-rainbow
+ (nvim-treesitter.withPlugins (plugins: tree-sitter.allGrammars))
+
+ # Autocompletes
+ nvim-lspconfig
+ nvim-cmp
+ cmp-nvim-lsp
+ completion-nvim
+
+ # File navigation
+ lf-vim
+ vim-floaterm
+
+ # The rest
+ vim-commentary
+ vim-surround
+ vim-repeat
+ fzf-vim
+ vim-argwrap
+ vim-fugitive
+ indent-blankline-nvim
+ camelcasemotion
+ hop-nvim
+ ale
+ goyo-vim
+ vim-oscyank
+ ack-vim
+ vim-angry-reviewer
+ ];
+ };
+ };
+ });
+ in
+ rec {
default = neovimCH;
neovimCH = symlinkJoin {
name = "neovim";
- paths = [ pkgs.neovim ];
+ paths = [ myneovim ];
buildInputs = [ pkgs.makeWrapper ];
postBuild = with pkgs; ''
rm $out/bin/nvim
BINPATH=${lib.makeBinPath [
+ gcc
nodejs
mypython
pyright
@@ -52,7 +113,7 @@
shellcheck
hadolint
]}
- makeWrapper ${neovim}/bin/nvim $out/bin/nvim --prefix PATH : $BINPATH
+ makeWrapper ${myneovim}/bin/nvim $out/bin/nvim --prefix PATH : $BINPATH
'';
};
};
diff --git a/init.lua b/init.lua
index e62906e..f3a8e9c 100644
--- a/init.lua
+++ b/init.lua
@@ -1,5 +1,5 @@
-- Managed by Nix
--- To install everything run `:PackerSync`
+--
-- https://dev.to/voyeg3r/writing-useful-lua-functions-to-my-neovim-14ki
-- function to remove whitespace and preserve spot on save
@@ -11,13 +11,6 @@ function _G.preserve(cmd)
end
vim.cmd([[autocmd BufWritePre,FileWritePre,FileAppendPre,FilterWritePre * :lua preserve('%s/\\s\\+$//ge')]])
--- Bootstrap packer if not installed
-local fn = vim.fn
-local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
-if fn.empty(fn.glob(install_path)) > 0 then
- fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
- vim.cmd 'packadd packer.nvim'
-end
-- Debug function for printing lua tables
function _G.print_table(mytable)
@@ -56,24 +49,22 @@ vim.o.hidden = true
-- Ask confirm on exit instead of error
vim.o.confirm = true
-local highlights = {
- "Search ctermfg=166",
- "DiffAdd cterm=BOLD ctermfg=NONE ctermbg=22",
- "DiffDelete cterm=BOLD ctermfg=NONE ctermbg=52",
- "DiffChange cterm=BOLD ctermfg=NONE ctermbg=23",
- "DiffText cterm=BOLD ctermfg=NONE ctermbg=23",
- "Normal guibg=NONE ctermbg=NONE",
- "Search ctermbg=None ctermfg=166",
- "PrimaryBlock ctermfg=06 ctermbg=NONE",
- "SecondaryBlock ctermfg=06 ctermbg=NONE",
- "Blanks ctermfg=07 ctermbg=NONE",
- "ColorColumn ctermbg=cyan",
- "IndentBlanklineIndent1 ctermbg=234 ctermfg=NONE",
- "IndentBlanklineIndent2 ctermbg=235 ctermfg=NONE",
-}
-for i, highlight in ipairs(highlights) do
- vim.cmd('au VimEnter * hi ' .. highlight)
-end
+-- My Highlights
+vim.cmd [[
+au VimEnter * hi Search ctermfg=166
+au VimEnter * hi DiffAdd cterm=BOLD ctermfg=NONE ctermbg=22
+au VimEnter * hi DiffDelete cterm=BOLD ctermfg=NONE ctermbg=52
+au VimEnter * hi DiffChange cterm=BOLD ctermfg=NONE ctermbg=23
+au VimEnter * hi DiffText cterm=BOLD ctermfg=NONE ctermbg=23
+au VimEnter * hi Normal guibg=NONE ctermbg=NONE
+au VimEnter * hi Search ctermbg=None ctermfg=166
+au VimEnter * hi PrimaryBlock ctermfg=06 ctermbg=NONE
+au VimEnter * hi SecondaryBlock ctermfg=06 ctermbg=NONE
+au VimEnter * hi Blanks ctermfg=07 ctermbg=NONE
+au VimEnter * hi ColorColumn ctermbg=cyan
+au VimEnter * hi IndentBlanklineIndent1 ctermbg=234 ctermfg=NONE
+au VimEnter * hi IndentBlanklineIndent2 ctermbg=235 ctermfg=NONE
+]]
-- Along with the highlight definition for ColorColumn above, these options
-- will set colored marks at certain line lengths
@@ -148,301 +139,218 @@ local status_line = {
}
vim.o.statusline = table.concat(status_line)
--- Packer package manage
-return require('packer').startup(function()
- use {
- 'wbthomason/packer.nvim',
- config = function()
- vim.api.nvim_set_keymap('n', '<leader>ps', '<cmd>source ~/.config/nvim/init.lua<cr><cmd>PackerSync<cr>', { noremap = true })
- end
- }
- use {
- 'arcticicestudio/nord-vim',
- config = function()
- vim.cmd [[
- colorscheme nord
- ]]
- end
- }
- use 'p00f/nvim-ts-rainbow'
- use {
- 'nvim-treesitter/nvim-treesitter',
- run = ':TSUpdate',
- config = function()
- require('nvim-treesitter.configs').setup {
- ensure_installed = {
- "python",
- "lua",
- "nix",
- "json",
- "bash",
- "html",
- "toml",
- },
- highlight = {
- enable = true,
- },
- indent = {
- enable = true,
- },
- rainbow = {
- enable = true,
- -- I use termcolors but this errors if left blank
- colors = {
- "#000000",
- "#000000",
- "#000000",
- "#000000",
- },
- termcolors = {
- 'darkblue',
- 'magenta',
- 'yellow',
- 'darkcyan',
- }
- }
- }
- end,
- }
- use {
- "neovim/nvim-lspconfig",
- requires = {
- {'hrsh7th/nvim-cmp'},
- {'hrsh7th/cmp-nvim-lsp'},
- },
- config = function()
- nvim_lsp = require('lspconfig')
- -- 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)
- local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
- local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
- -- Enable completion triggered by <c-x><c-o>
- buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
- -- Mappings.
- local opts = { noremap=true, silent=true }
- -- See `:help vim.lsp.*` for documentation on any of the below functions
- buf_set_keymap('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts)
- buf_set_keymap('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts)
- buf_set_keymap('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts)
- buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
- buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
- buf_set_keymap('n', '<spnce>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
- buf_set_keymap('n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
- buf_set_keymap('n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
- buf_set_keymap('n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
- buf_set_keymap('n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
- buf_set_keymap('n', '<space>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
- buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
- buf_set_keymap('n', '<space>e', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>', opts)
- buf_set_keymap('n', '[d', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts)
- buf_set_keymap('n', ']d', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts)
- buf_set_keymap('n', '<space>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts)
- buf_set_keymap('n', '<space>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts)
- end
+-- Options for all my plugins. Plugins are already installed via nix.
- -- Use a loop to conveniently call 'setup' on multiple servers and
- -- map buffer local keybindings when the language server attaches
- -- local servers = { 'pyls', 'rust_analyzer', 'tsserver' }
- local servers = { 'jedi_language_server', 'bashls', 'terraformls' }
- -- Add additional capabilities supported by nvim-cmp
- local capabilities = vim.lsp.protocol.make_client_capabilities()
- capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities)
- -- Setup language servers
- for _, lsp in ipairs(servers) do
- nvim_lsp[lsp].setup {
- on_attach = on_attach,
- flags = {
- debounce_text_changes = 150,
- },
- capabilities = capabilities,
- }
- end
- -- Set completeopt to have a better completion experience
- vim.o.completeopt = 'menuone,noselect'
- -- nvim-cmp setup
- local cmp = require 'cmp'
- cmp.setup {
- mapping = {
- ['<C-p>'] = cmp.mapping.select_prev_item(),
- ['<C-n>'] = cmp.mapping.select_next_item(),
- ['<C-d>'] = cmp.mapping.scroll_docs(-4),
- ['<C-f>'] = cmp.mapping.scroll_docs(4),
- ['<C-k>'] = cmp.mapping.complete(),
- ['<C-e>'] = cmp.mapping.close(),
- ['<CR>'] = cmp.mapping.confirm {
- behavior = cmp.ConfirmBehavior.Replace,
- select = true,
- },
- ['<Tab>'] = function(fallback)
- if cmp.visible() then
- cmp.select_next_item()
- else
- fallback()
- end
- end,
- ['<S-Tab>'] = function(fallback)
- if cmp.visible() then
- cmp.select_prev_item()
- else
- fallback()
- end
- end,
- },
- sources = {
- { name = 'nvim_lsp' },
- },
- }
- end,
- }
- use 'nvim-treesitter/playground'
- use 'nvim-lua/completion-nvim'
- use 'tpope/vim-commentary'
- use 'tpope/vim-surround'
- use 'tpope/vim-repeat'
- use {
- 'junegunn/fzf.vim',
- requires = { {'junegunn/fzf'} },
- config = function()
- vim.api.nvim_set_keymap('n', '<leader>ff', "<cmd>Files<cr>", { noremap = true })
- vim.api.nvim_set_keymap('n', '<leader>fb', "<cmd>Buffers<cr>", { noremap = true })
- vim.api.nvim_set_keymap('n', '<leader>ft', "<cmd>Tags<cr>", { noremap = true })
- vim.api.nvim_set_keymap('n', '<leader>fm', "<cmd>Marks<cr>", { noremap = true })
- vim.api.nvim_set_keymap('n', '<leader>fg', "<cmd>GF?<cr>", { noremap = true })
- vim.cmd([[let $FZF_DEFAULT_COMMAND = 'find . -type f -not -path "*/\.git/*" -not -path "*/\.mypy_cache/*" -not -path "*/\.venv/*" -not -path "*/\node_modules/*" ']])
- end,
- }
- use {
- 'FooSoft/vim-argwrap',
- config = function()
- vim.api.nvim_set_keymap('n', '<leader>ew', '<cmd>ArgWrap<cr>', { noremap = true })
- end
- }
- use {
- 'Thornycrackers-Forks/vim-fugitive',
- config = function()
- vim.api.nvim_set_keymap('n', '<leader>du', '<cmd>diffupdate<cr>', { noremap = true })
- vim.api.nvim_set_keymap('n', '<leader>dd', '<cmd>diffget<cr>', { noremap = true })
- vim.api.nvim_set_keymap('n', '<leader>df', '<cmd>diffput<cr>', { noremap = true })
- vim.api.nvim_set_keymap('n', '<leader>dc', ']c', { noremap = true })
- vim.api.nvim_set_keymap('n', '<leader>de', '[c', { noremap = true })
- -- vim.api.nvim_set_keymap('n', '<leader>gs', '<cmd>Git<cr>', { noremap = true })
- vim.cmd([[
- function! ToggleGStatus()
- if buflisted(bufname('.git/index'))
- bd .git/index
- else
- G
- res 15
- endif
- endfunction
- nnoremap <leader>gs :call ToggleGStatus()<CR>
- ]])
- vim.api.nvim_set_keymap('n', '<leader>gb', '<cmd>Git blame<cr>', { noremap = true })
- vim.api.nvim_set_keymap('n', '<leader>gd', '<cmd>Gdiffsplit<cr>', { noremap = true })
+-- nord-vim
+vim.cmd [[
+colorscheme nord
+]]
- end
- }
- use {
- 'lukas-reineke/indent-blankline.nvim',
- config = function()
- require("indent_blankline").setup {
- char = " ",
- char_highlight_list = {
- "IndentBlanklineIndent1",
- "IndentBlanklineIndent2",
- },
- show_trailing_blankline_indent = false,
- }
- end,
- }
- use {
- 'francoiscabrol/ranger.vim',
- -- bclose gets rid of "[Process exited 0]" annoyance
- requires = { {'rbgrouleff/bclose.vim'} },
- }
- use {
- 'ptzz/lf.vim',
- -- Adds a floating window
- requires = { {'voldikss/vim-floaterm'} },
- config = function()
- vim.g.floaterm_opener = "edit"
- vim.g.floaterm_width = 0.99
- vim.g.floaterm_height = 0.99
- -- vim.g.lf_replace_netrw = 1;
- vim.api.nvim_set_keymap('n', '<leader>m', '<cmd>Lf<cr>', { noremap = true });
- vim.api.nvim_set_keymap('n', '<leader>n', '<cmd>LfWorkingDirectory<cr>', { noremap = true});
- end
- }
- use 'bkad/CamelCaseMotion'
- use {
- 'phaazon/hop.nvim',
- as = 'hop',
- config = function()
- -- you can configure Hop the way you like here; see :h hop-config
- vim.api.nvim_set_keymap('', '<leader>s', '<cmd>HopChar2<cr>', { noremap = true })
- require'hop'.setup { keys = 'etovxqpdygfblzhckisuran' }
- end
- }
- -- The treesitter for nix doesn't do indents
- use 'LnL7/vim-nix'
- use {
- 'dense-analysis/ale',
- config = function()
- -- vim.g.ale_set_quickfix = 1
- -- vim.g.ale_open_list = 1
- vim.g.ale_lint_on_save = 1
- vim.g.ale_linters = {
- sh = { "shellcheck", },
- python = { "flake8" },
- dockerfile = { "hadolint" },
- terraform = { "terraform_ls" },
- markdown = { "vale" },
- }
- vim.g.ale_fixers = {
- sh = { "shfmt", },
- python = { "isort", "black" },
- terraform = { "terraform" },
- }
- vim.cmd([[
- autocmd BufRead *.py :ALEFix
- ]])
- end
- }
- use 'junegunn/goyo.vim'
- use {
- 'ojroques/vim-oscyank',
- config = function()
- vim.api.nvim_set_keymap('n', '<leader>y', '<cmd>OSCYankReg 0<cr>', { noremap = true })
- end
- }
- use 'hashivim/vim-terraform'
- use {
- 'anufrievroman/vim-angry-reviewer',
- config = function()
- vim.g.AngryReviewerEnglish = 'american'
- vim.cmd([[
- autocmd BufWrite *.md :AngryReviewer
- ]])
- end
+-- nvim-ts-rainbow
+-- nvim-treesitter
+require('nvim-treesitter.configs').setup {
+ highlight = {
+ enable = true,
+ },
+ indent = {
+ enable = true,
+ },
+ rainbow = {
+ enable = true,
+ -- I use termcolors but this errors if left blank
+ colors = {
+ "#000000",
+ "#000000",
+ "#000000",
+ "#000000",
+ },
+ termcolors = {
+ 'darkblue',
+ 'magenta',
+ 'yellow',
+ 'darkcyan',
+ }
}
- use {
- 'mileszs/ack.vim',
- config = function()
- vim.cmd([[
- nnoremap <leader>/ :call AckSearch()<CR><c-w><c-p>
- function! AckSearch()
- call inputsave()
- let term = input('Search: ')
- call inputrestore()
- if !empty(term)
- execute "Ack! " . term
- endif
- endfunction
- " Setting better default settings
- let g:ackprg =
- \ "ack -s -H --nocolor --nogroup --column --ignore-dir=.venv/ --ignore-dir=.vimcache/ --ignore-dir=migrations/ --ignore-dir=.mypy_cache/ --ignore-file=is:tags --nojs --nocss --nosass"
- ]])
- end
+}
+
+-- nvim-lspconfig
+-- nvim-cmp
+-- cmp-nvim-lsp
+nvim_lsp = require('lspconfig')
+-- 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)
+ local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
+ local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
+ -- Enable completion triggered by <c-x><c-o>
+ buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
+ -- Mappings.
+ local opts = { noremap=true, silent=true }
+ -- See `:help vim.lsp.*` for documentation on any of the below functions
+ buf_set_keymap('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts)
+ buf_set_keymap('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts)
+ buf_set_keymap('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts)
+ buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
+ buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
+ buf_set_keymap('n', '<spnce>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
+ buf_set_keymap('n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
+ buf_set_keymap('n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
+ buf_set_keymap('n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
+ buf_set_keymap('n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
+ buf_set_keymap('n', '<space>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
+ buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
+ buf_set_keymap('n', '<space>e', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>', opts)
+ buf_set_keymap('n', '[d', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts)
+ buf_set_keymap('n', ']d', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts)
+ buf_set_keymap('n', '<space>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts)
+ buf_set_keymap('n', '<space>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts)
+end
+-- Use a loop to conveniently call 'setup' on multiple servers and
+-- map buffer local keybindings when the language server attaches
+-- local servers = { 'pyls', 'rust_analyzer', 'tsserver' }
+local servers = { 'jedi_language_server', 'bashls', 'terraformls' }
+-- Add additional capabilities supported by nvim-cmp
+local capabilities = vim.lsp.protocol.make_client_capabilities()
+capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities)
+-- Setup language servers
+for _, lsp in ipairs(servers) do
+ nvim_lsp[lsp].setup {
+ on_attach = on_attach,
+ flags = {
+ debounce_text_changes = 150,
+ },
+ capabilities = capabilities,
}
-end)
+end
+-- Set completeopt to have a better completion experience
+vim.o.completeopt = 'menuone,noselect'
+-- nvim-cmp setup
+local cmp = require 'cmp'
+cmp.setup {
+ mapping = {
+ ['<C-p>'] = cmp.mapping.select_prev_item(),
+ ['<C-n>'] = cmp.mapping.select_next_item(),
+ ['<C-d>'] = cmp.mapping.scroll_docs(-4),
+ ['<C-f>'] = cmp.mapping.scroll_docs(4),
+ ['<C-k>'] = cmp.mapping.complete(),
+ ['<C-e>'] = cmp.mapping.close(),
+ ['<CR>'] = cmp.mapping.confirm {
+ behavior = cmp.ConfirmBehavior.Replace,
+ select = true,
+ },
+ ['<Tab>'] = function(fallback)
+ if cmp.visible() then
+ cmp.select_next_item()
+ else
+ fallback()
+ end
+ end,
+ ['<S-Tab>'] = function(fallback)
+ if cmp.visible() then
+ cmp.select_prev_item()
+ else
+ fallback()
+ end
+ end,
+ },
+ sources = {
+ { name = 'nvim_lsp' },
+ },
+}
+
+-- nvim-fzf
+vim.api.nvim_set_keymap('n', '<leader>ff', "<cmd>Files<cr>", { noremap = true })
+vim.api.nvim_set_keymap('n', '<leader>fb', "<cmd>Buffers<cr>", { noremap = true })
+vim.api.nvim_set_keymap('n', '<leader>ft', "<cmd>Tags<cr>", { noremap = true })
+vim.api.nvim_set_keymap('n', '<leader>fm', "<cmd>Marks<cr>", { noremap = true })
+vim.api.nvim_set_keymap('n', '<leader>fg', "<cmd>GF?<cr>", { noremap = true })
+vim.cmd([[let $FZF_DEFAULT_COMMAND = 'find . -type f -not -path "*/\.git/*" -not -path "*/\.mypy_cache/*" -not -path "*/\.venv/*" -not -path "*/\node_modules/*" ']])
+
+-- vim-argwrap
+vim.api.nvim_set_keymap('n', '<leader>ew', '<cmd>ArgWrap<cr>', { noremap = true })
+
+-- vim-fugitive
+vim.api.nvim_set_keymap('n', '<leader>du', '<cmd>diffupdate<cr>', { noremap = true })
+vim.api.nvim_set_keymap('n', '<leader>dd', '<cmd>diffget<cr>', { noremap = true })
+vim.api.nvim_set_keymap('n', '<leader>df', '<cmd>diffput<cr>', { noremap = true })
+vim.api.nvim_set_keymap('n', '<leader>dc', ']c', { noremap = true })
+vim.api.nvim_set_keymap('n', '<leader>de', '[c', { noremap = true })
+vim.api.nvim_set_keymap('n', '<leader>gs', '<cmd>Git<cr>', { noremap = true })
+vim.cmd([[
+ function! ToggleGStatus()
+ if buflisted(bufname('.git/index'))
+ bd .git/index
+ else
+ G
+ res 15
+ endif
+ endfunction
+ nnoremap <leader>gs :call ToggleGStatus()<CR>
+]])
+vim.api.nvim_set_keymap('n', '<leader>gb', '<cmd>Git blame<cr>', { noremap = true })
+vim.api.nvim_set_keymap('n', '<leader>gd', '<cmd>Gdiffsplit<cr>', { noremap = true })
+
+-- indent-blankline-nvim
+require("indent_blankline").setup {
+ char = " ",
+ char_highlight_list = {
+ "IndentBlanklineIndent1",
+ "IndentBlanklineIndent2",
+ },
+ show_trailing_blankline_indent = false,
+}
+
+-- lf-vim
+-- vim-floaterm
+vim.g.floaterm_opener = "edit"
+vim.g.floaterm_width = 0.99
+vim.g.floaterm_height = 0.99
+vim.api.nvim_set_keymap('n', '<leader>m', '<cmd>Lf<cr>', { noremap = true });
+vim.api.nvim_set_keymap('n', '<leader>n', '<cmd>LfWorkingDirectory<cr>', { noremap = true});
+
+--hop-nvim
+vim.api.nvim_set_keymap('', '<leader>s', '<cmd>HopChar2<cr>', { noremap = true })
+require'hop'.setup { keys = 'etovxqpdygfblzhckisuran' }
+
+-- ale
+vim.g.ale_lint_on_save = 1
+vim.g.ale_linters = {
+ sh = { "shellcheck", },
+ python = { "flake8" },
+ dockerfile = { "hadolint" },
+ terraform = { "terraform_ls" },
+ markdown = { "vale" },
+}
+vim.g.ale_fixers = {
+ sh = { "shfmt", },
+ python = { "isort", "black" },
+ terraform = { "terraform" },
+}
+vim.cmd([[
+ autocmd BufRead *.py :ALEFix
+]])
+
+-- osc-yank
+vim.api.nvim_set_keymap('n', '<leader>y', '<cmd>OSCYankReg 0<cr>', { noremap = true })
+
+-- vim-angry-reviewer
+vim.g.AngryReviewerEnglish = 'american'
+vim.cmd([[
+ autocmd BufWrite *.md :AngryReviewer
+]])
+
+-- ack.vim
+vim.cmd([[
+ nnoremap <leader>/ :call AckSearch()<CR><c-w><c-p>
+ function! AckSearch()
+ call inputsave()
+ let term = input('Search: ')
+ call inputrestore()
+ if !empty(term)
+ execute "Ack! " . term
+ endif
+ endfunction
+ " Setting better default settings
+ let g:ackprg =
+ \ "ack -s -H --nocolor --nogroup --column --ignore-dir=.venv/ --ignore-dir=.vimcache/ --ignore-dir=migrations/ --ignore-dir=.mypy_cache/ --ignore-file=is:tags --nojs --nocss --nosass"
+]])