티스토리 뷰

사용 설정 방법

.vimrc나 .ideavimrc에 아래 한줄을 추가 해줍니다.

set surround

 

감싸는 괄호, " 없애기

 

mo = (map(int, i.split(' ')))

위 코드에서 map()을 감싸고 있는 (를 없애기 위해서는

ds(

를 씁니다.

"를 없애고 싶다면 ds"입니다

 

ds + <sth>이렇게 사용합니다.

 

 

# "hello world"

여기에서 "를 모두 빼고 싶다면  

hello 위에 커서를 놓고 ds"

-> # "hello world"

 

다시 넣고 싶다면 h위에 ys$"를 씁니다.

-> # hello world

 

"넣기

mo[2]를 "mo"[2]로 만들고 싶다면 m이나 o에 커서를 놓고

yse"를 씁니다.

 

memo[y][x] = 9

위 코드에서 9를 숫자가 아닌 문자로 바꾸기 위해서는 '나 "를 넣어주어야 합니다. 여기에서도 마찬가지로

yse'yse"를 씁니다.

 

vim에서 w는 다음 단어의 첫번째 글자로 이동하는 명령입니다. 그래서 ysw'를 쓴다면 아래의 경우에는 생각한 것과 조금 다른 동작이 나옵니다.

 

memo[y][x] == 0 and memo[y][x + 1] == '0':

위 코드의 0에 ''를 넣고 싶은 경우 memo[y][x] == '0' and memo[y][x + 1] == '0':

0에서 ysw'를 쓴다면 memo[y][x] == '0 'and... 이렇게 됩니다.

 

그래서 한글자만 하고 싶다면 ysl'로 해줍니다.

 

 

"를 '로 바꾸기

기존에 "로 입력 해놓은 것을 '로 바꾸고 싶을 때가 있습니다.

 

memo[y][x] = "9"를 memo[y][x] = 9로 바꿀때

cs"'를 씁니다.

 

 

참고

github.com/tpope/vim-surroun

 

tpope/vim-surround

surround.vim: quoting/parenthesizing made simple. Contribute to tpope/vim-surround development by creating an account on GitHub.

github.com

www.futurile.net/2016/03/19/vim-surround-plugin-tutorial/

 

Vim surround plugin tutorial

Anyone who uses Vim extensively knows a lot of it's power is being able to manipulate text as a set of components. We do this using text objects and motions. There are a lot of useful vim plugins that extend these capabilities. Tim Pope's vim surround plug

www.futurile.net

 

 

vim-visual-multi

sublime-text처럼 여러개를 선택 할 때 쓸 수 있습니다.

https://github.com/mg979/vim-visual-multi

 

GitHub - mg979/vim-visual-multi: Multiple cursors plugin for vim/neovim

Multiple cursors plugin for vim/neovim. Contribute to mg979/vim-visual-multi development by creating an account on GitHub.

github.com

 

설치 후 ctrl+N 으로 여러개 선택이 가능 합니다. 그리고 tab을 누르면 cursor모드로 바뀌고 수정 할 수 있습니다.

 

colorscheme

 

ubuntu에 colorscheme저장 되는 곳

/usr/share/vim/vim80/colors/

 

 

ron

darkblue

delek

공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/04   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
글 보관함