syntax on
set guifont=Ubuntu\ Mono:h16
set showmatch
set number
set ruler
set colorcolumn=80
set nowrap
set tabstop=2

call plug#begin('~/.config/nvim/plugged')

Plug 'sainnhe/everforest'
Plug 'neovim/nvim-lspconfig'
Plug 'vim-airline/vim-airline'
Plug 'lervag/vimtex'
Plug 'ap/vim-css-color'
Plug 'rust-lang/rust.vim'
Plug 'kyazdani42/nvim-web-devicons'
Plug 'simrat39/rust-tools.nvim'
Plug 'sheerun/vim-polyglot'
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
Plug 'onsails/lspkind-nvim'
Plug 'editorconfig/editorconfig-vim'
Plug 'williamboman/mason.nvim', { 'do': ':MasonUpdate' }
Plug 'williamboman/mason-lspconfig.nvim'

call plug#end()

lua require("mason").setup()

>
	" Important!!
	if has('termguicolors')
		set termguicolors
	endif

	" For dark version.
	set background=dark

	" Set contrast.
	" This configuration option should be placed before `colorscheme everforest`.
	" Available values: 'hard', 'medium'(default), 'soft'
	let g:everforest_background = 'hard'

	" For better performance
	let g:everforest_better_performance = 1

	colorscheme everforest
<

lua <<EOF
	local rt = require("rust-tools")

	rt.setup({
		server = {
			on_attach = function(_, bufnr)
				-- Hover actions
				vim.keymap.set("n", "<C-space>", rt.hover_actions.hover_actions, { buffer = bufnr })
				-- Code action groups
				vim.keymap.set("n", "<Leader>a", rt.code_action_group.code_action_group, { buffer = bufnr })
			end,
		},
	})
	-- LSP Diagnostics Options Setup 
	local sign = function(opts)
		vim.fn.sign_define(opts.name, {
			texthl = opts.name,
			text = opts.text,
			numhl = ''
		})
	end

	vim.diagnostic.config({
			virtual_text = false,
			signs = true,
			update_in_insert = true,
			underline = true,
			severity_sort = false,
			float = {
					border = 'rounded',
					source = 'always',
					header = '',
					prefix = '',
			},
	})

	vim.cmd([[
	set signcolumn=yes
	autocmd CursorHold * lua vim.diagnostic.open_float(nil, { focusable = false })
	]])
EOF
