add neovim configuration

This commit is contained in:
hippoz 2021-11-30 13:53:58 +02:00
parent 9193f2e502
commit 8feacbdfa6
No known key found for this signature in database
GPG key ID: 7C52899193467641
3 changed files with 125 additions and 0 deletions

View file

@ -0,0 +1,6 @@
local ok, err = pcall(require, "main")
if not ok then
error("Error loading main: " .. err)
end

View file

@ -0,0 +1,103 @@
local base16 = require "base16"
require "plugins"
-- thanks nvchad for the telescope config
require("telescope").setup {
defaults = {
vimgrep_arguments = {
"rg",
"--color=never",
"--no-heading",
"--with-filename",
"--line-number",
"--column",
"--smart-case",
},
prompt_prefix = "",
selection_caret = " ",
entry_prefix = " ",
initial_mode = "insert",
selection_strategy = "reset",
sorting_strategy = "ascending",
layout_strategy = "horizontal",
layout_config = {
horizontal = {
prompt_position = "top",
preview_width = 0.55,
results_width = 0.8,
},
vertical = {
mirror = false,
},
width = 0.87,
height = 0.80,
preview_cutoff = 120,
},
file_sorter = require("telescope.sorters").get_fuzzy_file,
file_ignore_patterns = { "node_modules" },
generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter,
path_display = { "absolute" },
winblend = 0,
border = {},
borderchars = { "", "", "", "", "", "", "", "" },
color_devicons = true,
use_less = true,
set_env = { ["COLORTERM"] = "truecolor" }, -- default = nil,
file_previewer = require("telescope.previewers").vim_buffer_cat.new,
grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new,
qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new,
buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker,
}
}
require("nvim-treesitter.configs").setup {
highlight = {
enable = true,
disable = {},
},
indent = {
enable = false,
disable = {},
},
ensure_installed = {
"json",
"html",
"scss",
"javascript",
"css",
"c",
"cpp",
"rust"
},
}
local options = {
tabstop = 4,
shiftwidth = 4,
expandtab = true,
smartindent = true,
smartcase = true,
mouse = "a",
termguicolors = true,
cmdheight = 1
}
local init = {
"nnoremap <leader>ff <cmd>lua require('telescope.builtin').find_files()<cr>",
"nnoremap <leader>fg <cmd>lua require('telescope.builtin').live_grep()<cr>",
"nnoremap <leader>fb <cmd>lua require('telescope.builtin').buffers()<cr>",
"nnoremap <leader>fh <cmd>lua require('telescope.builtin').help_tags()<cr>"
}
for k, v in pairs(options) do
vim.o[k] = v
end
for i, v in pairs(init) do
vim.cmd(v)
end
base16.apply_theme(base16.themes["tomorrow-night"], true)

View file

@ -0,0 +1,16 @@
local packer = require("packer")
return packer.startup(function(use)
use "wbthomason/packer.nvim"
use "norcalli/nvim-base16.lua"
use {
'nvim-telescope/telescope.nvim',
requires = { {'nvim-lua/plenary.nvim'} },
}
use {
"nvim-treesitter/nvim-treesitter",
branch = "0.5-compat",
run = ":TSUpdate"
}
end)