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
139
140
141
142
|
-- Autoinstall packer
local fn = vim.fn
local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
if fn.empty(fn.glob(install_path)) > 0 then
packer_bootstrap = fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
end
-- Autocompile packer
vim.cmd([[
augroup packer_user_config
autocmd!
autocmd BufWritePost plugins.lua source <afile> | PackerCompile
augroup end
]])
return require('packer').startup(function(use)
-- Packer itself :)
use 'wbthomason/packer.nvim'
-- Git plugins
use {
'tpope/vim-fugitive',
}
-- fzf (Fuzzy finder for various things)
use {
'junegunn/fzf.vim',
requires = { 'junegunn/fzf', 'kyazdani42/nvim-web-devicons' },
config = function()
vim.cmd [[
let g:fzf_layout = { 'down': '40%' }
autocmd! FileType fzf
autocmd FileType fzf set laststatus=0 noshowmode noruler
\| autocmd BufLeave <buffer> set laststatus=2 showmode ruler
let g:fzf_colors =
\ { 'fg': ['fg', 'Normal'],
\ 'bg': ['bg', 'Normal'],
\ 'hl': ['fg', 'Comment'],
\ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
\ 'bg+': ['bg', 'CursorLine', 'CursorColumn'],
\ 'hl+': ['fg', 'Statement'],
\ 'info': ['fg', 'PreProc'],
\ 'border': ['fg', 'Ignore'],
\ 'prompt': ['fg', 'Conditional'],
\ 'pointer': ['fg', 'Exception'],
\ 'marker': ['fg', 'Keyword'],
\ 'spinner': ['fg', 'Label'],
\ 'header': ['fg', 'Comment'] }
]]
vim.api.nvim_set_keymap("n", ";", ":Files<cr>", { noremap = true, silent = true })
vim.api.nvim_set_keymap("n", "<leader>;", ":Rg<cr>", { noremap = true, silent = true })
vim.api.nvim_set_keymap("n", "<leader><leader>;", ":Lines<cr>", { noremap = true, silent = true })
end,
}
-- Lsp things
use {
'williamboman/mason.nvim',
'williamboman/mason-lspconfig.nvim',
'neovim/nvim-lspconfig' ,
}
-- Treesitter, quicker highlighting and such
use {
"nvim-treesitter/nvim-treesitter",
config = function()
require'nvim-treesitter.configs'.setup {
ensure_installed = { "c", "cpp", "python", "php", "java", "lua", "vim", "vimdoc", "query", "php", "sql" },
sync_install = false,
auto_install = true,
--ignore_install = { "javascript" },
}
end
}
-- vim-dadbob (run sql directly)
use {
'tpope/vim-dadbod',
config = function()
vim.cmd [[
xnoremap <expr> <Plug>(DBExe) db#op_exec()
nnoremap <expr> <Plug>(DBExe) db#op_exec()
nnoremap <expr> <Plug>(DBExeLine) db#op_exec() . '_'
xmap <leader>db <Plug>(DBExe)
nmap <leader>db <Plug>(DBExe)
omap <leader>db <Plug>(DBExe)
nmap <leader>dbb <Plug>(DBExeLine)
autocmd FileType dbout setlocal nofoldenable
]]
end,
}
-- Useful for wide screens
use {
'junegunn/goyo.vim'
}
-- VimWiki stuff
use {
'vimwiki/vimwiki',
config = function ()
vim.g.vimwiki_global_ext = 0
vim.g.vimwiki_auto_header = 1
vim.g.vimwiki_links_space_char = '_'
vim.g.vimwiki_url_maxsave = 0
vim.g.vimwiki_auto_chdir = 1
end,
}
use {
'mattn/calendar-vim',
config = function()
vim.g.calendar_monday = 1
vim.g.calendar_weeknm = 5
vim.api.nvim_create_autocmd("QuitPre", {
callback = function()
local invalid_win = {}
local wins = vim.api.nvim_list_wins()
for _, w in ipairs(wins) do
local bufname = vim.api.nvim_buf_get_name(vim.api.nvim_win_get_buf(w))
if bufname:match("__Calendar") ~= nil then
table.insert(invalid_win, w)
end
end
if #invalid_win == #wins - 1 then
for _, w in ipairs(invalid_win) do vim.api.nvim_win_close(w, true) end
end
end
})
end
}
-- Automatically set up your configuration after cloning packer.nvim
-- Put this at the end after all plugins
if packer_bootstrap then
require('packer').sync()
end
end)
|