-
Notifications
You must be signed in to change notification settings - Fork 20
/
init.lua
180 lines (156 loc) · 4.79 KB
/
init.lua
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
print("Welcome Anthony! How are you doing today?")
vim.g.mapleader = " "
require("packer").startup(function(use)
use { "wbthomason/packer.nvim" }
use { "ellisonleao/gruvbox.nvim" }
use('nvim-treesitter/nvim-treesitter', {run = ':TSUpdate'})
use {
'nvim-telescope/telescope.nvim', tag = '0.1.1',
requires = { {'nvim-lua/plenary.nvim'} }
}
use({
"chama-chomo/grail",
-- Optional; default configuration will be used if setup isn't called.
config = function()
require("grail").setup()
end,
})
use {
'nvim-lualine/lualine.nvim',
requires = { 'kyazdani42/nvim-web-devicons', opt = true }
}
use { "fatih/vim-go" }
use {
'VonHeikemen/lsp-zero.nvim',
branch = 'v1.x',
requires = {
{'neovim/nvim-lspconfig'}, -- Required
{'williamboman/mason.nvim'}, -- Optional
{'williamboman/mason-lspconfig.nvim'}, -- Optional
{'hrsh7th/nvim-cmp'}, -- Required
{'hrsh7th/cmp-nvim-lsp'}, -- Required
{'hrsh7th/cmp-buffer'}, -- Optional
{'hrsh7th/cmp-path'}, -- Optional
{'saadparwaiz1/cmp_luasnip'}, -- Optional
{'hrsh7th/cmp-nvim-lua'}, -- Optional
{'L3MON4D3/LuaSnip'}, -- Required
{'rafamadriz/friendly-snippets'}, -- Optional
},
use {"akinsho/toggleterm.nvim", tag = '*' },
use "jhlgns/naysayer88.vim",
use "terrortylor/nvim-comment",
use "CreaturePhil/vim-handmade-hero"
}
end)
-- some
vim.keymap.set("n", "<M-b>", ":Ex<CR>")
-- split screen and navigation
vim.keymap.set("n", "<leader>v", ":vsplit<CR><C-w>l", { noremap = true })
vim.keymap.set("n", "<leader>h", ":wincmd h<CR>", { noremap = true })
vim.keymap.set("n", "<leader>l", ":wincmd l<CR>", { noremap = true })
-- See `:help telescope.builtin`
vim.keymap.set('n', '<leader>?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' })
vim.keymap.set('n', '<leader><space>', require('telescope.builtin').buffers, { desc = '[ ] Find existing buffers' })
vim.keymap.set('n', '<leader>f', function()
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>p', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' })
vim.keymap.set('n', '<M-p>', 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' })
-- TREESITTER
require'nvim-treesitter.configs'.setup {
ensure_installed = {"c", "lua", "vim", "go", "javascript", "typescript", "rust"},
highlight = {
enable = false,
}
}
-- GRUVBOX
require("gruvbox").setup({
contrast = "hard",
palette_overrides = {
gray = "#2ea542", -- comments are green and by that I mean GREEN
}
})
-- LUALINE
require("lualine").setup{
options = {
icons_enabled = false,
theme = "onedark",
component_separators = "|",
section_separators = "",
},
}
-- LSP
local lsp = require("lsp-zero")
lsp.preset("recommended")
lsp.ensure_installed({
"tsserver",
"gopls",
"eslint",
"rust_analyzer",
})
lsp.set_preferences({
sign_icons = {}
})
lsp.on_attach(function(client, bufnr)
local opts = {buffer = bufnr, remap = false}
vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
end)
lsp.setup()
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
vim.lsp.diagnostic.on_publish_diagnostics, {
signs = false,
virtual_text = true,
underline = false,
}
)
-- COMMENT
require("nvim_comment").setup({
operator_mapping = "<leader>/"
})
-- TERMINAL SETUP
require("toggleterm").setup{
direction = "horizontal",
size = 90,
open_mapping = [[<M-j>]]
}
-- COLORSCHEME
vim.cmd("colorscheme gruvbox")
-- Adding the same comment color in each theme
vim.cmd([[
augroup CustomCommentCollor
autocmd!
autocmd VimEnter * hi Comment guifg=#2ea542
augroup END
]])
-- Disable annoying match brackets and all the jaz
vim.cmd([[
augroup CustomHI
autocmd!
autocmd VimEnter * NoMatchParen
augroup END
]])
vim.o.background = "dark"
vim.keymap.set("i", "jj", "<Esc>")
vim.opt.guicursor = "i:block"
vim.opt.tabstop = 4
vim.opt.shiftwidth = 4
vim.opt.number = false
vim.opt.relativenumber = true
vim.opt.swapfile = false
vim.o.hlsearch = true
vim.o.mouse = 'a'
vim.o.breakindent = true
vim.o.undofile = true
vim.o.ignorecase = true
vim.o.updatetime = 250
vim.o.timeout = true
vim.o.timeoutlen = 300
--vim.o.completeopt = 'menuone,noselect'
vim.o.termguicolors = true