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