nvim: Add neovim config
This commit is contained in:
parent
d1b38e4bd1
commit
46353b43d7
3 changed files with 151 additions and 0 deletions
28
.config/nvim/init.lua
Normal file
28
.config/nvim/init.lua
Normal file
|
@ -0,0 +1,28 @@
|
|||
-- Basic vim options
|
||||
vim.opt.clipboard = 'unnamedplus' -- System clipboard
|
||||
vim.opt.cursorcolumn = true
|
||||
vim.opt.cursorline = true
|
||||
vim.opt.expandtab = true
|
||||
vim.opt.hidden = true
|
||||
vim.opt.history = 30
|
||||
vim.opt.ignorecase = true
|
||||
vim.opt.list = true
|
||||
vim.opt.listchars = 'trail:•,tab:🡺 ,'
|
||||
vim.opt.number = true
|
||||
vim.opt.relativenumber = false
|
||||
vim.opt.shiftwidth = 2
|
||||
vim.opt.showmode = true
|
||||
vim.opt.smartcase = true
|
||||
vim.opt.swapfile = false
|
||||
vim.opt.tabstop = 2
|
||||
vim.opt.termguicolors = true
|
||||
vim.opt.timeoutlen = 200
|
||||
vim.opt.wrap = true
|
||||
|
||||
-- Switch to <Space> as global mapleader and load keymapping config
|
||||
vim.g.mapleader = ' '
|
||||
require('keymap')
|
||||
|
||||
-- Require lua/plugins.lua config
|
||||
require('plugins')
|
||||
|
8
.config/nvim/lua/keymap.lua
Normal file
8
.config/nvim/lua/keymap.lua
Normal file
|
@ -0,0 +1,8 @@
|
|||
-- Convenience function. description parameter is used by `whichkey`
|
||||
local function map(mode, keybind, command, description)
|
||||
vim.api.nvim_set_keymap(mode, keybind, command, { desc = description, silent = true, noremap = true })
|
||||
end
|
||||
|
||||
map('n', '<leader>fr', ':History<CR>', 'Show recently used files')
|
||||
map('n', '<leader>ff', ':e %:h/<C-d>', 'Show files in directory')
|
||||
|
115
.config/nvim/lua/plugins.lua
Normal file
115
.config/nvim/lua/plugins.lua
Normal file
|
@ -0,0 +1,115 @@
|
|||
-- Automatically run :PackerCompile whenever plugins.lua is updated
|
||||
vim.api.nvim_create_autocmd('BufWritePost', {
|
||||
group = vim.api.nvim_create_augroup('PACKER', { clear = true }),
|
||||
pattern = 'plugins.lua',
|
||||
command = 'source <afile> | PackerCompile',
|
||||
})
|
||||
|
||||
vim.cmd [[packadd packer.nvim]]
|
||||
|
||||
return require('packer').startup({function(use)
|
||||
use 'wbthomason/packer.nvim'
|
||||
|
||||
-- Theming - one for all package. autocomplete :colorscheme to see what is available
|
||||
use 'RRethy/nvim-base16'
|
||||
vim.cmd [[colorscheme base16-espresso]]
|
||||
|
||||
-- Pretty symbols
|
||||
use 'kyazdani42/nvim-web-devicons'
|
||||
|
||||
-- Completion and linting
|
||||
use 'neovim/nvim-lspconfig'
|
||||
|
||||
-- Autopairs
|
||||
use 'windwp/nvim-autopairs'
|
||||
require("nvim-autopairs").setup()
|
||||
|
||||
-- Highlight colors
|
||||
use {
|
||||
'norcalli/nvim-colorizer.lua',
|
||||
ft = { 'css', 'javascript', 'vim', 'html' },
|
||||
config = [[require('colorizer').setup {'css', 'javascript', 'vim', 'html'}]],
|
||||
}
|
||||
|
||||
-- Syntax highlighting
|
||||
use { 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate' }
|
||||
require'nvim-treesitter.configs'.setup {
|
||||
ensure_installed = {
|
||||
"bash",
|
||||
"c",
|
||||
"css",
|
||||
"dockerfile",
|
||||
"go",
|
||||
"html",
|
||||
"javascript",
|
||||
"json",
|
||||
"latex",
|
||||
"lua",
|
||||
"make",
|
||||
"python",
|
||||
"rust",
|
||||
"vue",
|
||||
"yaml",
|
||||
},
|
||||
sync_install = false,
|
||||
auto_install = true, -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
|
||||
highlight = {
|
||||
enable = true,
|
||||
-- disable = { "c", "rust" },
|
||||
},
|
||||
}
|
||||
|
||||
-- Lualine statusline
|
||||
use 'nvim-lualine/lualine.nvim'
|
||||
require('lualine').setup {
|
||||
options = {
|
||||
icon_enabled = true,
|
||||
theme = 'auto',
|
||||
}
|
||||
}
|
||||
|
||||
-- fzf
|
||||
use 'junegunn/fzf'
|
||||
use 'junegunn/fzf.vim'
|
||||
|
||||
-- toggleterm
|
||||
use { "akinsho/toggleterm.nvim", tag = 'v2.*' }
|
||||
require("toggleterm").setup{
|
||||
open_mapping = [[<c-\>]],
|
||||
hide_numbers = true,
|
||||
persist_size = true,
|
||||
persist_mode = true,
|
||||
direction = 'horizontal', -- 'float',
|
||||
close_on_exit = true,
|
||||
shell = vim.o.shell,
|
||||
auto_scroll = true,
|
||||
float_opts = {
|
||||
border = 'curved',
|
||||
},
|
||||
winbar = {
|
||||
enabled = false,
|
||||
name_formatter = function(term)
|
||||
return term.name
|
||||
end
|
||||
},
|
||||
}
|
||||
|
||||
-- Popup for available keybinds
|
||||
use {
|
||||
"folke/which-key.nvim",
|
||||
config = function()
|
||||
require("which-key").setup{
|
||||
window = {
|
||||
border = "double",
|
||||
position = "bottom",
|
||||
},
|
||||
}
|
||||
end
|
||||
}
|
||||
|
||||
end,
|
||||
config = {
|
||||
display = {
|
||||
open_fn = require('packer.util').float,
|
||||
}
|
||||
}})
|
Loading…
Add table
Reference in a new issue