Last active
December 24, 2023 14:26
-
-
Save aelobdog/817c9e288174ddd0596699b7b4db1e14 to your computer and use it in GitHub Desktop.
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
let mapleader = " " | |
let g:loaded_matchparen=1 | |
set clipboard=unnamedplus | |
set tabstop=4 | |
set shiftwidth=4 | |
set softtabstop=4 | |
set expandtab | |
set number | |
set belloff=all | |
set noshowmode | |
set nowrap | |
set termguicolors | |
set completeopt=menu,menuone,preview,noselect,noinsert | |
set cursorline | |
set laststatus=2 | |
set colorcolumn=80 | |
set background=dark | |
" package management | |
lua << LUACONF | |
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" | |
if not vim.loop.fs_stat(lazypath) then | |
vim.fn.system({ | |
"git", | |
"clone", | |
"--filter=blob:none", | |
"https://github.com/folke/lazy.nvim.git", | |
"--branch=stable", -- latest stable release | |
lazypath, | |
}) | |
end | |
vim.opt.rtp:prepend(lazypath) | |
local plugins = { | |
{ | |
'nvim-telescope/telescope.nvim', | |
dependencies = { 'nvim-lua/plenary.nvim' } | |
}, | |
{ | |
"nvim-treesitter/nvim-treesitter", | |
build = ":TSUpdate" | |
}, | |
{ | |
"ellisonleao/gruvbox.nvim", | |
priority = 1000, | |
config = true, | |
}, | |
{ | |
'nvim-lualine/lualine.nvim', | |
}, | |
{ | |
"neoclide/coc.nvim", | |
branch = "release", | |
}, | |
{ | |
"lewis6991/gitsigns.nvim", | |
}, | |
} | |
local opts = {} | |
require("lazy").setup(plugins, opts) | |
local builtin = require("telescope.builtin") | |
vim.keymap.set('n', '<C-p>', builtin.find_files, {}) | |
vim.keymap.set('n', '<leader>fg', builtin.live_grep, {}) | |
local config = require("nvim-treesitter.configs") | |
config.setup({ | |
ensure_installed = {"c", "cpp"}, | |
highlight = { enable = true }, | |
indent = { enable = true }, | |
}) | |
require('lualine').setup { | |
options = { | |
icons_enabled = false, | |
theme = 'auto', | |
component_separators = { left = ' ', right = ' '}, | |
section_separators = { left = ' ', right = ' '}, | |
disabled_filetypes = { | |
statusline = {}, | |
winbar = {}, | |
}, | |
ignore_focus = {}, | |
always_divide_middle = true, | |
globalstatus = false, | |
refresh = { | |
statusline = 1000, | |
tabline = 1000, | |
winbar = 1000, | |
} | |
}, | |
sections = { | |
lualine_a = {'mode'}, | |
lualine_b = {'branch', 'diff', 'diagnostics'}, | |
lualine_c = {'filename'}, | |
lualine_x = {'encoding', 'fileformat', 'filetype'}, | |
lualine_y = {'progress'}, | |
lualine_z = {'location'} | |
}, | |
inactive_sections = { | |
lualine_a = {}, | |
lualine_b = {}, | |
lualine_c = {'filename'}, | |
lualine_x = {'location'}, | |
lualine_y = {}, | |
lualine_z = {} | |
}, | |
tabline = {}, | |
winbar = {}, | |
inactive_winbar = {}, | |
extensions = {} | |
} | |
require('gitsigns').setup() | |
LUACONF | |
colorscheme gruvbox | |
filetype plugin on | |
syntax enable | |
nnoremap <Space> <Nop> | |
nnoremap <leader>r :vsplit<CR><C-w>l | |
nnoremap <leader>d :split<CR><C-w>j | |
nnoremap <leader>w b<C-v>e | |
nnoremap <leader>s b<C-v>ey/<C-R>0<CR> | |
nnoremap <C-f> / | |
nnoremap .. @@ | |
nnoremap <leader><leader> :nohls<CR> | |
nnoremap <C-s> :w<CR> | |
nnoremap <C-d> :lcd %:h<CR> | |
nnoremap <C-q> :q<CR> | |
nnoremap <M-k> ddkkp | |
nnoremap <M-j> ddp | |
nnoremap <M-2> "+Pa | |
nnoremap <M-4> <ESC>GVgg"+y | |
nnoremap <M-5> <ESC>GVgg"+d | |
nnoremap <C-<> <C-w>< | |
nnoremap <C->> <C-w>> | |
nnoremap <M-z> :buffers<CR> | |
nnoremap <C-k> <C-w>k | |
nnoremap <C-j> <C-w>j | |
nnoremap <C-l> <C-w>l | |
nnoremap <C-h> <C-w>h | |
nnoremap <M-'> bi'<ESC>wwhi'<ESC> | |
nnoremap <M-"> bi"<ESC>wwhi"<ESC> | |
nnoremap <M-[> bi[<ESC>wwhi]<ESC> | |
nnoremap <M-{> bi{<ESC>wwhi}<ESC> | |
nnoremap <M-(> bi(<ESC>wwhi)<ESC> | |
inoremap <C-d> <ESC>lDA | |
inoremap <C-f> <ESC>/ | |
inoremap <C-w> <ESC><C-w> | |
inoremap <C-e> <ESC>A | |
inoremap <C-a> <ESC>I | |
tnoremap <C-e> <C-\><C-n> | |
inoremap <C-s> <ESC><C-s> | |
inoremap <M-2> <ESC>"+pa | |
inoremap <M-'> <ESC>bi'<ESC>wwhi' | |
inoremap <M-"> <ESC>bi"<ESC>wwhi" | |
inoremap <M-[> <ESC>bi[<ESC>wwhi | |
inoremap <M-{> <ESC>bi{<ESC>wwhi} | |
inoremap <M-(> <ESC>bi(<ESC>wwhi) | |
inoremap jk <ESC> | |
tnoremap <leader>q exit<CR> | |
vnoremap <M-1> "+y | |
vnoremap <M-3> "+c | |
vnoremap <M-'> c''<ESC>P | |
vnoremap <M-"> c""<ESC>P | |
vnoremap <M-[> c[]<ESC>P | |
vnoremap <M-{> c{}<ESC>P | |
vnoremap <M-9> c()<ESC>P | |
set list | |
set listchars=trail:~,tab:·· | |
"Coc.nvim settings ------------------------------ | |
inoremap <silent><expr> <TAB> | |
\ coc#pum#visible() ? coc#pum#next(1) : | |
\ CheckBackspace() ? "\<Tab>" : | |
\ coc#refresh() | |
inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>" | |
inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm() | |
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>" | |
function! CheckBackspace() abort | |
let col = col('.') - 1 | |
return !col || getline('.')[col - 1] =~# '\s' | |
endfunction | |
nmap <silent> gd <Plug>(coc-definition) | |
nmap <silent> gy <Plug>(coc-type-definition) | |
nmap <silent> gi <Plug>(coc-implementation) | |
nmap <silent> gr <Plug>(coc-references) | |
nnoremap <silent> K :call ShowDocumentation()<CR> | |
function! ShowDocumentation() | |
if CocAction('hasProvider', 'hover') | |
call CocActionAsync('doHover') | |
else | |
call feedkeys('K', 'in') | |
endif | |
endfunction | |
autocmd CursorHold * silent call CocActionAsync('highlight') | |
nmap <leader>cl <Plug>(coc-codelens-action) | |
nmap <leader>in :call CocAction('format')<CR> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment