summaryrefslogtreecommitdiff
path: root/.config/nvim/init.lua
blob: e7c3c5be2058a22af610825ef6940c0bd412685b (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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
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:calendar_monday = 1
	let g:calendar_weeknm = 5
	let g:tex_flavor='latex'

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

	" Command mode hjkl
	cnoremap <C-h> <left>
	cnoremap <C-j> <down>
	cnoremap <C-k> <up>
	cnoremap <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>di

	" Vim Wiki Macros
	autocmd Filetype vimwiki inoremap m<tab> -<space>[<space>]<space>
	autocmd Filetype vimwiki inoremap h<tab> ==<left>
	autocmd Filetype vimwiki inoremap hh<tab> ====<left><left>
	
	" 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

	" HTML Macros
	autocmd Filetype html,php inoremap im<tab> <!DOCTYPE html><enter><html><enter><body><enter><enter></body><enter></html><up><up><tab><tab>
	autocmd Filetype html,php inoremap div<tab> <div class=""><enter></div><esc>2kf"a
	autocmd Filetype html,php inoremap img<tab> <img alt="" src="<++>"><esc>0f"a
	autocmd Filetype html,php inoremap ln<tab> <a href=""><left><left>
	autocmd Filetype html,php inoremap he<tab> <head><enter><enter></head><up>
	autocmd Filetype html,php inoremap ti<tab> <title></title><esc>0f>a
	autocmd Filetype html,php inoremap h1<tab> <h1></h1><esc>0f>a
	autocmd Filetype html,php inoremap h2<tab> <h2></h2><esc>0f>a
	autocmd Filetype html,php inoremap h3<tab> <h3></h3><esc>0f>a
	autocmd Filetype html,php inoremap p<tab> <p></p><esc>0f>a

	" 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
	autocmd Filetype tex inoremap dca<tab> \documentclass{article}<enter>
	autocmd Filetype tex inoremap nc<tab> \newcounter{}<enter>\forloop{}{}{\value{}}{<enter>}<esc>kkf}i
	autocmd Filetype tex inoremap fl<tab> <esc>0f{lvf}hyj0f{p/\\value{<enter>f{pl:noh<enter>a
]])

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"
	},
	{
		"mattn/calendar-vim"
	}
}