summaryrefslogtreecommitdiff
path: root/init.lua
blob: 2b73fe7e34bb0587c77b93727079f9d98515fad4 (plain) (blame)
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
-- https://github.com/nvim-lua/kickstart.nvim
-- https://www.youtube.com/watch?v=stqUbv-5u2s
-- https://www.youtube.com/watch?v=w7i4amO_zaE

local install_path = vim.fn.stdpath 'data' .. '/site/pack/packer/start/packer.nvim'
local is_bootstrap = false
if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
  is_bootstrap = true
  vim.fn.system { 'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path }
  vim.cmd [[packadd packer.nvim]]
end

-------------------------------------------------------------------------
-- From: https://github.com/nvim-tree/nvim-tree.lua
-- disable netrw at the very start of your init.lua (strongly advised)
-- vim.g.loaded_netrw = 1
-- vim.g.loaded_netrwPlugin = 1
-------------------------------------------------------------------------


require("mitch")

vim.cmd [[packadd packer.nvim]]

-- vim.cmd [[colorscheme nord]]

require('packer').startup(function(use)
	-- Packer can manage itself
	use 'wbthomason/packer.nvim'


	use {
		'nvim-telescope/telescope.nvim', tag = '0.1.0',
		-- or                            , branch = '0.1.x',
		requires = { {'nvim-lua/plenary.nvim'} }
	}

	-- Themes

	use 'shaunsingh/nord.nvim'

	use { "catppuccin/nvim", as = "catppuccin" }

	use { "olivertaylor/vacme" }



	use('nvim-treesitter/nvim-treesitter', {run = ':TSUpdate'})

	use 'nvim-treesitter/playground'

	use 'mbbill/undotree'

	use 'tpope/vim-fugitive'

	use {
		'VonHeikemen/lsp-zero.nvim',
		requires = {
			-- LSP Support
			{'neovim/nvim-lspconfig'},
			{'williamboman/mason.nvim'},
			{'williamboman/mason-lspconfig.nvim'},

			-- Autocompletion
			{'hrsh7th/nvim-cmp'},
			{'hrsh7th/cmp-buffer'},
			{'hrsh7th/cmp-path'},
			{'saadparwaiz1/cmp_luasnip'},
			{'hrsh7th/cmp-nvim-lsp'},
			{'hrsh7th/cmp-nvim-lua'},

			-- Snippets
			{'L3MON4D3/LuaSnip'},
			{'rafamadriz/friendly-snippets'},
		}
	}


	use 'mattn/emmet-vim'

	use 'lewis6991/gitsigns.nvim'

	-- replacement for syntastic, seems to work okay out of the box
	use 'dense-analysis/ale'

	use {
		'nvim-lualine/lualine.nvim', -- status line
		config = function ()
		end
	}

	use 'simrat39/symbols-outline.nvim'

	use 'numToStr/Comment.nvim' -- "gc" to comment visual regions/lines

	use 'fatih/vim-go'

end)

require('symbols-outline').setup {
  symbols = {
    File = {icon = "[f]", hl = "TSURI"},
    Module = {icon = "[m]", hl = "TSNamespace"},
    Namespace = {icon = "[n]", hl = "TSNamespace"},
    Package = {icon = "[p]", hl = "TSNamespace"},
    Class = {icon = "->", hl = "TSType"},
    Method = {icon = "->", hl = "TSMethod"},
    Property = {icon = "->", hl = "TSMethod"},
    Field = {icon = "->", hl = "TSField"},
    Constructor = {icon = "[con]", hl = "TSConstructor"},
    Enum = {icon = "[en]", hl = "TSType"},
    Interface = {icon = "[i]", hl = "TSType"},
    Function = {icon = "[func]", hl = "TSFunction"},
    Variable = {icon = "[var]", hl = "TSConstant"},
    Constant = {icon = "[const]", hl = "TSConstant"},
    String = {icon = "[s]", hl = "TSString"},
    Number = {icon = "[num]", hl = "TSNumber"},
    Boolean = {icon = "[bool]", hl = "TSBoolean"},
    Array = {icon = "[arr]", hl = "TSConstant"},
    Object = {icon = "[obj]", hl = "TSType"},
    Key = {icon = "[key]", hl = "TSType"},
    Null = {icon = "NULL", hl = "TSType"},
    EnumMember = {icon = "[enm]", hl = "TSField"},
    Struct = {icon = "[struct]", hl = "TSType"},
    Event = {icon = "[ev]", hl = "TSType"},
    Operator = {icon = "[op]", hl = "TSOperator"},
    TypeParameter = {icon = "[tparm]", hl = "TSParameter"}
  }
}

-- vim.g.nord_contrast = true
-- vim.g.nord_borders = false
vim.g.nord_disable_background = true
vim.g.nord_italic = false
-- vim.g.nord_uniform_diff_background = true
vim.g.nord_bold = false

-- Load the colorscheme
require('nord').set()

LuaLineConf = {
	options = {
		icons_enabled = false,
		component_separators = '|',
		section_separators = '',
		theme = 'nord',
	},
	sections = {
		lualine_a = {'mode'},
		lualine_b = {'branch', 'diff', 'diagnostics'},
		lualine_c = {
			{
				'filename',
				file_status = true,
				-- 0 filename
				-- 1 relative path
				-- 2 abs path
				-- 3 abs path with ~
				path = 3
			},
		},
		lualine_x = {'encoding', 'fileformat', 'filetype'},
		lualine_y = {'progress'},
		lualine_z = {'location'}
	}
}

require('lualine').setup(LuaLineConf)

require('Comment').setup()


require('gitsigns').setup {
	signs = {
		add = { text = '+' },
		change = { text = '~' },
		delete = { text = '_' },
		topdelete = { text = '‾' },
		changedelete = { text = '~' },
	},
}


-- telescope
vim.keymap.set('n', '<leader>?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' })
vim.keymap.set('n', '<leader>sb', require('telescope.builtin').buffers, { desc = '[ ] Find existing buffers' })
vim.keymap.set('n', '<leader>/', function()
  -- You can pass additional configuration to telescope to change theme, layout, etc.
  require('telescope.builtin').current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
    winblend = 10,
    previewer = false,
  })
end, { desc = '[/] Fuzzily search in current buffer]' })

vim.keymap.set('n', '<leader>sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' })
vim.keymap.set('n', '<leader>sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' })
vim.keymap.set('n', '<leader>sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' })
vim.keymap.set('n', '<leader>sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' })
vim.keymap.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' })
local builtin = require('telescope.builtin')
vim.keymap.set('n', '<C-p>', builtin.find_files, {})
vim.keymap.set('n', '<C-o>', builtin.git_files, {})
vim.keymap.set('n', '<leader>ps', function()
	builtin.grep_string({ search = vim.fn.input("Grep > ") })
end)


vim.keymap.set('n', '<leader>so', function()
	vim.cmd('SymbolsOutline')
end)