Last active
April 24, 2025 15:22
-
-
Save joaquinco/27dadd460d57321f1ac5a9ac75b84a47 to your computer and use it in GitHub Desktop.
Nvim Lua init script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local Plug = vim.fn['plug#'] | |
vim.call('plug#begin') | |
-- File explorer | |
Plug('preservim/nerdtree') | |
-- Commenting | |
Plug('tpope/vim-commentary') | |
-- Visualization | |
Plug('vim-airline/vim-airline') | |
Plug('vim-airline/vim-airline-themes') | |
-- Git | |
Plug('apzelos/blamer.nvim') | |
-- File/Buffer finder | |
Plug('nvim-lua/plenary.nvim') | |
Plug('nvim-telescope/telescope.nvim') | |
-- LSP | |
Plug('williamboman/mason.nvim') | |
Plug('williamboman/mason-lspconfig.nvim') | |
Plug('neovim/nvim-lspconfig') | |
-- Syntax | |
-- Requires tree-sitter cli | |
Plug('nvim-treesitter/nvim-treesitter') | |
vim.call('plug#end') | |
local opt = vim.opt | |
opt.tabstop = 2 | |
opt.softtabstop = 2 | |
opt.shiftwidth = 2 | |
opt.expandtab = true | |
opt.smarttab = true | |
opt.incsearch = true | |
opt.ignorecase = true | |
opt.smartcase = true | |
opt.hlsearch = true | |
opt.wildmode = 'longest,list,full' | |
opt.list = true | |
opt.breakindent = true | |
opt.number = true | |
opt.title = true | |
opt.scrolloff = 5 | |
vim.cmd('filetype plugin indent on') | |
vim.cmd('colorscheme murphy') | |
-- Plugin Configurations | |
-- NERDTree | |
vim.g.NERDTreeShowHidden = 1 | |
-- Blamer | |
vim.g.blamer_enabled = 0 | |
vim.g.blamer_relative_time = 1 | |
vim.g.blamer_show_in_visual_modes = 0 | |
vim.g.blamer_delay = 200 | |
-- highlight Blamer guifg=lightgray | |
-- Airline | |
-- Powerline fonts needs https://github.com/powerline/fonts | |
vim.g.airline_powerline_fonts = 0 | |
vim.g.airline_theme = 'bubblegum' | |
vim.g['airline#extensions#tabline#enabled'] = 1 | |
vim.g['airline#extensions#tabline#formatter'] = 'unique_tail' | |
-- LSP | |
local language_servers = { | |
'pylsp', | |
'solargraph', | |
'elixirls' | |
} | |
require("mason").setup() | |
require("mason-lspconfig").setup { | |
ensure_installed = language_servers | |
} | |
local lspconfig = require("lspconfig") | |
for _, server_name in pairs(language_servers) do | |
lspconfig[server_name].setup {} | |
end | |
-- Treesitter | |
require('nvim-treesitter.configs').setup { | |
ensure_installed = { 'elixir', }, | |
sync_install = true, | |
auto_install = true, | |
highlight = { enable = true } | |
} | |
-- Telescope | |
require('telescope').setup { | |
defaults = { | |
path_display = { "filename_first" } | |
}, | |
pickers = { | |
find_files = { | |
no_ignore = true, | |
hidden = true | |
} | |
} | |
} | |
local telescope_builtin = require('telescope.builtin') | |
-- Mappings | |
vim.keymap.set({'n', 'v'}, '<C-n>', ':NERDTreeToggle<CR>') | |
vim.keymap.set({'n', 'v'}, '<C-b>', ':NERDTreeFind<CR>') | |
-- Override C-f that I never really use | |
-- fd-find recommended | |
vim.keymap.set({'n', 'v'}, '<A-f>', telescope_builtin.find_files) | |
vim.keymap.set({'n', 'v'}, '<C-f>', telescope_builtin.git_files) | |
-- requires ripgrep | |
vim.keymap.set({'n', 'v'}, '<C-s>', telescope_builtin.live_grep) | |
vim.keymap.set({'n', 'v'}, '<A-b>', '::Telescope buffers<CR>') | |
-- LSP | |
vim.keymap.set({'n', 'i'}, '<A-d>', vim.diagnostic.open_float); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment