summaryrefslogtreecommitdiff
path: root/.config/nvim/init.lua
blob: 6915a68348730973822c2a93acd9d3b489571ea4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
vim.cmd([[
	set nu
	set smarttab
	set tabstop=4
	set shiftwidth=4
	set noexpandtab
	set autoindent
	filetype plugin indent on

	colorscheme vim
	set notermguicolors

	set splitbelow splitright

	let g:tex_flavor='latex'

	" Insert mode hjkl
	inoremap <C-h> <left>
	inoremap <C-j> <down>
	inoremap <C-k> <up>
	inoremap <C-l> <right>

	nnoremap <space> :

	nnoremap <leader>o o<esc>
	nnoremap <leader>O O<esc>

	nnoremap <leader>t :NvimTreeOpen<enter>

	nnoremap <tab> <esc>/<++><enter>vf>da

	" Some C Macros
	autocmd Filetype c inoremap im<tab> int<space>main()<enter>{<enter><enter>return<space>0;<enter>}<up><up><tab>
	autocmd Filetype c inoremap i<tab> #include<space><><left>
	autocmd Filetype c inoremap w<tab> while()<space>{<enter>}<esc>ke2li
	autocmd Filetype c inoremap f<tab> for(;;)<space>{<enter>}<esc>ke2li
	autocmd Filetype c inoremap s<tab> switch()<space>{<enter>}<esc>ke2li

	" LaTex Macros
	autocmd Filetype tex inoremap up<tab> \usepackage{}<left>
	autocmd Filetype tex inoremap equ<tab> \begin{equation*}<enter><enter>\end{equation*}<enter><++><up><up><tab>
	autocmd Filetype tex inoremap ig<tab> \includegraphics{}<left>
	autocmd Filetype tex inoremap b<tab> \begin{}<enter>\end{}<enter><++><esc>2kf{a
	autocmd Filetype tex inoremap e<tab> <esc>0f{lvf}hyj0f{pO
	autocmd Filetype tex inoremap s<tab> \section{}<left>
	autocmd Filetype tex inoremap ss<tab> \subsection{}<left>
	autocmd Filetype tex inoremap sss<tab> \subsubsection{}<left>
	autocmd Filetype tex inoremap tf<tab> {}<esc>yy4pki\titleformat<right>
	autocmd Filetype tex inoremap fr<tab> \frac{}{<++>}<esc>6hi
]])

vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1

local function bootstrap_pckr()
	local pckr_path = vim.fn.stdpath("data") .. "/pckr/pckr.nvim"

	if not (vim.uv or vim.loop).fs_stat(pckr_path) then
		vim.fn.system({
			"git",
			"clone",
			"--filter=blob:none",
			"https://github.com/lewis6991/pckr.nvim",
			pckr_path
		})
	end

	vim.opt.rtp:prepend(pckr_path)
end

bootstrap_pckr()

require("pckr").add{
	{
		"christoomey/vim-tmux-navigator",
		cmd = {
			"TmuxNavigateLeft",
			"TmuxNavigateDown",
			"TmuxNavigateUp",
			"TmuxNavigateRight",
			"TmuxNavigatePrevious",
		},
		keys = {
			{ "<c-h>", "<cmd><C-U>TmuxNavigateLeft<cr>" },
			{ "<c-j>", "<cmd><C-U>TmuxNavigateDown<cr>" },
			{ "<c-k>", "<cmd><C-U>TmuxNavigateUp<cr>" },
			{ "<c-l>", "<cmd><C-U>TmuxNavigateRight<cr>" },
			{ "<c-\\>", "<cmd><C-U>TmuxNavigatePrevious<cr>" },
		},
	},
	{
		"windwp/nvim-autopairs",
		event = "InsertEnter",
		config = function()
			require("nvim-autopairs").setup {}
		end
	},
	{
		"nvim-tree/nvim-tree.lua",
		config = function()
			require("nvim-tree").setup()
		end
	},
	{
		"vimwiki/vimwiki"
	}
}