formatting, async gpush, mru for kitaab, luasnip, F4 to insert hour

This commit is contained in:
Anish L 2022-03-17 00:37:08 +10:00
parent df5ff60f57
commit 779a0243d6

View file

@ -10,6 +10,15 @@ let
sha256 = "1fzKmknfVlEYwqeXgbKITbb2/PJ023iJyMz6vak3qh4=";
};
};
lsp-format = pkgs.vimUtils.buildVimPlugin {
name = "lsp-format";
src = pkgs.fetchFromGitHub {
owner = "lukas-reineke";
repo = "lsp-format.nvim";
rev = "84e117b99bb2bc0d0c8122e2b256046f046f8aff";
sha256 = "rs3NTZwWdsmBGXnrgUeVxUiNjbN/ULxJHifPYJD9mT4=";
};
};
};
my-python-packages = python-packages: with python-packages; [
@ -20,6 +29,7 @@ let
pylsp-mypy
python-lsp-black
pylint
black
# other python packages you want
];
python-with-my-packages = pkgs.python3.withPackages my-python-packages;
@ -27,8 +37,8 @@ in
{
environment.variables.EDITOR = "nvim";
environment.shellAliases = {
k = "vim -c :VimwikiIndex";
kz = "vim -c :VimwikiIndex -c :ZettelNew";
k = "cd ~/vimwiki; vim -c :VimwikiIndex";
kz = "cd ~/vimwiki; vim -c :VimwikiIndex -c :ZettelNew";
};
environment.systemPackages = with pkgs // customPlugins; [
nodejs
@ -68,10 +78,9 @@ in
nvim-gps
nvim-treesitter
nvim-treesitter-context
cmp-treesitter
dashboard-nvim
FTerm-nvim
barbar-nvim
barbar-nvim
# kitaab stuff
vimwiki
@ -83,6 +92,7 @@ in
nvim-lspconfig
nvim-cmp
cmp-nvim-lsp
cmp-treesitter
nvim-lsp-ts-utils
cmp-conjure
cmp-buffer
@ -91,6 +101,9 @@ in
cmp-path
cmp-spell
nvim-autopairs
cmp_luasnip
luasnip
lsp-format
# git stuff
vim-fugitive
@ -175,8 +188,9 @@ in
:nnoremap <A-j> <leader>j
:nnoremap <A-k> <leader>k
:nnoremap <A-l> <leader>l
:nnoremap <F5> "=strftime("%Y-%m-%d %H:%M:")
:inoremap <F5> <C-R>=strftime("%Y-%m-%d %H:%M:")
:nnoremap <F5> "=strftime("%Y-%m-%d %H:%M")<CR>
:inoremap <F5> <C-R>=strftime("%Y-%m-%d %H:%M")<CR>
:inoremap <F4> <C-R>=strftime("%H:%M")<CR>
" telescope
" Find files using Telescope command-line sugar.
@ -229,11 +243,11 @@ in
:vmap <leader>sy "*y
:map <leader>sp :r!xclip -o<CR>
" barbar
nnoremap <silet> gT :BufferPrevious<CR>
nnoremap <silet> gt :BufferNext<CR>
nnoremap <silet> gj :BufferPick<CR>
nnoremap <silet> gc :BufferClose<CR>
" barbar
nnoremap <silent> gT :BufferPrevious<CR>
nnoremap <silent> gt :BufferNext<CR>
nnoremap <silent> gj :BufferPick<CR>
nnoremap <silent> gc :BufferClose<CR>
" git
nnoremap <leader>ga :G fetch --all
@ -241,12 +255,13 @@ in
nmap <leader>gh :diffget //3
nmap <leader>gl :diffget //2
nmap <leader>gc :GBranches<CR>
nnoremap <leader>gp :G push<CR>
nnoremap <leader>gp :Git! push<CR>
" kitaab
map <leader>zs :ZettelSearch<CR>
map <leader>zo :ZettelOpen<CR>
map <leader>zn :ZettelNew<CR>
map <leader>zf :Telescope oldfiles only_cwd=true<CR>
let g:mapleader="\<Space>"
let g:dashboard_default_executive = 'telescope'
@ -265,15 +280,16 @@ in
" lsp commands
nnoremap <leader>vd :lua vim.lsp.buf.definition()<CR>
nnoremap <leader>vi :lua vim.lsp.buf.implementation()<CR>
nnoremap <leader>vi :lua require('telescope.builtin').lsp_implementation()<CR>
nnoremap <leader>vsh :lua vim.lsp.buf.signature_help()<CR>
nnoremap <leader>vrr :lua vim.lsp.buf.references()<CR>
nnoremap <leader>vrr :lua require('telescope.builtin').lsp_references()<CR>
nnoremap <leader>vrn :lua vim.lsp.buf.rename()<CR>
nnoremap <leader>vh :lua vim.lsp.buf.hover()<CR>
nnoremap <leader>vca :lua vim.lsp.buf.code_action()<CR>
nnoremap <leader>vsd :lua vim.lsp.diagnostic.show_line_diagnostics(); vim.lsp.util.show_line_diagnostics()<CR>
nnoremap <leader>vn :lua vim.lsp.diagnostic.goto_next()<CR>
nnoremap <leader>vll :call LspLocationList()<CR>
nnoremap <leader>va :lua require('telescope.builtin').lsp_code_actions(require('telescope.themes').get_cursor())<cr>
" lua config
lua <<EOF
@ -281,6 +297,12 @@ in
require('nvim-autopairs').setup{}
-- Setup nvim-cmp.
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 luasnip = require("luasnip")
local cmp = require('cmp')
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
local t = function(str)
@ -321,18 +343,24 @@ cmp.setup {
select = true
}),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
else
fallback()
end
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end, {"i", "s"}),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
else
fallback()
end
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
},
sources = {
@ -348,12 +376,14 @@ cmp.event:on( 'confirm_done', cmp_autopairs.on_confirm_done({ map_char = { tex
local tabnine = require('cmp_tabnine.config')
tabnine:setup({max_lines = 1000, max_num_results = 20, sort = true})
-- Setup lspconfig.
-- Setup lspconfig
require("lsp-format").setup {}
local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
require('lspconfig').clojure_lsp.setup {}
require('lspconfig').rnix.setup {}
require('lspconfig').pylsp.setup {}
require('lspconfig').terraform_lsp.setup {}
require('lspconfig').clojure_lsp.setup {on_attach = require "lsp-format".on_attach}
require('lspconfig').rnix.setup {on_attach = require "lsp-format".on_attach}
require('lspconfig').pylsp.setup {on_attach = require "lsp-format".on_attach}
require('lspconfig').terraform_lsp.setup {on_attach = require "lsp-format".on_attach}
require('gitsigns').setup { sign_priority=80 }