Last active
November 17, 2022 16:47
-
-
Save dridk/d2c2358b9929c27cbf7a129c20eaf85e to your computer and use it in GitHub Desktop.
neovim.lua
This file contains 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
vim.opt.number = true | |
vim.opt.mouse = 'a' | |
vim.opt.ignorecase = true | |
vim.opt.hlsearch = false | |
vim.opt.tabstop = 2 | |
vim.opt.shiftwidth = 2 | |
vim.opt.expandtab = true | |
vim.opt.termguicolors = true | |
vim.g.mapleader = ' ' | |
vim.g.loaded_netrw = 1 | |
vim.g.loaded_netrwPlugin = 1 | |
vim.o.completeopt = "menuone,noselect" | |
vim.opt.completeopt = {'menu', 'menuone', 'noselect'} | |
vim.keymap.set('n', '<C-S-Up>',':m -2 <CR>') | |
vim.keymap.set('n', '<C-S-Down>',':m +2 <CR>') | |
vim.keymap.set('i', '<C-S-Up>','<esc> :m -2 <CR>') | |
vim.keymap.set('i', '<C-S-Down>','<esc> :m +2 <CR>') | |
vim.keymap.set('n', '<S-Tab>',':bnext<CR>') | |
-- PACKERS | |
local install_path = vim.fn.stdpath('data') .. '/site/pack/packer/start/packer.nvim' | |
local install_plugins = false | |
if vim.fn.empty(vim.fn.glob(install_path)) > 0 then | |
print('Installing packer...') | |
local packer_url = 'https://github.com/wbthomason/packer.nvim' | |
vim.fn.system({'git', 'clone', '--depth', '1', packer_url, install_path}) | |
print('Done.') | |
vim.cmd('packadd packer.nvim') | |
install_plugins = true | |
end | |
-- PLUGINS | |
require('packer').startup(function(use) | |
use 'wbthomason/packer.nvim' | |
use 'joshdick/onedark.vim' | |
use 'nvim-lualine/lualine.nvim' | |
use 'nvim-lua/plenary.nvim' | |
use 'nvim-telescope/telescope.nvim' | |
use 'hrsh7th/nvim-compe' | |
use {'akinsho/bufferline.nvim', tag = "v3.*", requires = 'kyazdani42/nvim-web-devicons'} | |
use 'neovim/nvim-lspconfig' | |
use { "williamboman/mason.nvim" } | |
if install_plugins then | |
require('packer').sync() | |
end | |
end) | |
if install_plugins then | |
return | |
end | |
-- COMMAND | |
vim.cmd("colorscheme onedark") | |
require'lspconfig'.pyright.setup{} | |
require("mason").setup() | |
-- CONFIGURE PLUGIN | |
require('lualine').setup({ | |
options = { | |
icons_enabled = false, | |
section_separators = '', | |
component_separators = '' | |
} | |
}) | |
require("bufferline").setup{} | |
require'compe'.setup { | |
enabled = true; | |
autocomplete = true; | |
debug = false; | |
min_length = 1; | |
preselect = 'enable'; | |
throttle_time = 80; | |
source_timeout = 200; | |
resolve_timeout = 800; | |
incomplete_delay = 400; | |
max_abbr_width = 100; | |
max_kind_width = 100; | |
max_menu_width = 100; | |
documentation = { | |
border = { '', '' ,'', ' ', '', '', '', ' ' }, -- the border option is the same as `|help nvim_open_win|` | |
winhighlight = "NormalFloat:CompeDocumentation,FloatBorder:CompeDocumentationBorder", | |
max_width = 120, | |
min_width = 60, | |
max_height = math.floor(vim.o.lines * 0.3), | |
min_height = 1, | |
}; | |
source = { | |
path = true; | |
buffer = true; | |
calc = true; | |
nvim_lsp = true; | |
nvim_lua = true; | |
vsnip = true; | |
ultisnips = true; | |
luasnip = true; | |
}; | |
} | |
vim.keymap.set('i', '<silent><expr> <C-Space>', 'compe#complete()', {}) | |
local builtin = require('telescope.builtin') | |
vim.keymap.set('n', '<leader>ff', builtin.find_files, {}) | |
vim.keymap.set('n', '<leader>fo', builtin.oldfiles, {}) | |
vim.keymap.set('n', '<leader>fg', builtin.live_grep, {}) | |
vim.keymap.set('n', '<leader>fb', builtin.buffers, {}) | |
vim.keymap.set('n', '<leader>fh', builtin.command_history, {}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment