-
-
Save podanypepa/523320a1467561a70235bb79c015a0e4 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
filetype plugin indent on | |
set clipboard=unnamed | |
set clipboard+=unnamedplus | |
set exrc | |
set relativenumber | |
set nu | |
set nohlsearch | |
set hidden | |
set noerrorbells | |
set novisualbell | |
" set nowrap | |
set ignorecase | |
set tabstop=4 softtabstop=4 | |
set shiftwidth=4 | |
set autoindent | |
set smartindent | |
set backspace=indent,eol,start | |
set cursorline | |
set noswapfile | |
set nobackup | |
set nowritebackup | |
set autowrite | |
set splitbelow | |
set splitright | |
set lazyredraw | |
set undodir=~/.vim/undodir | |
set undofile | |
set incsearch | |
set scrolloff=8 | |
"set noshowmode | |
set completeopt=menuone,noinsert,noselect | |
set cmdheight=2 | |
set updatetime=50 | |
set colorcolumn=80 | |
set shortmess+=c | |
set ttyfast | |
set clipboard=unnamed | |
set clipboard+=unnamedplus | |
set path+=** | |
set diffopt+=vertical | |
set confirm | |
set autoread | |
set wildignore+=.DS_Store | |
set wildignore+=**/node_modules/** | |
set wildignore+=*.pyc | |
set wildignore+=.git | |
let mapleader = " " | |
call plug#begin(stdpath('data') . '/plugged') | |
Plug 'tpope/vim-commentary' | |
" Plug 'prettier/vim-prettier', { 'do': 'yarn install' } | |
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } | |
Plug 'machakann/vim-highlightedyank' | |
Plug 'jiangmiao/auto-pairs' | |
Plug 'junegunn/fzf.vim' | |
Plug 'gruvbox-community/gruvbox' | |
Plug 'tpope/vim-fugitive' | |
Plug 'neovim/nvim-lspconfig' | |
Plug 'nvim-lua/completion-nvim' | |
Plug 'airblade/vim-gitgutter' | |
call plug#end() | |
colorscheme gruvbox | |
highlight Normal guibg=none | |
highlight cursorlinenr cterm=NONE | |
let g:gruvbox_contrast_dark = "hard" | |
let g:gruvbox_italic=1 | |
set background=dark | |
highlight SignColumn guibg=bg | |
let g:gitgutter_max_signs = 500 | |
let g:gitgutter_override_sign_column_highlight = 1 | |
let g:gitgutter_override_sign_column_highlight = 0 | |
highlight clear SignColumn | |
highlight GitGutterAdd ctermfg=2 | |
highlight GitGutterChange ctermfg=3 | |
highlight GitGutterDelete ctermfg=1 | |
highlight GitGutterChangeDelete ctermfg=4 | |
let &t_ZH="\e[3m" | |
let &t_ZR="\e[23m" | |
highlight Comment cterm=italic | |
let g:highlightedyank_highlight_duration = 200 | |
highlight HighlightedyankRegion cterm=reverse gui=reverse | |
set signcolumn=yes | |
nmap <leader>l <C-w>l | |
nmap <leader>h <C-w>h | |
nmap <leader>j <C-w>j | |
nmap <leader>k <C-w>k | |
nnoremap <Leader>d :bd<CR> | |
" FZF | |
noremap <silent> <C-p> :Files<CR> | |
noremap <silent> <C-g> :GFiles<CR> | |
noremap <silent> <C-i> :Buffers<CR> | |
noremap <C-f> :Rg!<CR> | |
" Terminal switch | |
tnoremap <C-w>h <C-\><C-n><C-w>h | |
tnoremap <C-w>j <C-\><C-n><C-w>j | |
tnoremap <C-w>k <C-\><C-n><C-w>k | |
tnoremap <C-w>l <C-\><C-n><C-w>l | |
lua require'lspconfig'.bashls.setup{} | |
lua require'lspconfig'.tsserver.setup{} | |
lua require'lspconfig'.jsonls.setup{} | |
lua require'lspconfig'.yamlls.setup{} | |
lua <<EOF | |
lspconfig = require "lspconfig" | |
lspconfig.gopls.setup { | |
cmd = {"gopls", "serve"}, | |
settings = { | |
gopls = { | |
analyses = { | |
unusedparams = true, | |
}, | |
staticcheck = true, | |
}, | |
}, | |
} | |
EOF | |
lua <<EOF | |
-- … | |
function goimports(timeoutms) | |
local context = { source = { organizeImports = true } } | |
vim.validate { context = { context, "t", true } } | |
local params = vim.lsp.util.make_range_params() | |
params.context = context | |
local method = "textDocument/codeAction" | |
local resp = vim.lsp.buf_request_sync(0, method, params, timeoutms) | |
if resp and resp[1] then | |
local result = resp[1].result | |
if result and result[1] then | |
local edit = result[1].edit | |
vim.lsp.util.apply_workspace_edit(edit) | |
end | |
end | |
vim.lsp.buf.formatting() | |
end | |
EOF | |
nnoremap <silent><c-]> <cmd>lua vim.lsp.buf.definition()<CR> | |
nnoremap <silent>D <cmd>lua vim.lsp.buf.definition()<CR> | |
nnoremap <silent>R <cmd>lua vim.lsp.buf.references()<CR> | |
nnoremap <silent>K <cmd>lua vim.lsp.buf.hover()<CR> | |
autocmd BufWritePre *.go lua goimports(1000) | |
autocmd BufEnter * lua require'completion'.on_attach() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment