aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCody Hiar <cody@hiar.ca>2022-05-20 15:59:29 -0600
committerCody Hiar <cody@hiar.ca>2022-05-20 15:59:29 -0600
commitd134dd7d77ad55442bf9b5e4b62361e9fcf3e198 (patch)
treefe6feda2436ba8070fcf4a42e6c4006a175d273b
parent51b82b425a68ee9a4e396e0e4a1af6c6c747b05d (diff)
Getting this puppy cooking again
-rw-r--r--init.lua50
1 files changed, 36 insertions, 14 deletions
diff --git a/init.lua b/init.lua
index fd6640f..59efa86 100644
--- a/init.lua
+++ b/init.lua
@@ -51,6 +51,10 @@ vim.o.splitright = true
vim.o.splitbelow = true
-- set spelling language
vim.o.spelllang = "en_ca"
+-- Allow hidden buffers, no complain about saved work when switching
+vim.o.hidden = true
+-- Ask confirm on exit instead of error
+vim.o.confirm = true
local highlights = {
"Search ctermfg=166",
@@ -84,11 +88,6 @@ vim.cmd [[
command! MakeTagsPython !ctags --exclude=venv --exclude=.venv --languages=python --python-kinds=-i -R .
]]
--- When using tab, enter will accept the current selection and close the window
--- instead of inserting a newline
-vim.cmd [[
-inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<CR>"
-]]
-- Keymaps
--noh gets rid of highlighted search results
@@ -125,6 +124,7 @@ vim.api.nvim_set_keymap('n', '<c-w><c-f>', '<c-w>f<c-w>T', { noremap = true })
vim.api.nvim_set_keymap('n', '<c-w><c-]>', '<c-w>v<c-]><c-w>T', { noremap = true })
vim.api.nvim_set_keymap('n', '<c-w><c-t>', '<c-w>v<c-w>T', { noremap = true })
vim.api.nvim_set_keymap('n', '<c-w><c-w>', '<cmd>w<cr>', { noremap = true })
+vim.api.nvim_set_keymap('n', '<c-w><c-a>', '<cmd>wa<cr>', { noremap = true })
vim.api.nvim_set_keymap('n', '<leader>ee', '<cmd>e!<cr>', { noremap = true })
vim.api.nvim_set_keymap('n', '<expr> k', [[(v:count > 1 ? "m'" . v:count : '') . 'k']], { noremap = true })
vim.api.nvim_set_keymap('n', '<expr> j', [[(v:count > 1 ? "m'" . v:count : '') . 'j']], { noremap = true })
@@ -242,7 +242,7 @@ return require('packer').startup(function()
-- 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 = { 'pyright', 'bashls' }
+ 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)
@@ -266,7 +266,7 @@ return require('packer').startup(function()
['<C-n>'] = cmp.mapping.select_next_item(),
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
- ['<C-Space>'] = cmp.mapping.complete(),
+ ['<C-k>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.close(),
['<CR>'] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace,
@@ -294,6 +294,7 @@ return require('packer').startup(function()
end,
}
use 'nvim-treesitter/playground'
+ use 'nvim-lua/completion-nvim'
use 'tpope/vim-commentary'
use 'tpope/vim-surround'
use 'tpope/vim-repeat'
@@ -316,13 +317,27 @@ return require('packer').startup(function()
end
}
use {
- 'tpope/vim-fugitive',
+ '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>gs', '<cmd>Git<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 })
end
}
@@ -376,11 +391,16 @@ return require('packer').startup(function()
sh = { "shellcheck", },
python = { "flake8" },
dockerfile = { "hadolint" },
+ terraform = { "terraform_ls" },
}
vim.g.ale_fixers = {
sh = { "shfmt", },
python = { "isort", "black" },
+ terraform = { "terraform" },
}
+ vim.cmd([[
+ autocmd BufRead *.py :ALEFix
+ ]])
end
}
use 'junegunn/goyo.vim'
@@ -392,19 +412,21 @@ return require('packer').startup(function()
}
use 'hashivim/vim-terraform'
use {
- 'jremmen/vim-ripgrep',
+ 'mileszs/ack.vim',
config = function()
vim.cmd([[
- nnoremap <leader>/ :call RgSearch()<CR><c-w><c-p>
- noremap <leader>ea :Rg <cword><CR><c-w><c-p>
- function! RgSearch()
+ nnoremap <leader>/ :call AckSearch()<CR><c-w><c-p>
+ function! AckSearch()
call inputsave()
let term = input('Search: ')
call inputrestore()
if !empty(term)
- execute "Rg " . 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
}