Skip to content

Commit

Permalink
feat: move nvim conf
Browse files Browse the repository at this point in the history
  • Loading branch information
Plus17 committed May 23, 2023
1 parent b90d983 commit 5dcae99
Show file tree
Hide file tree
Showing 35 changed files with 494 additions and 0 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions nvim/.config/nvim/_after/plugin/colors.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
function UseColorScheme()
vim.cmd([[colorscheme "catppuccin"]])
end

UseColorScheme()
12 changes: 12 additions & 0 deletions nvim/.config/nvim/_after/plugin/lsp.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
local lsp = require('lsp-zero')
lsp.preset('recommended')

lsp.ensure_installed({
-- Replace these with whatever servers you want to install
'sumneko_lua',
})

-- Configure lua language server for neovim
lsp.nvim_workspace()

lsp.setup()
3 changes: 3 additions & 0 deletions nvim/.config/nvim/_after/plugin/telescope.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
local builtin = require("telescope.builtin")

vim.keymap.set("n", "<C-p>", builtin.find_files, {})
36 changes: 36 additions & 0 deletions nvim/.config/nvim/_after/plugin/treesitter.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
require'nvim-treesitter.configs'.setup {
-- A list of parser names, or "all" (the four listed parsers should always be installed)
ensure_installed = {
"elixir",
"ruby",
"erlang",
"lua",
"bash",
"markdown",
"json",
"heex",
"dockerfile",
"vim"
},

-- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = false,

-- Automatically install missing parsers when entering buffer
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
auto_install = true,

---- If you need to change the installation directory of the parsers (see -> Advanced Setup)
-- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")!

highlight = {
-- `false` will disable the whole extension
enable = true,

-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = false,
},
}
14 changes: 14 additions & 0 deletions nvim/.config/nvim/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
require("plus17.settings")
require("plus17.keymaps")
require("plus17.packer")
require("plus17.colors")
require("plus17.treesitter")
require("plus17.telescope")
require("plus17.bufferline")
require("plus17.lualine")
require("plus17.indentline")
require("plus17.autopairs")
require("plus17.fileexplorer")
require("plus17.comment")
require("plus17.gitsigns")
require("plus17.lsp")
1 change: 1 addition & 0 deletions nvim/.config/nvim/lua/plus17/autopairs.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require('nvim-autopairs').setup()
5 changes: 5 additions & 0 deletions nvim/.config/nvim/lua/plus17/bufferline.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
vim.opt.termguicolors = true
require("bufferline").setup()

vim.keymap.set('n', '<Tab>', '<Cmd>BufferLineCycleNext<CR>', {})
vim.keymap.set('n', '<S-Tab>', '<Cmd>BufferLineCyclePrev<CR>', {})
6 changes: 6 additions & 0 deletions nvim/.config/nvim/lua/plus17/colors.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
local colorscheme = "catppuccin-mocha"

local status_ok, _ = pcall(vim.cmd, "colorscheme " .. colorscheme)
if not status_ok then
return
end
9 changes: 9 additions & 0 deletions nvim/.config/nvim/lua/plus17/comment.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
local present, nvim_comment = pcall(require, "Comment")

if not present then
return
end

local options = {}
options = load_override(options, "numToStr/Comment.nvim")
nvim_comment.setup(options)
31 changes: 31 additions & 0 deletions nvim/.config/nvim/lua/plus17/fileexplorer.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
-- disable netrw at the very start of your init.lua (strongly advised)
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1

require("nvim-tree").setup({
view = {
mappings = {
list = {

},
},
},
renderer = {
icons = {
show = {
folder = false,
folder_arrow = true,
file = false,
git = true,
},
glyphs = {
folder = {
arrow_closed = "",
arrow_open = "",
},
},
},
},
})

vim.keymap.set("n", "<C-b>", ":NvimTreeFindFileToggle<CR>", { silent = true })
1 change: 1 addition & 0 deletions nvim/.config/nvim/lua/plus17/gitsigns.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require('gitsigns').setup()
5 changes: 5 additions & 0 deletions nvim/.config/nvim/lua/plus17/indentline.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
require("indent_blankline").setup {
-- for example, context is off by default, use this to turn it on
show_current_context = true,
show_current_context_start = true,
}
58 changes: 58 additions & 0 deletions nvim/.config/nvim/lua/plus17/keymaps.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
local opts = { noremap = true, silent = true }

local term_opts = { silent = true }

-- Shorten function name
local keymap = vim.api.nvim_set_keymap

--Remap space as leader key
-- keymap("", ",", "<Nop>", opts)
-- vim.g.mapleader = ","
-- vim.g.maplocalleader = ","
vim.g.mapleader = ";"

-- Normal --
-- Delete a word backwards
keymap("n", "dW", 'vb"_d', opts)

-- Select All
keymap("n", "<C-a>", "gg<S-v>G", opts)

-- close buffer
keymap("n", "<C-w>", ":bd<CR>", opts)

-- Quit
keymap("", "<C-q>", ":q!<CR>", opts)

-- save buffer
keymap("n", "<C-s>", ":w<CR>", opts)

-- Split buffers
keymap("n", "<S-v>", ":vsplit<CR>", opts)

-- Better window navigation
keymap("n", "<C-h>", "<C-w>h", opts)
keymap("n", "<C-j>", "<C-w>j", opts)
keymap("n", "<C-k>", "<C-w>k", opts)
keymap("n", "<C-l>", "<C-w>l", opts)

