Skip to content

Instantly share code, notes, and snippets.

@artronics
Last active November 10, 2022 14:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save artronics/50e4b1eb58d1b6f8593dacecab4778b2 to your computer and use it in GitHub Desktop.
Save artronics/50e4b1eb58d1b6f8593dacecab4778b2 to your computer and use it in GitHub Desktop.
set nocompatible
filetype plugin indent on
syntax on
"colorscheme darcula
"""""""""""" Key Map
let mapleader = ","
let maplocalleader="\<space>"
nmap H ^
nmap L $
xmap H ^
xmap L $
omap H ^
omap L $
set signcolumn=yes
imap jj <Esc>
nmap <CR> o<Esc>
"imap <C-o> <esc>o " mapped in idea to next/prev edit; as idea keymap it
"doesn't distinguish between insert and normal mode
nnoremap U <C-r>
" nnoremap <space> viw
" vnoremap <space> e
nnoremap <bs> diw
nnoremap ;; A;<esc>
inoremap ;; <esc>A;
nnoremap <leader>rr :%s///g
nnoremap <leader>rc :%s///gc
if has("nvim")
nmap == ==j
nnoremap <leader><bar> :vsplit<CR>
nnoremap <leader>_ :split<CR>
nnoremap zz :update<CR>
nnoremap <leader><leader>t :cclose<CR>
set pastetoggle=<F2>
vnoremap <tab> %
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-h> <C-w>h
nnoremap <C-l> <C-w>l
endif
" Buffer
nnoremap <leader><Tab> :bnext<CR>
nnoremap <leader><leader><Tab> :bprevious<CR>
"""""""""""" General
set updatetime=100
set autoread
"set clipboard=unnamed
set nowrap " don't wrap lines
set backspace=indent,eol,start " allow backspacing over everything in insert mode
set backspace=2 " make backspace work like most other apps
set number
set autoindent " always set autoindenting on
set smartindent
set copyindent " copy the previous indentation on autoindenting
"Setting related to tab
set tabstop=2 shiftwidth=2 expandtab
set softtabstop=2 " makes the spaces feel like real tabs
set shiftround " use multiple of shiftwidth when indenting with '<' and '>'
set foldlevel=9
"Search related conf also look ~/.vim/vimrc/search-keybindings.vim
"set showmatch " set show matching parenthesis
"set ignorecase " ignore case when searching
"set smartcase " ignore case if search pattern is all lowercase,
set nolazyredraw " don't redraw while executing macros
"set hlsearch " highlight search terms
"set incsearch " show search matches as you type
set history=1000 " remember more commands and search history
set undolevels=1000 " use many muchos levels of undo
set wildignore=*.swp,*.bak,*.pyc,*.class
set title " change the terminal's title
"set visualbell " don't beep
set noerrorbells " don't beep
set vb t_vb=
set belloff=all
set scrolloff=7 "when jumping makes at least 7 lines from top and bottom
set mouse=a
set guifont=JetbrainsMono\ NF:h16
let g:neovide_cursor_animation_length=0.0
let g:neovide_cursor_trail_length=0.0
nnoremap <up> <nop>
nnoremap <down> <nop>
nnoremap <left> <nop>
nnoremap <right> <nop>
inoremap <up> <up>
inoremap <down> <down>
inoremap <left> <left>
inoremap <right> <right>
if has("nvim")
augroup toggleRelativeLineNumbers
autocmd!
autocmd InsertEnter,BufLeave,WinLeave,FocusLost * nested
\ if &l:number && empty(&buftype) |
\ setlocal norelativenumber |
\ endif
autocmd InsertLeave,BufEnter,WinEnter,FocusGained * nested
\ if &l:number && empty(&buftype) |
\ setlocal relativenumber |
\ endif
augroup END
endif
if has('ide')
source /Users/jalal/.config/nvim/ideavimrc.vim
endif
if exists('g:vscode')
source /Users/jalal/.config/nvim/vscode.vim
endif
let neovide_cursor_animation_length=0
let neovide_cursor_trail_length=0
" Plugin emulators
set highlightedyank "highlight yanked objects
set surround
set argtextobj
"set NERDTree
"set exchange
set 'vim-paragraph-motion'
set textobj-indent
" Settings
" set clipboard+=ideaput
" Keymaps
nmap <C-S-j> <C-w>j
nmap <C-S-k> <C-w>k
nmap <C-S-h> <C-w>h
nmap <C-S-l> <C-w>l
nnoremap <leader><bar> :vsplit<CR>
nnoremap <leader>_ :split<CR>
nmap <leader><leader>w <Action>(Unsplit)
nmap <leader>w <Action>(CloseContent)
nmap U <Action>($Redo)
nmap <C-S-p> <Action>(PasteMultiple)
imap <C-S-i> <Action>(ParameterInfo)
nmap <C-r> <Action>(Run)
imap <C-r> <Action>(Run)
nmap <C-d> <Action>(Debug)
nmap <leader>d <Action>(GotoDeclaration)
nmap <leader>f <Action>(GotoFile)
nmap <leader>c <Action>(GotoClass)
nmap <leader>s <Action>(GotoSymbol)
nmap <leader>a <Action>(GotoAction)
nmap <leader>F <Action>(FindInPath)
nmap <leader>gg <Action>(ChangesView.Commit)
nmap <c-z> <Action>(ToggleDistractionFreeMode)
nmap <leader>t <Action>(ActivateTerminalToolWindow)
nmap <leader><leader>t <Action>(HideActiveWindow)
nmap <c-u> <Action>(GotoNextError)
nmap <c-s-u> <Action>(GotoPreviousError)
nmap <leader>ge <Action>(ShowErrorDescription)
" Refactoring
nmap <leader><leader>r <Action>(RenameElement)
nmap <leader><leader>f <Action>(ReformatCode)
nmap <leader><leader>o <Action>(OptimizeImports)
nmap <leader><leader>s <Action>(SurroundWith)
nmap <leader><leader>x <Action>(Unwrap)
nmap <leader>ii <Action>(ImplementMethods)
nmap <leader>oo <Action>(OverrideMethods)
vmap <c-j> <Action>(MoveLineDown)
vmap <c-k> <Action>(MoveLineUp)
nmap <c-j> <Action>(MoveLineDown)
nmap <c-k> <Action>(MoveLineUp)
" mapped to exapand/shrink selection instead
" nmap <c-s-j> <Action>(MoveStatementDown)
" nmap <c-s-k> <Action>(MoveStatementUp)
" Git
nmap <leader>gc <Action>(ActivateCommitToolWindow)
nmap <leader>gp <Action>(Vcs.Push)
nmap <leader>gb <Action>(Git.Branches)
nmap <leader>gj <Action>(VcsShowNextChangeMarker)
nmap <leader>gk <Action>(VcsShowPrevChangeMarker)
nmap <leader>gm <Action>(Git.Merge)
nmap <c-h> <Action>(PrevSplitter)
nmap <c-l> <Action>(NextSplitter)
"nmap <leader>w <Action>(KJumpAction.Word0)
" nmap <leader>l <Action>(KJumpAction.Line)
" For clojure
" set iskeyword=@,48-57,_,192-255,?,-,*,!,+,/,=,<,>,.,:,$
set iskeyword=@,48-57,_,192-255
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment