Skip to content

Commit

Permalink
Initial commit with all configs
Browse files Browse the repository at this point in the history
  • Loading branch information
cpow committed Dec 7, 2022
0 parents commit 5cd67e6
Show file tree
Hide file tree
Showing 11 changed files with 129 additions and 0 deletions.
3 changes: 3 additions & 0 deletions init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
require("core.keymaps")
require("core.plugins")
require("core.plugin_config")
17 changes: 17 additions & 0 deletions lua/core/keymaps.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
vim.g.mapleader = ' '
vim.g.maplocalleader = ' '

vim.opt.backspace = '2'
vim.opt.showcmd = true
vim.opt.laststatus = 2
vim.opt.autowrite = true
vim.opt.cursorline = true
vim.opt.autoread = true

-- use spaces for tabs and whatnot
vim.opt.tabstop = 2
vim.opt.shiftwidth = 2
vim.opt.shiftround = true
vim.opt.expandtab = true

vim.keymap.set('n', '<leader>h', ':nohlsearch<CR>')
2 changes: 2 additions & 0 deletions lua/core/plugin_config/colorscheme.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
vim.o.termguicolors = true
vim.cmd [[ colorscheme gruvbox ]]
7 changes: 7 additions & 0 deletions lua/core/plugin_config/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
require("core.plugin_config.colorscheme")
require("core.plugin_config.lualine")
require("core.plugin_config.nvim-tree")
require("core.plugin_config.treesitter")
require("core.plugin_config.telescope")
require("core.plugin_config.vim-test")
require("core.plugin_config.lsp_config")
22 changes: 22 additions & 0 deletions lua/core/plugin_config/lsp_config.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
require("mason").setup()
require("mason-lspconfig").setup({
ensure_installed = { "sumneko_lua", "solargraph" }
})

local on_attach = function(_, _)
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, {})
vim.keymap.set('n', '<leader>ca', vim.lsp.buf.code_action, {})

vim.keymap.set('n', 'gd', vim.lsp.buf.definition, {})
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, {})
vim.keymap.set('n', 'gr', require('telescope.builtin').lsp_references, {})
vim.keymap.set('n', 'K', vim.lsp.buf.hover, {})
end

require("lspconfig").sumneko_lua.setup {
on_attach = on_attach
}

require("lspconfig").solargraph.setup {
on_attach = on_attach
}
14 changes: 14 additions & 0 deletions lua/core/plugin_config/lualine.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
require('lualine').setup {
options = {
icons_enabled = true,
theme = 'gruvbox',
},
sections = {
lualine_a = {
{
'filename',
path = 1,
}
}
}
}
6 changes: 6 additions & 0 deletions lua/core/plugin_config/nvim-tree.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1

require("nvim-tree").setup()

vim.keymap.set('n', '<c-n>', ':NvimTreeFindFileToggle<CR>')
6 changes: 6 additions & 0 deletions lua/core/plugin_config/telescope.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
local builtin = require('telescope.builtin')

vim.keymap.set('n', '<c-p>', builtin.find_files, {})
vim.keymap.set('n', '<Space><Space>', builtin.oldfiles, {})
vim.keymap.set('n', '<Space>fg', builtin.live_grep, {})
vim.keymap.set('n', '<Space>fh', builtin.help_tags, {})
11 changes: 11 additions & 0 deletions lua/core/plugin_config/treesitter.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
require'nvim-treesitter.configs'.setup {
-- A list of parser names, or "all"
ensure_installed = { "c", "lua", "rust", "ruby", "vim" },

-- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = false,
auto_install = true,
highlight = {
enable = true,
},
}
2 changes: 2 additions & 0 deletions lua/core/plugin_config/vim-test.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
vim.keymap.set('n', '<leader>t', ':TestNearest<CR>')
vim.keymap.set('n', '<leader>T', ':TestFile<CR>')
39 changes: 39 additions & 0 deletions lua/core/plugins.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
local ensure_packer = function()
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
fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
vim.cmd [[packadd packer.nvim]]
return true
end
return false
end

local packer_bootstrap = ensure_packer()

return require('packer').startup(function(use)
use 'wbthomason/packer.nvim'
use 'ellisonleao/gruvbox.nvim'
use 'nvim-tree/nvim-tree.lua'
use 'nvim-tree/nvim-web-devicons'
use 'nvim-lualine/lualine.nvim'
use 'nvim-treesitter/nvim-treesitter'
use 'bluz71/vim-nightfly-colors'
use 'vim-test/vim-test'
use {
"williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim",
"neovim/nvim-lspconfig",
}
use {
'nvim-telescope/telescope.nvim',
tag = '0.1.0',
requires = { {'nvim-lua/plenary.nvim'} }
}

-- 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)

0 comments on commit 5cd67e6

Please sign in to comment.