-- Navigate buffers
keymap("n", "<S-l>", ":bnext<CR>", opts)
keymap("n", "<S-h>", ":bprevious<CR>", opts)

-- Move selected line / block of text in visual mode
keymap("x", "K", ":move '<-2<CR>gv-gv", opts)
keymap("x", "J", ":move '>+1<CR>gv-gv", opts)

-- Indenting in visual mode
keymap("v", "<", "<gv", opts)
keymap("v", ">", ">gv", opts)

-- visual block
keymap("", "<Leader>v", "<C-v>", opts)

-- esc to hide matches
keymap("n", "<Esc>", ":noh<CR>", term_opts)

-- global "go to definition (lsp)"
keymap("n", "gd", "<CMD>lua vim.lsp.buf.definition()<CR>", opts)
13 changes: 13 additions & 0 deletions nvim/.config/nvim/lua/plus17/lsp.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
local lsp = require('lsp-zero')
lsp.preset('recommended')

lsp.ensure_installed({
-- Replace these with whatever servers you want to install
"sumneko_lua",
"elixirls",
})

-- Configure lua language server for neovim
lsp.nvim_workspace()

lsp.setup()
1 change: 1 addition & 0 deletions nvim/.config/nvim/lua/plus17/lualine.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require('lualine').setup{ theme = "ayu_mirage" }
48 changes: 48 additions & 0 deletions nvim/.config/nvim/lua/plus17/options.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
local options = {
backup = false, -- creates a backup file
clipboard = "unnamedplus", -- allows neovim to access the system clipboard
cmdheight = 2, -- more space in the neovim command line for displaying messages
completeopt = { "menuone", "noselect" }, -- mostly just for cmp
conceallevel = 0, -- so that `` is visible in markdown files
fileencoding = "utf-8", -- the encoding written to a file
hlsearch = true, -- highlight all matches on previous search pattern
ignorecase = true, -- ignore case in search patterns
mouse = "a", -- allow the mouse to be used in neovim
showmode = false, -- we don't need to see things like -- INSERT -- anymore
showtabline = 2, -- always show tabs
smartcase = true, -- smart case
smartindent = true, -- make indenting smarter again
splitbelow = true, -- force all horizontal splits to go below current window
splitright = true, -- force all vertical splits to go to the right of current window
swapfile = false, -- creates a swapfile
-- termguicolors = true, -- set term gui colors (most terminals support this)
timeoutlen = 100, -- time to wait for a mapped sequence to complete (in milliseconds)
undofile = true, -- enable persistent undo
updatetime = 100, -- faster completion (4000ms default)
writebackup = false, -- if a file is being edited by another program (or was written to file while editing with another program), it is not allowed to be edited
expandtab = true, -- convert tabs to spaces
shiftwidth = 2, -- the number of spaces inserted for each indentation
tabstop = 2, -- insert 2 spaces for a tab
cursorline = true, -- highlight the current line
number = true, -- set numbered lines
numberwidth = 4, -- set number column width to 2 {default 4}
signcolumn = "yes", -- always show the sign column, otherwise it would shift the text each time
wrap = false, -- display lines as one long line
scrolloff = 20, -- is one of my fav
sidescrolloff = 8,
guifont = "monospace:h17", -- the font used in graphical neovim applications
}

vim.opt.shortmess:append "c"

for k, v in pairs(options) do
vim.opt[k] = v
end

-- cursor configs
vim.cmd "set guicursor=i:ver1"
vim.cmd "set guicursor+=a:blinkon1"

--- performance configs
vim.cmd "set lazyredraw"
vim.cmd "set nosc noru nosm"
92 changes: 92 additions & 0 deletions nvim/.config/nvim/lua/plus17/packer.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
-- This file can be loaded by calling `lua require('plugins')` from your init.vim

-- Only required if you have packer configured as `opt`
vim.cmd [[packadd packer.nvim]]

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

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

use({
"nvim-telescope/telescope.nvim",
tag = "0.1.0",
requires = { { "nvim-lua/plenary.nvim" } },
})

use { "nvim-telescope/telescope-file-browser.nvim" }

use("lewis6991/gitsigns.nvim")

use {
"windwp/nvim-autopairs",
config = function() require("nvim-autopairs").setup {} end
}

use "tpope/vim-endwise"

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

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

-- Autocompletion
{'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

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

use {
'nvim-lualine/lualine.nvim',
requires = { 'kyazdani42/nvim-web-devicons', opt = true }
}

use {'akinsho/bufferline.nvim', tag = "v3.*", requires = 'nvim-tree/nvim-web-devicons'}

use "lukas-reineke/indent-blankline.nvim"

use {
'numToStr/Comment.nvim',
keys = { "gcc" },
config = function()
require('Comment').setup()
end
}

use {
'nvim-tree/nvim-tree.lua',
requires = {
'nvim-tree/nvim-web-devicons', -- optional, for file icons
},
tag = 'nightly' -- optional, updated every week. (see issue #1193)
}

use {
'lewis6991/gitsigns.nvim',
-- tag = 'release' -- To use the latest release (do not use this if you run Neovim nightly or dev builds!)
}

-- Elixir
use "elixir-editors/vim-elixir"

-- Ruby
use 'vim-ruby/vim-ruby'

-- GitHub Copilot
use 'github/copilot.vim'
end)
Loading

0 comments on commit 5dcae99

Please sign in to comment.